diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /tests/ui/static | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.tar.xz rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/static')
-rw-r--r-- | tests/ui/static/bad-const-type.rs | 2 | ||||
-rw-r--r-- | tests/ui/static/bad-const-type.stderr | 2 | ||||
-rw-r--r-- | tests/ui/static/issue-5216.stderr | 4 | ||||
-rw-r--r-- | tests/ui/static/static-lifetime-bound.rs | 2 | ||||
-rw-r--r-- | tests/ui/static/static-lifetime-bound.stderr | 12 | ||||
-rw-r--r-- | tests/ui/static/static-reference-to-fn-1.stderr | 8 |
6 files changed, 15 insertions, 15 deletions
diff --git a/tests/ui/static/bad-const-type.rs b/tests/ui/static/bad-const-type.rs index 934ee353d..24fd67ecb 100644 --- a/tests/ui/static/bad-const-type.rs +++ b/tests/ui/static/bad-const-type.rs @@ -1,4 +1,4 @@ static i: String = 10; //~^ ERROR mismatched types -//~| expected struct `String`, found integer +//~| expected `String`, found integer fn main() { println!("{}", i); } diff --git a/tests/ui/static/bad-const-type.stderr b/tests/ui/static/bad-const-type.stderr index dcc1ee07c..2e930f459 100644 --- a/tests/ui/static/bad-const-type.stderr +++ b/tests/ui/static/bad-const-type.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | static i: String = 10; | ^^- help: try using a conversion method: `.to_string()` | | - | expected struct `String`, found integer + | expected `String`, found integer error: aborting due to previous error diff --git a/tests/ui/static/issue-5216.stderr b/tests/ui/static/issue-5216.stderr index 1afff28f0..99c8b1aa1 100644 --- a/tests/ui/static/issue-5216.stderr +++ b/tests/ui/static/issue-5216.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:3:21 | LL | pub static C: S = S(f); - | - ^ expected struct `Box`, found fn item + | - ^ expected `Box<dyn FnMut() + Sync>`, found fn item | | | arguments to this struct are incorrect | @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:8:19 | LL | pub static D: T = g; - | ^ expected struct `Box`, found fn item + | ^ expected `Box<dyn FnMut() + Sync>`, found fn item | = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>` found fn item `fn() {g}` diff --git a/tests/ui/static/static-lifetime-bound.rs b/tests/ui/static/static-lifetime-bound.rs index b5da91ec3..847fe87b2 100644 --- a/tests/ui/static/static-lifetime-bound.rs +++ b/tests/ui/static/static-lifetime-bound.rs @@ -1,4 +1,4 @@ -fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +fn f<'a: 'static>(_: &'a i32) {} fn main() { let x = 0; diff --git a/tests/ui/static/static-lifetime-bound.stderr b/tests/ui/static/static-lifetime-bound.stderr index ef07a8931..19e55a658 100644 --- a/tests/ui/static/static-lifetime-bound.stderr +++ b/tests/ui/static/static-lifetime-bound.stderr @@ -1,14 +1,8 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:1:6 - | -LL | fn f<'a: 'static>(_: &'a i32) {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | +LL | let x = 0; + | - binding `x` declared here LL | f(&x); | --^^- | | | @@ -17,6 +11,6 @@ LL | f(&x); LL | } | - `x` dropped here while still borrowed -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr index 67b478bdb..b68352b51 100644 --- a/tests/ui/static/static-reference-to-fn-1.stderr +++ b/tests/ui/static/static-reference-to-fn-1.stderr @@ -2,10 +2,16 @@ error[E0308]: mismatched types --> $DIR/static-reference-to-fn-1.rs:17:15 | LL | func: &foo, - | ^^^^ expected fn pointer, found fn item + | ^^^^ expected `&fn() -> Option<isize>`, found `&fn() -> Option<isize> {foo}` | = note: expected reference `&fn() -> Option<isize>` found reference `&fn() -> Option<isize> {foo}` + = note: fn items are distinct from fn pointers + = note: when the arguments and return types match, functions can be coerced to function pointers +help: consider casting to a fn pointer + | +LL | func: &(foo as fn() -> Option<isize>), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error |