diff options
Diffstat (limited to 'tests/ui/suggestions')
100 files changed, 801 insertions, 344 deletions
diff --git a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr index bc097bf6e..510b99bb5 100644 --- a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -2,9 +2,9 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:6:34 | LL | let _: Option<(i32, bool)> = Some(1, 2); - | ^^^^ - argument of type `{integer}` unexpected + | ^^^^ - unexpected argument of type `{integer}` | -note: expected tuple, found integer +note: expected `(i32, bool)`, found integer --> $DIR/args-instead-of-tuple-errors.rs:6:39 | LL | let _: Option<(i32, bool)> = Some(1, 2); @@ -22,16 +22,17 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: remove the extra argument | -LL | let _: Option<(i32, bool)> = Some(/* (i32, bool) */); - | ~~~~~~~~~~~~~~~~~~~ +LL - let _: Option<(i32, bool)> = Some(1, 2); +LL + let _: Option<(i32, bool)> = Some(/* (i32, bool) */); + | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:8:5 | LL | int_bool(1, 2); - | ^^^^^^^^ - argument of type `{integer}` unexpected + | ^^^^^^^^ - unexpected argument of type `{integer}` | -note: expected tuple, found integer +note: expected `(i32, bool)`, found integer --> $DIR/args-instead-of-tuple-errors.rs:8:14 | LL | int_bool(1, 2); @@ -45,8 +46,9 @@ LL | fn int_bool(_: (i32, bool)) { | ^^^^^^^^ -------------- help: remove the extra argument | -LL | int_bool(/* (i32, bool) */); - | ~~~~~~~~~~~~~~~~~~~ +LL - int_bool(1, 2); +LL + int_bool(/* (i32, bool) */); + | error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied --> $DIR/args-instead-of-tuple-errors.rs:11:28 @@ -65,7 +67,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 | LL | let _: Option<(i32,)> = Some(5_usize); - | ---- ^^^^^^^ expected tuple, found `usize` + | ---- ^^^^^^^ expected `(i32,)`, found `usize` | | | arguments to this enum variant are incorrect | @@ -85,7 +87,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:17:34 | LL | let _: Option<(i32,)> = Some((5_usize)); - | ---- ^^^^^^^^^ expected tuple, found `usize` + | ---- ^^^^^^^^^ expected `(i32,)`, found `usize` | | | arguments to this enum variant are incorrect | diff --git a/tests/ui/suggestions/args-instead-of-tuple.stderr b/tests/ui/suggestions/args-instead-of-tuple.stderr index 3ed9dbf4a..0bdf10b0d 100644 --- a/tests/ui/suggestions/args-instead-of-tuple.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple.stderr @@ -41,7 +41,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:14:34 | LL | let _: Option<(i32,)> = Some(3); - | ---- ^ expected tuple, found integer + | ---- ^ expected `(i32,)`, found integer | | | arguments to this enum variant are incorrect | @@ -58,7 +58,7 @@ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:17:34 | LL | let _: Option<(i32,)> = Some((3)); - | ---- ^^^ expected tuple, found integer + | ---- ^^^ expected `(i32,)`, found integer | | | arguments to this enum variant are incorrect | diff --git a/tests/ui/suggestions/as-ref.stderr b/tests/ui/suggestions/as-ref.stderr index deafa9f48..0ee343ebf 100644 --- a/tests/ui/suggestions/as-ref.stderr +++ b/tests/ui/suggestions/as-ref.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:7:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:8:39 | LL | opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:10:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:11:37 | LL | opt.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -64,7 +64,7 @@ error[E0308]: mismatched types LL | let y: Option<&usize> = x; | -------------- ^ | | | - | | expected enum `Option`, found `&Option<usize>` + | | expected `Option<&usize>`, found `&Option<usize>` | | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()` | expected due to this | @@ -75,7 +75,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:15:37 | LL | let y: Result<&usize, &usize> = x; - | ---------------------- ^ expected enum `Result`, found reference + | ---------------------- ^ expected `Result<&usize, &usize>`, found `&Result<usize, usize>` | | | expected due to this | @@ -90,7 +90,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:19:36 | LL | let y: Result<&usize, usize> = x; - | --------------------- ^ expected enum `Result`, found reference + | --------------------- ^ expected `Result<&usize, usize>`, found `&Result<usize, usize>` | | | expected due to this | @@ -101,7 +101,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:22:42 | LL | multiple_ref_opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -116,7 +116,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:23:52 | LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` @@ -131,7 +131,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:25:45 | LL | multiple_ref_result.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found struct `Foo` + | --- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().map` @@ -146,7 +146,7 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:26:53 | LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found struct `Foo` + | -------- --------- ^^^ expected `&Foo`, found `Foo` | | | | | arguments to this function are incorrect | help: consider using `as_ref` instead: `as_ref().and_then` diff --git a/tests/ui/suggestions/assoc-const-without-self.rs b/tests/ui/suggestions/assoc-const-without-self.rs new file mode 100644 index 000000000..95070ec60 --- /dev/null +++ b/tests/ui/suggestions/assoc-const-without-self.rs @@ -0,0 +1,11 @@ +struct Foo; + +impl Foo { + const A_CONST: usize = 1; + + fn foo() -> usize { + A_CONST //~ ERROR cannot find value `A_CONST` in this scope + } +} + +fn main() {} diff --git a/tests/ui/suggestions/assoc-const-without-self.stderr b/tests/ui/suggestions/assoc-const-without-self.stderr new file mode 100644 index 000000000..88d72da70 --- /dev/null +++ b/tests/ui/suggestions/assoc-const-without-self.stderr @@ -0,0 +1,14 @@ +error[E0425]: cannot find value `A_CONST` in this scope + --> $DIR/assoc-const-without-self.rs:7:9 + | +LL | A_CONST + | ^^^^^^^ not found in this scope + | +help: consider using the associated constant + | +LL | Self::A_CONST + | ++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr index afef38f12..211cb1584 100644 --- a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr +++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr @@ -36,7 +36,7 @@ LL | let y: i32 = i32::max - 42; | | | fn(i32, i32) -> i32 {<i32 as Ord>::max} | -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let y: i32 = i32::max(/* i32 */, /* i32 */) - 42; | ++++++++++++++++++++++ diff --git a/tests/ui/suggestions/borrow-for-loop-head.stderr b/tests/ui/suggestions/borrow-for-loop-head.stderr index cbdb94877..0f179438a 100644 --- a/tests/ui/suggestions/borrow-for-loop-head.stderr +++ b/tests/ui/suggestions/borrow-for-loop-head.stderr @@ -1,6 +1,8 @@ error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/borrow-for-loop-head.rs:4:18 | +LL | let a = vec![1, 2, 3]; + | - binding `a` declared here LL | for i in &a { | -- borrow of `a` occurs here LL | for j in a { diff --git a/tests/ui/suggestions/boxed-variant-field.stderr b/tests/ui/suggestions/boxed-variant-field.stderr index 9ae36a06a..1adbc0540 100644 --- a/tests/ui/suggestions/boxed-variant-field.stderr +++ b/tests/ui/suggestions/boxed-variant-field.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/boxed-variant-field.rs:9:31 | LL | Ty::List(elem) => foo(elem), - | --- ^^^^ expected enum `Ty`, found struct `Box` + | --- ^^^^ expected `Ty`, found `Box<Ty>` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/call-boxed.stderr b/tests/ui/suggestions/call-boxed.stderr index 9b619ac9a..9b31ee07c 100644 --- a/tests/ui/suggestions/call-boxed.stderr +++ b/tests/ui/suggestions/call-boxed.stderr @@ -6,7 +6,7 @@ LL | let mut x = 1i32; LL | let y = Box::new(|| 1); | -- the found closure LL | x = y; - | ^ expected `i32`, found struct `Box` + | ^ expected `i32`, found `Box<[closure@call-boxed.rs:3:22]>` | = note: expected type `i32` found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>` diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr index 965dbb967..11d9b8391 100644 --- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr +++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn foo(mut s: String) -> String { | ------ expected `String` because of return type LL | s.push_str("asdf") - | ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `()` + | ^^^^^^^^^^^^^^^^^^ expected `String`, found `()` | note: method `push_str` modifies its receiver in-place --> $DIR/chain-method-call-mutation-in-place.rs:3:7 diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr index 26ab515d9..45593035b 100644 --- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr +++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr @@ -26,7 +26,7 @@ error[E0308]: mismatched types LL | fn wut(t: &Foo) -> Foo { | --- expected `Foo` because of return type LL | t.clone() - | ^^^^^^^^^ expected struct `Foo`, found `&Foo` + | ^^^^^^^^^ expected `Foo`, found `&Foo` | note: `Foo` does not implement `Clone`, so `&Foo` was cloned instead --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:9:5 diff --git a/tests/ui/suggestions/const-in-struct-pat.stderr b/tests/ui/suggestions/const-in-struct-pat.stderr index c8b93f3dc..f344ac06d 100644 --- a/tests/ui/suggestions/const-in-struct-pat.stderr +++ b/tests/ui/suggestions/const-in-struct-pat.stderr @@ -7,7 +7,7 @@ LL | struct foo; LL | let Thing { foo } = t; | ^^^ - this expression has type `Thing` | | - | expected struct `String`, found struct `foo` + | expected `String`, found `foo` | `foo` is interpreted as a unit struct, not a new binding | help: bind the struct field to a different name instead diff --git a/tests/ui/suggestions/constrain-suggest-ice.rs b/tests/ui/suggestions/constrain-suggest-ice.rs index 69b874bed..d6e5263ff 100644 --- a/tests/ui/suggestions/constrain-suggest-ice.rs +++ b/tests/ui/suggestions/constrain-suggest-ice.rs @@ -1,11 +1,9 @@ -struct Bug<S>{ //~ ERROR parameter `S` is never used [E0392] +struct Bug<S>{ A: [(); { - let x: [u8; Self::W] = [0; Self::W]; //~ ERROR generic `Self` types are currently not permitted in anonymous constants - //~^ ERROR generic `Self` types are currently not permitted in anonymous constants - //~^^ ERROR the size for values of type `S` cannot be known at compilation time [E0277] - F //~ ERROR cannot find value `F` in this scope [E0425] + let x: [u8; Self::W] = [0; Self::W]; + F } -} //~ ERROR mismatched closing delimiter: `}` +} //~^ ERROR mismatched closing delimiter: `}` fn main() {} diff --git a/tests/ui/suggestions/constrain-suggest-ice.stderr b/tests/ui/suggestions/constrain-suggest-ice.stderr index 2af7c2f69..9b92091de 100644 --- a/tests/ui/suggestions/constrain-suggest-ice.stderr +++ b/tests/ui/suggestions/constrain-suggest-ice.stderr @@ -9,64 +9,5 @@ LL | A: [(); { LL | } | ^ mismatched closing delimiter -error: mismatched closing delimiter: `}` - --> $DIR/constrain-suggest-ice.rs:2:8 - | -LL | struct Bug<S>{ - | - closing delimiter possibly meant for this -LL | A: [(); { - | ^ unclosed delimiter -... -LL | } - | ^ mismatched closing delimiter - -error[E0425]: cannot find value `F` in this scope - --> $DIR/constrain-suggest-ice.rs:6:9 - | -LL | F - | ^ help: a local variable with a similar name exists: `x` - -error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/constrain-suggest-ice.rs:3:21 - | -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^ - -error: generic `Self` types are currently not permitted in anonymous constants - --> $DIR/constrain-suggest-ice.rs:3:36 - | -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^ - -error[E0277]: the size for values of type `S` cannot be known at compilation time - --> $DIR/constrain-suggest-ice.rs:3:36 - | -LL | struct Bug<S>{ - | - this type parameter needs to be `std::marker::Sized` -LL | A: [(); { -LL | let x: [u8; Self::W] = [0; Self::W]; - | ^^^^^^^ doesn't have a size known at compile-time - | -note: required by a bound in `Bug` - --> $DIR/constrain-suggest-ice.rs:1:12 - | -LL | struct Bug<S>{ - | ^ required by this bound in `Bug` -help: consider relaxing the implicit `Sized` restriction - | -LL | struct Bug<S: ?Sized>{ - | ++++++++ - -error[E0392]: parameter `S` is never used - --> $DIR/constrain-suggest-ice.rs:1:12 - | -LL | struct Bug<S>{ - | ^ unused parameter - | - = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData` - = help: if you intended `S` to be a const parameter, use `const S: usize` instead - -error: aborting due to 7 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0277, E0392, E0425. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/copied-and-cloned.stderr b/tests/ui/suggestions/copied-and-cloned.stderr index a6336281b..067808141 100644 --- a/tests/ui/suggestions/copied-and-cloned.stderr +++ b/tests/ui/suggestions/copied-and-cloned.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:7:26 | LL | expect::<Option<()>>(x); - | -------------------- ^ expected `()`, found `&()` + | -------------------- ^ expected `Option<()>`, found `Option<&()>` | | | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:11:30 | LL | expect::<Result<(), ()>>(x); - | ------------------------ ^ expected `()`, found `&()` + | ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>` | | | arguments to this function are incorrect | @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:16:30 | LL | expect::<Option<String>>(x); - | ------------------------ ^ expected struct `String`, found `&String` + | ------------------------ ^ expected `Option<String>`, found `Option<&String>` | | | arguments to this function are incorrect | @@ -62,7 +62,7 @@ error[E0308]: mismatched types --> $DIR/copied-and-cloned.rs:20:34 | LL | expect::<Result<String, ()>>(x); - | ---------------------------- ^ expected struct `String`, found `&String` + | ---------------------------- ^ expected `Result<String, ()>`, found `Result<&String, _>` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr index 5dc4e6444..c6867270a 100644 --- a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr +++ b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | / intrinsic_match! { LL | | "abc" LL | | }; - | |_____^ expected `&str`, found struct `String` + | |_____^ expected `&str`, found `String` | = note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr index 67f4ac08d..866d3fab4 100644 --- a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr +++ b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-child.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/hidden-child.rs:9:26 | LL | let x: Option<i32> = 1i32; - | ----------- ^^^^ expected enum `Option`, found `i32` + | ----------- ^^^^ expected `Option<i32>`, found `i32` | | | expected due to this | diff --git a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr index d92b81279..f8029e452 100644 --- a/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr +++ b/tests/ui/suggestions/dont-suggest-doc-hidden-variant-for-enum/hidden-parent.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/hidden-parent.rs:6:26 | LL | let x: Option<i32> = 1i32; - | ----------- ^^^^ expected enum `Option`, found `i32` + | ----------- ^^^^ expected `Option<i32>`, found `i32` | | | expected due to this | diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index b1e04dab8..90ea06239 100644 --- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -5,7 +5,7 @@ LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, | - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type LL | // We could instead use an `async` block, but this way we have no std spans. LL | x - | ^ expected struct `Pin`, found type parameter `F` + | ^ expected `Pin<Box<...>>`, found type parameter `F` | = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` found type parameter `F` @@ -20,7 +20,7 @@ error[E0308]: mismatched types LL | fn bar<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> { | ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type LL | Box::new(x) - | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box` + | ^^^^^^^^^^^ expected `Pin<Box<...>>`, found `Box<F>` | = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` found struct `Box<F>` @@ -32,7 +32,7 @@ error[E0308]: mismatched types LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> { | - this type parameter LL | Pin::new(x) - | -------- ^ expected struct `Box`, found type parameter `F` + | -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F` | | | arguments to this function are incorrect | help: use `Box::pin` to pin and box this expression: `Box::pin` @@ -74,7 +74,7 @@ LL | | 42 LL | | } | | ^ | | | - | |_____expected struct `Pin`, found `async` block + | |_____expected `Pin<Box<...>>`, found `async` block | arguments to this function are incorrect | = note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>` diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index b9f0f788b..007bc6ecf 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -7,7 +7,7 @@ LL | Fst, LL | if let B::Fst = a {}; | ^^^^^^ - this expression has type `A` | | - | expected struct `A`, found enum `B` + | expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -24,7 +24,7 @@ LL | match a { | - this expression has type `A` ... LL | B::Fst => (), - | ^^^^^^ expected struct `A`, found enum `B` + | ^^^^^^ expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -41,7 +41,7 @@ LL | match a { | - this expression has type `A` ... LL | B::Snd => (), - | ^^^^^^ expected struct `A`, found enum `B` + | ^^^^^^ expected `A`, found `B` | help: you might have meant to use field `b` whose type is `B` | @@ -55,7 +55,7 @@ LL | match foo { | --- this expression has type `Foo` LL | LL | 1u32 => (), - | ^^^^ expected union `Foo`, found `u32` + | ^^^^ expected `Foo`, found `u32` | help: you might have meant to use field `bar` whose type is `u32` | diff --git a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr index 4cbcd31fa..a137db8cd 100644 --- a/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr +++ b/tests/ui/suggestions/fn-or-tuple-struct-without-args.stderr @@ -23,7 +23,7 @@ LL | struct S(usize, usize); | -------- `S` defines a struct constructor here, which should be called ... LL | let _: S = S; - | - ^ expected struct `S`, found struct constructor + | - ^ expected `S`, found struct constructor | | | expected due to this | @@ -59,7 +59,7 @@ LL | struct V(); | -------- `V` defines a struct constructor here, which should be called ... LL | let _: V = V; - | - ^ expected struct `V`, found struct constructor + | - ^ expected `V`, found struct constructor | | | expected due to this | @@ -113,7 +113,7 @@ LL | A(usize), | - `A` defines an enum variant constructor here, which should be called ... LL | let _: E = E::A; - | - ^^^^ expected enum `E`, found enum constructor + | - ^^^^ expected `E`, found enum constructor | | | expected due to this | @@ -206,7 +206,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:41:20 | LL | fn ban(&self) -> usize { 42 } - | ---------------------- associated function `ban` defined here + | ---------------------- method `ban` defined here ... LL | let _: usize = X::ban; | ----- ^^^^^^ expected `usize`, found fn item @@ -215,7 +215,7 @@ LL | let _: usize = X::ban; | = note: expected type `usize` found fn item `for<'a> fn(&'a X) -> usize {<X as T>::ban}` -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let _: usize = X::ban(/* &X */); | ++++++++++ @@ -224,7 +224,7 @@ error[E0308]: mismatched types --> $DIR/fn-or-tuple-struct-without-args.rs:42:20 | LL | fn bal(&self) -> usize; - | ----------------------- associated function `bal` defined here + | ----------------------- method `bal` defined here ... LL | let _: usize = X::bal; | ----- ^^^^^^ expected `usize`, found fn item @@ -233,7 +233,7 @@ LL | let _: usize = X::bal; | = note: expected type `usize` found fn item `for<'a> fn(&'a X) -> usize {<X as T>::bal}` -help: use parentheses to call this associated function +help: use parentheses to call this method | LL | let _: usize = X::bal(/* &X */); | ++++++++++ diff --git a/tests/ui/suggestions/format-borrow.stderr b/tests/ui/suggestions/format-borrow.stderr index 8ed2b9c9a..3ea0d208c 100644 --- a/tests/ui/suggestions/format-borrow.stderr +++ b/tests/ui/suggestions/format-borrow.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:2:21 | LL | let a: String = &String::from("a"); - | ------ ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String` + | ------ ^^^^^^^^^^^^^^^^^^ expected `String`, found `&String` | | | expected due to this | @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:4:21 | LL | let b: String = &format!("b"); - | ------ ^^^^^^^^^^^^^ expected struct `String`, found `&String` + | ------ ^^^^^^^^^^^^^ expected `String`, found `&String` | | | expected due to this | @@ -38,7 +38,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:6:21 | LL | let c: String = &mut format!("c"); - | ------ ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` + | ------ ^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String` | | | expected due to this | @@ -56,7 +56,7 @@ error[E0308]: mismatched types --> $DIR/format-borrow.rs:8:21 | LL | let d: String = &mut (format!("d")); - | ------ ^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` + | ------ ^^^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String` | | | expected due to this | diff --git a/tests/ui/suggestions/if-then-neeing-semi.rs b/tests/ui/suggestions/if-then-neeing-semi.rs index b487f013d..a4eefb415 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.rs +++ b/tests/ui/suggestions/if-then-neeing-semi.rs @@ -15,18 +15,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = if true { @@ -35,8 +26,8 @@ async fn async_extra_semicolon_same() { //~^ HELP consider removing this semicolon } else { async_dummy() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -48,8 +39,8 @@ async fn async_extra_semicolon_different() { //~^ HELP consider removing this semicolon } else { async_dummy2() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -61,8 +52,7 @@ async fn async_different_futures() { //~| HELP consider `await`ing on both `Future`s } else { async_dummy2() //~ ERROR `if` and `else` have incompatible types - //~^ NOTE expected opaque type, found a different opaque type - //~| NOTE expected opaque type `impl Future<Output = ()>` + //~^ NOTE expected future, found a different future //~| NOTE distinct uses of `impl Trait` result in different opaque types }; } diff --git a/tests/ui/suggestions/if-then-neeing-semi.stderr b/tests/ui/suggestions/if-then-neeing-semi.stderr index d7c5818ab..6833e0bab 100644 --- a/tests/ui/suggestions/if-then-neeing-semi.stderr +++ b/tests/ui/suggestions/if-then-neeing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:37:9 + --> $DIR/if-then-neeing-semi.rs:28:9 | LL | let _ = if true { | _____________- @@ -9,19 +9,17 @@ LL | | async_dummy(); LL | | LL | | } else { LL | | async_dummy() - | | ^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 +note: calling an async function returns a future + --> $DIR/if-then-neeing-semi.rs:28:9 | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future<Output = ()>` +LL | async_dummy() + | ^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | async_dummy().await @@ -33,7 +31,7 @@ LL + async_dummy() | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:50:9 + --> $DIR/if-then-neeing-semi.rs:41:9 | LL | let _ = if true { | _____________- @@ -43,19 +41,17 @@ LL | | async_dummy(); LL | | LL | | } else { LL | | async_dummy2() - | | ^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 +note: calling an async function returns a future + --> $DIR/if-then-neeing-semi.rs:41:9 | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future<Output = ()>` +LL | async_dummy2() + | ^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | async_dummy2().await @@ -69,7 +65,7 @@ LL ~ Box::new(async_dummy2()) | error[E0308]: `if` and `else` have incompatible types - --> $DIR/if-then-neeing-semi.rs:63:9 + --> $DIR/if-then-neeing-semi.rs:54:9 | LL | let _ = if true { | _____________- @@ -79,24 +75,12 @@ LL | | async_dummy() LL | | LL | | } else { LL | | async_dummy2() - | | ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type -... | + | | ^^^^^^^^^^^^^^ expected future, found a different future +LL | | LL | | LL | | }; | |_____- `if` and `else` have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:18:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/if-then-neeing-semi.rs:24:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>) - found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index 864ab0535..fc5a52174 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -12,7 +12,7 @@ note: required by a bound in `foo` --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20 | LL | fn foo<X>(_: X) - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for<'b> &'b X: Trait, | ^^^^^ required by this bound in `foo` diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr index 679ebd61e..da72c8ebf 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr @@ -17,7 +17,7 @@ note: the used `impl` has a `'static` requirement LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> { | ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement LL | fn use_self<K>(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement help: consider relaxing the implicit `'static` requirement | LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ { @@ -42,7 +42,7 @@ note: the used `impl` has a `'static` requirement LL | impl dyn ObjectTrait { | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement help: consider relaxing the implicit `'static` requirement | LL | impl dyn ObjectTrait + '_ { @@ -65,7 +65,7 @@ note: the used `impl` has a `'static` requirement --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:87:26 | LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement ... LL | impl MyTrait for dyn ObjectTrait {} | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement @@ -91,7 +91,7 @@ note: the used `impl` has a `'static` requirement --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:106:26 | LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement + | -------- calling this method introduces the `impl`'s `'static` requirement ... LL | impl MyTrait for dyn ObjectTrait {} | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement diff --git a/tests/ui/suggestions/into-convert.stderr b/tests/ui/suggestions/into-convert.stderr index d43104a21..704b280a9 100644 --- a/tests/ui/suggestions/into-convert.stderr +++ b/tests/ui/suggestions/into-convert.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:6:16 | LL | let x: A = B; - | - ^ expected struct `A`, found struct `B` + | - ^ expected `A`, found `B` | | | expected due to this | @@ -15,7 +15,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:10:24 | LL | let y: Arc<Path> = PathBuf::new(); - | --------- ^^^^^^^^^^^^^^ expected struct `Arc`, found struct `PathBuf` + | --------- ^^^^^^^^^^^^^^ expected `Arc<Path>`, found `PathBuf` | | | expected due to this | @@ -30,7 +30,7 @@ error[E0308]: mismatched types --> $DIR/into-convert.rs:14:24 | LL | let z: AtomicU32 = 1; - | --------- ^ expected struct `AtomicU32`, found integer + | --------- ^ expected `AtomicU32`, found integer | | | expected due to this | diff --git a/tests/ui/suggestions/issue-101065.stderr b/tests/ui/suggestions/issue-101065.stderr index 6f7ecd24c..9f77ead42 100644 --- a/tests/ui/suggestions/issue-101065.stderr +++ b/tests/ui/suggestions/issue-101065.stderr @@ -7,7 +7,7 @@ LL | | FakeResult::Ok(FakeResult::Ok(())) | | ---------------------------------- expected because of this LL | | } else { LL | | FakeResult::Ok(()) - | | ^^^^^^^^^^^^^^^^^^ expected enum `FakeResult`, found `()` + | | ^^^^^^^^^^^^^^^^^^ expected `FakeResult<FakeResult<()>>`, found `FakeResult<()>` LL | | }; | |_____- `if` and `else` have incompatible types | diff --git a/tests/ui/suggestions/issue-101421.rs b/tests/ui/suggestions/issue-101421.rs index b615997d1..1407ebd27 100644 --- a/tests/ui/suggestions/issue-101421.rs +++ b/tests/ui/suggestions/issue-101421.rs @@ -8,5 +8,5 @@ impl Ice for () { fn main() { ().f::<()>(()); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied } diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index f8e1efb88..2656ab3db 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); @@ -6,7 +6,7 @@ LL | ().f::<()>(()); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); diff --git a/tests/ui/suggestions/issue-101465.stderr b/tests/ui/suggestions/issue-101465.stderr index e2ca77712..2aec3c863 100644 --- a/tests/ui/suggestions/issue-101465.stderr +++ b/tests/ui/suggestions/issue-101465.stderr @@ -5,7 +5,7 @@ LL | / match true { LL | | true => B, | | - this is found to be of type `B` LL | | false => C, - | | ^ expected struct `B`, found struct `C` + | | ^ expected `B`, found `C` LL | | LL | | } | |_____- `match` arms have incompatible types diff --git a/tests/ui/suggestions/issue-101984.stderr b/tests/ui/suggestions/issue-101984.stderr index 81758a700..151587d42 100644 --- a/tests/ui/suggestions/issue-101984.stderr +++ b/tests/ui/suggestions/issue-101984.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | let (cmp, router) = self.router.at()?; | ^^^^^^^^^^^^^ ----------------- this expression has type `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>` | | - | expected struct `Match`, found tuple + | expected `Match<&(fn(&()), Box<Wrapper>)>`, found `(_, _)` | = note: expected struct `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>` found tuple `(_, _)` diff --git a/tests/ui/suggestions/issue-102892.stderr b/tests/ui/suggestions/issue-102892.stderr index a3dbc7cb8..e64a89ffe 100644 --- a/tests/ui/suggestions/issue-102892.stderr +++ b/tests/ui/suggestions/issue-102892.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:15:26 | LL | let (a, b): (A, B) = &**arc; // suggests putting `&**arc` here too - | ------ ^^^^^^ expected tuple, found `&(A, B)` + | ------ ^^^^^^ expected `(A, B)`, found `&(A, B)` | | | expected due to this | @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:20:32 | LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too - | ^^^^^^^^^^^^^^ expected tuple, found `&mut (A, B)` + | ^^^^^^^^^^^^^^ expected `(A, B)`, found `&mut (A, B)` | = note: expected tuple `(A, B)` found mutable reference `&mut (A, B)` @@ -40,7 +40,7 @@ error[E0308]: mismatched types --> $DIR/issue-102892.rs:20:48 | LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too - | ^^^^^^^^^^ expected struct `A`, found `&A` + | ^^^^^^^^^^ expected `A`, found `&A` | help: consider removing the borrow | diff --git a/tests/ui/suggestions/issue-104287.rs b/tests/ui/suggestions/issue-104287.rs index e3fa22a8f..37b3339fa 100644 --- a/tests/ui/suggestions/issue-104287.rs +++ b/tests/ui/suggestions/issue-104287.rs @@ -8,6 +8,6 @@ impl S { fn main() { let x = S; foo::<()>(x); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| ERROR cannot find function `foo` in this scope } diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index 602a01828..ed59b2e7a 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); @@ -6,7 +6,7 @@ LL | foo::<()>(x); | | | expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/issue-104287.rs:6:8 | LL | fn foo(&self) {} diff --git a/tests/ui/suggestions/issue-104961.fixed b/tests/ui/suggestions/issue-104961.fixed new file mode 100644 index 000000000..520d638b1 --- /dev/null +++ b/tests/ui/suggestions/issue-104961.fixed @@ -0,0 +1,16 @@ +// run-rustfix + +fn foo(x: &str) -> bool { + x.starts_with(&("hi".to_string() + " you")) + //~^ ERROR expected a `FnMut<(char,)>` closure, found `String` +} + +fn foo2(x: &str) -> bool { + x.starts_with(&"hi".to_string()) + //~^ ERROR expected a `FnMut<(char,)>` closure, found `String` +} + +fn main() { + foo("hi you"); + foo2("hi"); +} diff --git a/tests/ui/suggestions/issue-104961.rs b/tests/ui/suggestions/issue-104961.rs new file mode 100644 index 000000000..aeb787abb --- /dev/null +++ b/tests/ui/suggestions/issue-104961.rs @@ -0,0 +1,16 @@ +// run-rustfix + +fn foo(x: &str) -> bool { + x.starts_with("hi".to_string() + " you") + //~^ ERROR expected a `FnMut<(char,)>` closure, found `String` +} + +fn foo2(x: &str) -> bool { + x.starts_with("hi".to_string()) + //~^ ERROR expected a `FnMut<(char,)>` closure, found `String` +} + +fn main() { + foo("hi you"); + foo2("hi"); +} diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr new file mode 100644 index 000000000..8cec6a3f8 --- /dev/null +++ b/tests/ui/suggestions/issue-104961.stderr @@ -0,0 +1,37 @@ +error[E0277]: expected a `FnMut<(char,)>` closure, found `String` + --> $DIR/issue-104961.rs:4:19 + | +LL | x.starts_with("hi".to_string() + " you") + | ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | | + | required by a bound introduced by this call + | + = note: the trait bound `String: Pattern<'_>` is not satisfied + = note: required for `String` to implement `Pattern<'_>` +note: required by a bound in `core::str::<impl str>::starts_with` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL +help: consider borrowing here + | +LL | x.starts_with(&("hi".to_string() + " you")) + | ++ + + +error[E0277]: expected a `FnMut<(char,)>` closure, found `String` + --> $DIR/issue-104961.rs:9:19 + | +LL | x.starts_with("hi".to_string()) + | ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern<'_>` is not implemented for `String` + | | + | required by a bound introduced by this call + | + = note: the trait bound `String: Pattern<'_>` is not satisfied + = note: required for `String` to implement `Pattern<'_>` +note: required by a bound in `core::str::<impl str>::starts_with` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL +help: consider borrowing here + | +LL | x.starts_with(&"hi".to_string()) + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/issue-105494.stderr b/tests/ui/suggestions/issue-105494.stderr index 5aa3f2af7..4cb4a399a 100644 --- a/tests/ui/suggestions/issue-105494.stderr +++ b/tests/ui/suggestions/issue-105494.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:2:19 | LL | let _v: i32 = (1 as i32).to_string(); - | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` + | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` | | | expected due to this | @@ -16,7 +16,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:5:19 | LL | let _v: i32 = (1 as i128).to_string(); - | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String` + | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String` | | | expected due to this @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/issue-105494.rs:7:20 | LL | let _v: &str = "foo".to_string(); - | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found struct `String` + | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found `String` | | | expected due to this | @@ -41,7 +41,7 @@ LL | let mut path: String = "/usr".to_string(); | ------ expected due to this type ... LL | path = format!("{}/{}", path, folder).as_str(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&str` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str` | help: try removing the method call | diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr index 1e66fe3af..4e91dfc82 100644 --- a/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr +++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:11:9 | LL | foo(s); - | --- ^ expected struct `S`, found `&S` + | --- ^ expected `S`, found `&S` | | | arguments to this function are incorrect | @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/issue-106443-sugg-clone-for-arg.rs:17:9 | LL | bar(t); - | --- ^ expected struct `T`, found `&T` + | --- ^ expected `T`, found `&T` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/issue-52820.stderr b/tests/ui/suggestions/issue-52820.stderr index 09269ed4e..a67d75014 100644 --- a/tests/ui/suggestions/issue-52820.stderr +++ b/tests/ui/suggestions/issue-52820.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-52820.rs:12:9 | LL | guts, - | ^^^^ expected struct `String`, found `&str` + | ^^^^ expected `String`, found `&str` | help: try using a conversion method | @@ -16,7 +16,7 @@ LL | brains: guts.clone(), | ^^^^^-----^^ | | | | | help: try using a conversion method: `to_string` - | expected struct `String`, found `&str` + | expected `String`, found `&str` error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-53692.stderr b/tests/ui/suggestions/issue-53692.stderr index 3a1b624f4..469a53841 100644 --- a/tests/ui/suggestions/issue-53692.stderr +++ b/tests/ui/suggestions/issue-53692.stderr @@ -5,7 +5,7 @@ LL | let items_clone: Vec<i32> = ref_items.clone(); | -------- ^^^^^^^^^^-----^^ | | | | | | | help: try using a conversion method: `to_vec` - | | expected struct `Vec`, found `&[i32]` + | | expected `Vec<i32>`, found `&[i32]` | expected due to this | = note: expected struct `Vec<i32>` @@ -18,7 +18,7 @@ LL | let string: String = s.clone(); | ------ ^^-----^^ | | | | | | | help: try using a conversion method: `to_string` - | | expected struct `String`, found `&str` + | | expected `String`, found `&str` | expected due to this error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-59819.stderr b/tests/ui/suggestions/issue-59819.stderr index 40e4c7b78..43acf9549 100644 --- a/tests/ui/suggestions/issue-59819.stderr +++ b/tests/ui/suggestions/issue-59819.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-59819.rs:28:18 | LL | let y: i32 = x; - | --- ^ expected `i32`, found struct `Foo` + | --- ^ expected `i32`, found `Foo` | | | expected due to this | @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | let g: String = f; | ------ ^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found struct `Bar` + | | expected `String`, found `Bar` | expected due to this error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr index fae474ced..6d0a0c7b3 100644 --- a/tests/ui/suggestions/issue-81839.stderr +++ b/tests/ui/suggestions/issue-81839.stderr @@ -10,17 +10,9 @@ LL | | cx.answer_str("hi"); | | this is found to be of type `()` LL | | } LL | | _ => cx.answer_str("hi"), - | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^^^^^^ expected `()`, found future LL | | } | |_____- `match` arms have incompatible types - | -note: while checking the return type of the `async fn` - --> $DIR/auxiliary/issue-81839.rs:6:49 - | -LL | pub async fn answer_str(&self, _s: &str) -> Test { - | ^^^^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future<Output = Test>` error: aborting due to previous error diff --git a/tests/ui/suggestions/issue-83943.stderr b/tests/ui/suggestions/issue-83943.stderr index 885106e84..c73667f09 100644 --- a/tests/ui/suggestions/issue-83943.stderr +++ b/tests/ui/suggestions/issue-83943.stderr @@ -8,7 +8,7 @@ LL | | } else { LL | | "B" | | ^^^- help: try using a conversion method: `.to_string()` | | | - | | expected struct `String`, found `&str` + | | expected `String`, found `&str` LL | | }; | |_____- `if` and `else` have incompatible types diff --git a/tests/ui/suggestions/issue-84973.stderr b/tests/ui/suggestions/issue-84973.stderr index ae2bf5aac..55c89884a 100644 --- a/tests/ui/suggestions/issue-84973.stderr +++ b/tests/ui/suggestions/issue-84973.stderr @@ -13,7 +13,7 @@ LL | G: SomeTrait, | ^^^^^^^^^ required by this bound in `Other::<'a, G>::new` LL | { LL | pub fn new(g: G) -> Self { - | --- required by a bound in this + | --- required by a bound in this associated function help: consider borrowing here | LL | let o = Other::new(&f); diff --git a/tests/ui/suggestions/issue-85347.rs b/tests/ui/suggestions/issue-85347.rs index 02b5fb618..04d4c47d8 100644 --- a/tests/ui/suggestions/issue-85347.rs +++ b/tests/ui/suggestions/issue-85347.rs @@ -1,7 +1,7 @@ use std::ops::Deref; trait Foo { type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments were supplied //~| ERROR associated type bindings are not allowed here //~| HELP add missing } diff --git a/tests/ui/suggestions/issue-85347.stderr b/tests/ui/suggestions/issue-85347.stderr index 17c1b7dc4..f330b3c1f 100644 --- a/tests/ui/suggestions/issue-85347.stderr +++ b/tests/ui/suggestions/issue-85347.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-85347.rs:3:42 | LL | type Bar<'a>: Deref<Target = <Self>::Bar<Target = Self>>; diff --git a/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr b/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr index 8c9a41a20..da6f7641b 100644 --- a/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr +++ b/tests/ui/suggestions/issue-86100-tuple-paren-comma.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:9:22 | LL | let _x: (i32,) = (5); - | ------ ^^^ expected tuple, found integer + | ------ ^^^ expected `(i32,)`, found integer | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:13:9 | LL | foo((Some(3))); - | --- ^^^^^^^^^ expected tuple, found enum `Option` + | --- ^^^^^^^^^ expected `(_,)`, found `Option<{integer}>` | | | arguments to this function are incorrect | @@ -37,7 +37,7 @@ error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:17:22 | LL | let _s = S { _s: ("abc".to_string()) }; - | ^^^^^^^^^^^^^^^^^^^ expected tuple, found struct `String` + | ^^^^^^^^^^^^^^^^^^^ expected `(String,)`, found `String` | = note: expected tuple `(String,)` found struct `String` diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index 93d8da226..be09dd895 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:17:16 | LL | let _ = A::foo::<S>(); @@ -20,7 +20,7 @@ LL - let _ = A::foo::<S>(); LL + let _ = A::foo(); | -error[E0107]: this associated function takes 0 generic arguments but 2 generic arguments were supplied +error[E0107]: associated function takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/issue-89064.rs:22:16 | LL | let _ = B::bar::<S, S>(); @@ -42,7 +42,7 @@ LL - let _ = B::bar::<S, S>(); LL + let _ = B::bar(); | -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::<S>::foo::<S>(); @@ -56,7 +56,7 @@ note: associated function defined here, with 0 generic parameters LL | fn foo() {} | ^^^ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:31:16 | LL | let _ = 42.into::<Option<_>>(); diff --git a/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr b/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr index 611f7d5dd..7d1da7d24 100644 --- a/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr +++ b/tests/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-90213-expected-boxfuture-self-ice.rs:9:19 | LL | Self::foo(None) - | --------- ^^^^ expected struct `Box`, found enum `Option` + | --------- ^^^^ expected `Box<Option<S>>`, found `Option<_>` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs new file mode 100644 index 000000000..3bf6b7bb9 --- /dev/null +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.rs @@ -0,0 +1,28 @@ +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub struct Trader<'a> { + closure: Box<dyn Fn(&mut Trader) + 'a>, +} + +impl<'a> Trader<'a> { + pub fn new() -> Self { + Trader { + closure: Box::new(|_| {}), + } + } + pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { + //foo + } +} + +fn main() { + let closure = |trader : Trader| { + println!("Woooosh!"); + }; + + let mut trader = Trader::new(); + trader.set_closure(closure); + //~^ ERROR type mismatch in closure arguments +} diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr new file mode 100644 index 000000000..6820af1fd --- /dev/null +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr @@ -0,0 +1,26 @@ +error[E0631]: type mismatch in closure arguments + --> $DIR/late-bound-in-borrow-closure-sugg.rs:26:24 + | +LL | let closure = |trader : Trader| { + | ----------------- found signature defined here +... +LL | trader.set_closure(closure); + | ----------- ^^^^^^^ expected due to this + | | + | required by a bound introduced by this call + | + = note: expected closure signature `for<'a, 'b> fn(&'a mut Trader<'b>) -> _` + found closure signature `for<'a> fn(Trader<'a>) -> _` +note: required by a bound in `Trader::<'a>::set_closure` + --> $DIR/late-bound-in-borrow-closure-sugg.rs:15:50 + | +LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { + | ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure` +help: consider borrowing the argument + | +LL | let closure = |trader : &mut Trader| { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0631`. diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index c5c3f7b46..93cfa60b5 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -10,7 +10,9 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap --> $DIR/missing-lifetimes-in-signature.rs:19:5 | LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() - | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here + | ------ ------------- opaque type defined here + | | + | hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12]` captures the anonymous lifetime defined here ... LL | / move || { LL | | diff --git a/tests/ui/suggestions/match-ergonomics.stderr b/tests/ui/suggestions/match-ergonomics.stderr index aa2b407bf..a3e059e8a 100644 --- a/tests/ui/suggestions/match-ergonomics.stderr +++ b/tests/ui/suggestions/match-ergonomics.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match &x[..] { | ------ this expression has type `&[i32]` LL | [&v] => {}, - | ^^ expected `i32`, found reference + | ^^ expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` @@ -36,7 +36,7 @@ error[E0308]: mismatched types LL | match y { | - this expression has type `i32` LL | &v => {}, - | ^^ expected `i32`, found reference + | ^^ expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` @@ -52,7 +52,7 @@ error[E0308]: mismatched types LL | if let [&v] = &x[..] {} | ^^ ------ this expression has type `&[i32]` | | - | expected `i32`, found reference + | expected `i32`, found `&_` | = note: expected type `i32` found reference `&_` diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.rs b/tests/ui/suggestions/match-prev-arm-needing-semi.rs index 8c8abe047..11463c453 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.rs +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.rs @@ -13,18 +13,9 @@ fn extra_semicolon() { }; } -async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE checked the `Output` of this `async fn`, expected opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE checked the `Output` of this `async fn`, found opaque type -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function -//~| NOTE while checking the return type of the `async fn` -//~| NOTE in this expansion of desugaring of `async` block or function +async fn async_dummy() {} + +async fn async_dummy2() {} async fn async_extra_semicolon_same() { let _ = match true { //~ NOTE `match` arms have incompatible types @@ -33,8 +24,8 @@ async fn async_extra_semicolon_same() { //~^ HELP consider removing this semicolon } false => async_dummy(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -46,8 +37,8 @@ async fn async_extra_semicolon_different() { //~^ HELP consider removing this semicolon } false => async_dummy2(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected `()`, found opaque type - //~| NOTE expected unit type `()` + //~^ NOTE expected `()`, found future + //~| NOTE calling an async function returns a future //~| HELP consider `await`ing on the `Future` }; } @@ -57,8 +48,7 @@ async fn async_different_futures() { true => async_dummy(), //~ NOTE this is found to be //~| HELP consider `await`ing on both `Future`s false => async_dummy2(), //~ ERROR `match` arms have incompatible types - //~^ NOTE expected opaque type, found a different opaque type - //~| NOTE expected opaque type `impl Future<Output = ()>` + //~^ NOTE expected future, found a different future //~| NOTE distinct uses of `impl Trait` result in different opaque types }; } diff --git a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr index 8d735b71f..cf3cf45ef 100644 --- a/tests/ui/suggestions/match-prev-arm-needing-semi.stderr +++ b/tests/ui/suggestions/match-prev-arm-needing-semi.stderr @@ -1,5 +1,5 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:35:18 + --> $DIR/match-prev-arm-needing-semi.rs:26:18 | LL | let _ = match true { | _____________- @@ -9,19 +9,17 @@ LL | | async_dummy(); LL | | LL | | } LL | | false => async_dummy(), - | | ^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 +note: calling an async function returns a future + --> $DIR/match-prev-arm-needing-semi.rs:26:18 | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future<Output = ()>` +LL | false => async_dummy(), + | ^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | false => async_dummy().await, @@ -33,7 +31,7 @@ LL + async_dummy() | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:48:18 + --> $DIR/match-prev-arm-needing-semi.rs:39:18 | LL | let _ = match true { | _____________- @@ -43,19 +41,17 @@ LL | | async_dummy(); LL | | LL | | } LL | | false => async_dummy2(), - | | ^^^^^^^^^^^^^^ expected `()`, found opaque type + | | ^^^^^^^^^^^^^^ expected `()`, found future ... | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 +note: calling an async function returns a future + --> $DIR/match-prev-arm-needing-semi.rs:39:18 | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected unit type `()` - found opaque type `impl Future<Output = ()>` +LL | false => async_dummy2(), + | ^^^^^^^^^^^^^^ help: consider `await`ing on the `Future` | LL | false => async_dummy2().await, @@ -69,7 +65,7 @@ LL ~ false => Box::new(async_dummy2()), | error[E0308]: `match` arms have incompatible types - --> $DIR/match-prev-arm-needing-semi.rs:59:18 + --> $DIR/match-prev-arm-needing-semi.rs:50:18 | LL | let _ = match true { | _____________- @@ -77,24 +73,12 @@ LL | | true => async_dummy(), | | ------------- this is found to be of type `impl Future<Output = ()>` LL | | LL | | false => async_dummy2(), - | | ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type -... | + | | ^^^^^^^^^^^^^^ expected future, found a different future +LL | | LL | | LL | | }; | |_____- `match` arms have incompatible types | -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:16:24 - | -LL | async fn async_dummy() {} - | ^ checked the `Output` of this `async fn`, expected opaque type -note: while checking the return type of the `async fn` - --> $DIR/match-prev-arm-needing-semi.rs:22:25 - | -LL | async fn async_dummy2() {} - | ^ checked the `Output` of this `async fn`, found opaque type - = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>) - found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr index 00aa7d18a..51ea5b35a 100644 --- a/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr +++ b/tests/ui/suggestions/match-with-different-arm-types-as-stmt-instead-of-expr.stderr @@ -16,7 +16,7 @@ LL | / match c { LL | | "baz" => Box::new(Baz), | | ------------- this is found to be of type `Box<Baz>` LL | | _ => Box::new(Bar), - | | ^^^^^^^^^^^^^ expected struct `Baz`, found struct `Bar` + | | ^^^^^^^^^^^^^ expected `Box<Baz>`, found `Box<Bar>` LL | | }; | |_____- `match` arms have incompatible types | @@ -39,7 +39,7 @@ error[E0308]: mismatched types --> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:23:22 | LL | fn wrong(c: &str) -> Box<dyn Foo> { - | ----- ^^^^^^^^^^^^ expected struct `Box`, found `()` + | ----- ^^^^^^^^^^^^ expected `Box<dyn Foo>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | diff --git a/tests/ui/suggestions/method-access-to-range-literal-typo.stderr b/tests/ui/suggestions/method-access-to-range-literal-typo.stderr index f42140894..54a16b8ef 100644 --- a/tests/ui/suggestions/method-access-to-range-literal-typo.stderr +++ b/tests/ui/suggestions/method-access-to-range-literal-typo.stderr @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | fn method(&self) -> Option<&Vec<u8>> { | ---------------- expected `Option<&Vec<u8>>` because of return type LL | self.option..as_ref().map(|x| x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&Vec<u8>>`, found `Range<Option<Vec<u8>>>` | = note: expected enum `Option<&Vec<u8>>` found struct `std::ops::Range<Option<Vec<u8>>>` @@ -32,7 +32,7 @@ error[E0308]: mismatched types LL | fn method2(&self) -> Option<&u8> { | ----------- expected `Option<&u8>` because of return type LL | self.option..foo().get(0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&u8>`, found `Range<Option<Vec<u8>>>` | = note: expected enum `Option<&u8>` found struct `std::ops::Range<Option<Vec<u8>>>` diff --git a/tests/ui/suggestions/missing-lifetime-specifier.rs b/tests/ui/suggestions/missing-lifetime-specifier.rs index 24f5f782f..cb734e8ba 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.rs +++ b/tests/ui/suggestions/missing-lifetime-specifier.rs @@ -37,19 +37,19 @@ thread_local! { thread_local! { static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR union takes 2 lifetime arguments but 1 lifetime argument + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR union takes 2 lifetime arguments but 1 lifetime argument was supplied } thread_local! { static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); - //~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied - //~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied + //~| ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied //~| ERROR missing lifetime //~| ERROR missing lifetime } diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr index 997bbb5e9..21d237838 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.stderr +++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr @@ -133,7 +133,7 @@ LL | | } | = help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -151,7 +151,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -169,7 +169,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -187,7 +187,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -205,7 +205,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -223,7 +223,7 @@ help: add missing lifetime argument LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -241,7 +241,7 @@ help: add missing lifetime argument LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -259,7 +259,7 @@ help: add missing lifetime argument LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -277,7 +277,7 @@ help: add missing lifetime argument LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); @@ -295,7 +295,7 @@ help: add missing lifetime argument LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new()); | +++++++++ -error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); diff --git a/tests/ui/suggestions/missing-type-param-used-in-param.stderr b/tests/ui/suggestions/missing-type-param-used-in-param.stderr index 4f7058a64..3116c5a0a 100644 --- a/tests/ui/suggestions/missing-type-param-used-in-param.stderr +++ b/tests/ui/suggestions/missing-type-param-used-in-param.stderr @@ -1,4 +1,4 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied --> $DIR/missing-type-param-used-in-param.rs:6:5 | LL | two_type_params::<String>(100); diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs index 2f540060a..4066cd3b1 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs @@ -12,7 +12,7 @@ impl Foo<i32> for i32 { fn main() { 1.bar::<i32>(0); - //~^ ERROR this associated function takes 0 generic arguments but 1 generic argument was supplied + //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument //~| HELP remove these generics } diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr index 9557220f6..bfdb35947 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -1,10 +1,10 @@ -error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/move-generic-to-trait-in-method-with-params.rs:14:7 | LL | 1.bar::<i32>(0); | ^^^ expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters +note: method defined here, with 0 generic parameters --> $DIR/move-generic-to-trait-in-method-with-params.rs:4:8 | LL | fn bar(&self, _: T); diff --git a/tests/ui/suggestions/mut-ref-reassignment.stderr b/tests/ui/suggestions/mut-ref-reassignment.stderr index b3cb6dd06..b86a04c7c 100644 --- a/tests/ui/suggestions/mut-ref-reassignment.stderr +++ b/tests/ui/suggestions/mut-ref-reassignment.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn suggestion(opt: &mut Option<String>) { | ------------------- expected due to this parameter type LL | opt = None; - | ^^^^ expected mutable reference, found enum `Option` + | ^^^^ expected `&mut Option<String>`, found `Option<_>` | = note: expected mutable reference `&mut Option<String>` found enum `Option<_>` @@ -19,7 +19,7 @@ error[E0308]: mismatched types LL | fn no_suggestion(opt: &mut Result<String, ()>) { | ----------------------- expected due to this parameter type LL | opt = None - | ^^^^ expected mutable reference, found enum `Option` + | ^^^^ expected `&mut Result<String, ()>`, found `Option<_>` | = note: expected mutable reference `&mut Result<String, ()>` found enum `Option<_>` @@ -30,7 +30,7 @@ error[E0308]: mismatched types LL | fn suggestion2(opt: &mut Option<String>) { | ------------------- expected due to this parameter type LL | opt = Some(String::new()) - | ^^^^^^^^^^^^^^^^^^^ expected mutable reference, found enum `Option` + | ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>` | = note: expected mutable reference `&mut Option<String>` found enum `Option<String>` @@ -45,7 +45,7 @@ error[E0308]: mismatched types LL | fn no_suggestion2(opt: &mut Option<String>) { | ------------------- expected due to this parameter type LL | opt = Some(42) - | ^^^^^^^^ expected mutable reference, found enum `Option` + | ^^^^^^^^ expected `&mut Option<String>`, found `Option<{integer}>` | = note: expected mutable reference `&mut Option<String>` found enum `Option<{integer}>` diff --git a/tests/ui/suggestions/opaque-type-error.stderr b/tests/ui/suggestions/opaque-type-error.stderr index 133ffb058..5c90d3012 100644 --- a/tests/ui/suggestions/opaque-type-error.stderr +++ b/tests/ui/suggestions/opaque-type-error.stderr @@ -2,22 +2,20 @@ error[E0308]: `if` and `else` have incompatible types --> $DIR/opaque-type-error.rs:20:9 | LL | fn thing_one() -> impl Future<Output = Result<(), ()>> { - | ------------------------------------ the expected opaque type + | ------------------------------------ the expected future ... LL | fn thing_two() -> impl Future<Output = Result<(), ()>> { - | ------------------------------------ the found opaque type + | ------------------------------------ the found future ... LL | / if true { LL | | thing_one() | | ----------- expected because of this LL | | } else { LL | | thing_two() - | | ^^^^^^^^^^^ expected opaque type, found a different opaque type + | | ^^^^^^^^^^^ expected future, found a different future LL | | }.await | |_____- `if` and `else` have incompatible types | - = note: expected opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:8:19>) - found opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:12:19>) = note: distinct uses of `impl Trait` result in different opaque types help: consider `await`ing on both `Future`s | diff --git a/tests/ui/suggestions/option-content-move2.stderr b/tests/ui/suggestions/option-content-move2.stderr index 1d3dff3be..94acda73c 100644 --- a/tests/ui/suggestions/option-content-move2.stderr +++ b/tests/ui/suggestions/option-content-move2.stderr @@ -7,7 +7,7 @@ LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` here LL | move || { - | ^^^^^^^ move out of `var` occurs here + | ^^^^^^^ `var` is moved here LL | LL | var = Some(NotCopyable); | --- diff --git a/tests/ui/suggestions/option-to-bool.stderr b/tests/ui/suggestions/option-to-bool.stderr index 4050c7be8..e042f07da 100644 --- a/tests/ui/suggestions/option-to-bool.stderr +++ b/tests/ui/suggestions/option-to-bool.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/option-to-bool.rs:4:16 | LL | if true && x {} - | ---- ^ expected `bool`, found enum `Option` + | ---- ^ expected `bool`, found `Option<i32>` | | | expected because this is `bool` | diff --git a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr index 9588eedc9..fee83eb5c 100644 --- a/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/tests/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -22,7 +22,7 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:10:20 | LL | let _: usize = S {}; - | ----- ^^^^ expected `usize`, found struct `S` + | ----- ^^^^ expected `usize`, found `S` | | | expected due to this @@ -30,7 +30,7 @@ error[E0308]: mismatched types --> $DIR/recover-from-semicolon-trailing-item.rs:12:20 | LL | let _: usize = X {}; - | ----- ^^^^ expected `usize`, found struct `X` + | ----- ^^^^ expected `usize`, found `X` | | | expected due to this diff --git a/tests/ui/suggestions/recover-invalid-float-invalid.rs b/tests/ui/suggestions/recover-invalid-float-invalid.rs new file mode 100644 index 000000000..79430d8c0 --- /dev/null +++ b/tests/ui/suggestions/recover-invalid-float-invalid.rs @@ -0,0 +1,24 @@ +// Check that suggestions to add a zero to integers with a preceding dot only appear when the change +// will result in a valid floating point literal. + +fn main() {} + +fn a() { + _ = .3u32; + //~^ ERROR expected expression, found `.` +} + +fn b() { + _ = .0b0; + //~^ ERROR expected expression, found `.` +} + +fn c() { + _ = .0o07; + //~^ ERROR expected expression, found `.` +} + +fn d() { + _ = .0x0ABC; + //~^ ERROR expected expression, found `.` +} diff --git a/tests/ui/suggestions/recover-invalid-float-invalid.stderr b/tests/ui/suggestions/recover-invalid-float-invalid.stderr new file mode 100644 index 000000000..5764afc1a --- /dev/null +++ b/tests/ui/suggestions/recover-invalid-float-invalid.stderr @@ -0,0 +1,26 @@ +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:7:9 + | +LL | _ = .3u32; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:12:9 + | +LL | _ = .0b0; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:17:9 + | +LL | _ = .0o07; + | ^ expected expression + +error: expected expression, found `.` + --> $DIR/recover-invalid-float-invalid.rs:22:9 + | +LL | _ = .0x0ABC; + | ^ expected expression + +error: aborting due to 4 previous errors + diff --git a/tests/ui/suggestions/ref-pattern-binding.stderr b/tests/ui/suggestions/ref-pattern-binding.stderr index 10447ba70..7b1942593 100644 --- a/tests/ui/suggestions/ref-pattern-binding.stderr +++ b/tests/ui/suggestions/ref-pattern-binding.stderr @@ -19,8 +19,8 @@ error: cannot move out of value because it is borrowed LL | let ref _moved @ _from = String::from("foo"); | ----------^^^----- | | | - | | value moved into `_from` here - | value borrowed, by `_moved`, here + | | value is moved into `_from` here + | value is borrowed by `_moved` here error: cannot move out of value because it is borrowed --> $DIR/ref-pattern-binding.rs:15:9 @@ -28,8 +28,8 @@ error: cannot move out of value because it is borrowed LL | let ref _moved @ S { f } = S { f: String::from("foo") }; | ----------^^^^^^^-^^ | | | - | | value moved into `f` here - | value borrowed, by `_moved`, here + | | value is moved into `f` here + | value is borrowed by `_moved` here error: borrow of moved value --> $DIR/ref-pattern-binding.rs:18:9 diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.rs b/tests/ui/suggestions/restrict-existing-type-bounds.rs new file mode 100644 index 000000000..07712ce0d --- /dev/null +++ b/tests/ui/suggestions/restrict-existing-type-bounds.rs @@ -0,0 +1,30 @@ +pub trait TryAdd<Rhs = Self> { + type Error; + type Output; + + fn try_add(self, rhs: Rhs) -> Result<Self::Output, Self::Error>; +} + +impl<T: TryAdd> TryAdd for Option<T> { + type Error = <T as TryAdd>::Error; + type Output = Option<<T as TryAdd>::Output>; + + fn try_add(self, rhs: Self) -> Result<Self::Output, Self::Error> { + Ok(self) //~ ERROR mismatched types + } +} + +struct Other<A>(A); + +struct X; + +impl<T: TryAdd<Error = X>> TryAdd for Other<T> { + type Error = <T as TryAdd>::Error; + type Output = Other<<T as TryAdd>::Output>; + + fn try_add(self, rhs: Self) -> Result<Self::Output, Self::Error> { + Ok(self) //~ ERROR mismatched types + } +} + +fn main() {} diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr new file mode 100644 index 000000000..14a244b79 --- /dev/null +++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr @@ -0,0 +1,57 @@ +error[E0308]: mismatched types + --> $DIR/restrict-existing-type-bounds.rs:13:12 + | +LL | impl<T: TryAdd> TryAdd for Option<T> { + | - this type parameter +... +LL | Ok(self) + | -- ^^^^ expected `Option<<T as TryAdd>::Output>`, found `Option<T>` + | | + | arguments to this enum variant are incorrect + | + = note: expected enum `Option<<T as TryAdd>::Output>` + found enum `Option<T>` +help: the type constructed contains `Option<T>` due to the type of the argument passed + --> $DIR/restrict-existing-type-bounds.rs:13:9 + | +LL | Ok(self) + | ^^^----^ + | | + | this argument influences the type of `Ok` +note: tuple variant defined here + --> $SRC_DIR/core/src/result.rs:LL:COL +help: consider further restricting this bound + | +LL | impl<T: TryAdd<Output = T>> TryAdd for Option<T> { + | ++++++++++++ + +error[E0308]: mismatched types + --> $DIR/restrict-existing-type-bounds.rs:26:12 + | +LL | impl<T: TryAdd<Error = X>> TryAdd for Other<T> { + | - this type parameter +... +LL | Ok(self) + | -- ^^^^ expected `Other<<T as TryAdd>::Output>`, found `Other<T>` + | | + | arguments to this enum variant are incorrect + | + = note: expected struct `Other<<T as TryAdd>::Output>` + found struct `Other<T>` +help: the type constructed contains `Other<T>` due to the type of the argument passed + --> $DIR/restrict-existing-type-bounds.rs:26:9 + | +LL | Ok(self) + | ^^^----^ + | | + | this argument influences the type of `Ok` +note: tuple variant defined here + --> $SRC_DIR/core/src/result.rs:LL:COL +help: consider further restricting this bound + | +LL | impl<T: TryAdd<Error = X, Output = T>> TryAdd for Other<T> { + | ++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/return-bindings.stderr b/tests/ui/suggestions/return-bindings.stderr index c14fb3367..6f906c27b 100644 --- a/tests/ui/suggestions/return-bindings.stderr +++ b/tests/ui/suggestions/return-bindings.stderr @@ -18,7 +18,7 @@ LL | let s: String = if let Some(s) = opt_str { | ______________________________________________^ LL | | LL | | } else { - | |_____^ expected struct `String`, found `()` + | |_____^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -31,7 +31,7 @@ error[E0308]: mismatched types --> $DIR/return-bindings.rs:14:11 | LL | fn c() -> Option<i32> { - | - ^^^^^^^^^^^ expected enum `Option`, found `()` + | - ^^^^^^^^^^^ expected `Option<i32>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | @@ -50,7 +50,7 @@ LL | let s: String = if let Some(s) = opt_str { | ______________________________________________^ LL | | LL | | } else { - | |_____^ expected struct `String`, found `()` + | |_____^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -67,7 +67,7 @@ LL | let s = if let Some(s) = opt_str { LL | | } else { | |_____- expected because of this LL | String::new() - | ^^^^^^^^^^^^^ expected `()`, found struct `String` + | ^^^^^^^^^^^^^ expected `()`, found `String` | help: consider returning the local binding `s` | @@ -80,7 +80,7 @@ error[E0308]: mismatched types --> $DIR/return-bindings.rs:37:20 | LL | Some(s) => {} - | ^^ expected struct `String`, found `()` + | ^^ expected `String`, found `()` | help: consider returning the local binding `s` | @@ -95,7 +95,7 @@ LL | let s = match opt_str { LL | | Some(s) => {} | | -- this is found to be of type `()` LL | | None => String::new(), - | | ^^^^^^^^^^^^^ expected `()`, found struct `String` + | | ^^^^^^^^^^^^^ expected `()`, found `String` LL | | LL | | }; | |_____- `match` arms have incompatible types diff --git a/tests/ui/suggestions/shadowed-lplace-method-2.stderr b/tests/ui/suggestions/shadowed-lplace-method-2.stderr index 94eef15f3..295636098 100644 --- a/tests/ui/suggestions/shadowed-lplace-method-2.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method-2.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/shadowed-lplace-method-2.rs:22:17 | LL | *x.foo(0) = (); - | --------- ^^ expected struct `X`, found `()` + | --------- ^^ expected `X`, found `()` | | | expected due to the type of this binding | diff --git a/tests/ui/suggestions/shadowed-lplace-method.stderr b/tests/ui/suggestions/shadowed-lplace-method.stderr index 91d0d1200..33824c4cb 100644 --- a/tests/ui/suggestions/shadowed-lplace-method.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/shadowed-lplace-method.rs:9:24 | LL | *rc.borrow_mut() = false; - | ---------------- ^^^^^ expected struct `Rc`, found `bool` + | ---------------- ^^^^^ expected `Rc<RefCell<bool>>`, found `bool` | | | expected due to the type of this binding | diff --git a/tests/ui/suggestions/sugg-else-for-closure.stderr b/tests/ui/suggestions/sugg-else-for-closure.stderr index 7f05832bc..09553b93c 100644 --- a/tests/ui/suggestions/sugg-else-for-closure.stderr +++ b/tests/ui/suggestions/sugg-else-for-closure.stderr @@ -15,7 +15,7 @@ LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap()); | ^^^^^^^^^^^^-------------------------------^ | | | this argument influences the return type of `unwrap_or` -note: associated function defined here +note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: try calling `unwrap_or_else` instead | diff --git a/tests/ui/suggestions/suggest-box.stderr b/tests/ui/suggestions/suggest-box.stderr index 2bdaa4e97..9a4e9fef4 100644 --- a/tests/ui/suggestions/suggest-box.stderr +++ b/tests/ui/suggestions/suggest-box.stderr @@ -8,7 +8,7 @@ LL | let _x: Box<dyn Fn() -> Result<(), ()>> = || { LL | | Err(())?; LL | | Ok(()) LL | | }; - | |_____^ expected struct `Box`, found closure + | |_____^ expected `Box<dyn Fn() -> Result<(), ()>>`, found closure | = note: expected struct `Box<dyn Fn() -> Result<(), ()>>` found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]` diff --git a/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs b/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs new file mode 100644 index 000000000..657dd9c22 --- /dev/null +++ b/tests/ui/suggestions/suggest-call-on-pat-mismatch.rs @@ -0,0 +1,16 @@ +enum E { + One(i32, i32), +} + +fn main() { + let var = E::One; + if let E::One(var1, var2) = var { + //~^ ERROR mismatched types + //~| HELP use parentheses to construct this tuple variant + println!("{var1} {var2}"); + } + + let Some(x) = Some; + //~^ ERROR mismatched types + //~| HELP use parentheses to construct this tuple variant +} diff --git a/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr b/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr new file mode 100644 index 000000000..7338312ba --- /dev/null +++ b/tests/ui/suggestions/suggest-call-on-pat-mismatch.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/suggest-call-on-pat-mismatch.rs:7:12 + | +LL | if let E::One(var1, var2) = var { + | ^^^^^^^^^^^^^^^^^^ --- this expression has type `fn(i32, i32) -> E {E::One}` + | | + | expected enum constructor, found `E` + | + = note: expected enum constructor `fn(i32, i32) -> E {E::One}` + found enum `E` +help: use parentheses to construct this tuple variant + | +LL | if let E::One(var1, var2) = var(/* i32 */, /* i32 */) { + | ++++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/suggest-call-on-pat-mismatch.rs:13:9 + | +LL | let Some(x) = Some; + | ^^^^^^^ ---- this expression has type `fn(_) -> Option<_> {Option::<_>::Some}` + | | + | expected enum constructor, found `Option<_>` + | + = note: expected enum constructor `fn(_) -> Option<_> {Option::<_>::Some}` + found enum `Option<_>` +help: use parentheses to construct this tuple variant + | +LL | let Some(x) = Some(/* value */); + | +++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed new file mode 100644 index 000000000..abb9ef917 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.fixed @@ -0,0 +1,12 @@ +// run-rustfix + +#![allow(unused)] + +struct Wrapper<T>(T); + +fn bar() -> Wrapper<fn()> { Wrapper(foo) } +//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn foo() {} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs new file mode 100644 index 000000000..d2a79c386 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.rs @@ -0,0 +1,12 @@ +// run-rustfix + +#![allow(unused)] + +struct Wrapper<T>(T); + +fn bar() -> _ { Wrapper(foo) } +//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + +fn foo() {} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr new file mode 100644 index 000000000..347a03852 --- /dev/null +++ b/tests/ui/suggestions/suggest-fn-ptr-for-fn-item-in-fn-ret.stderr @@ -0,0 +1,12 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/suggest-fn-ptr-for-fn-item-in-fn-ret.rs:7:13 + | +LL | fn bar() -> _ { Wrapper(foo) } + | ^ + | | + | not allowed in type signatures + | help: replace with the correct return type: `Wrapper<fn()>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr b/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr index 9b6dba7e9..3fb3047d8 100644 --- a/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr +++ b/tests/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28 | LL | let _: option::O<()> = (); - | ------------- ^^ expected enum `O`, found `()` + | ------------- ^^ expected `O<()>`, found `()` | | | expected due to this | diff --git a/tests/ui/suggestions/suggest-remove-deref.fixed b/tests/ui/suggestions/suggest-remove-deref.fixed new file mode 100644 index 000000000..4dc12da03 --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.fixed @@ -0,0 +1,28 @@ +// run-rustfix + +//issue #106496 + +struct S; + +trait X {} +impl X for S {} + +fn foo<T: X>(_: &T) {} +fn test_foo() { + let hello = &S; + foo(hello); + //~^ ERROR mismatched types +} + +fn bar(_: &String) {} +fn test_bar() { + let v = String::from("hello"); + let s = &v; + bar(s); + //~^ ERROR mismatched types +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/tests/ui/suggestions/suggest-remove-deref.rs b/tests/ui/suggestions/suggest-remove-deref.rs new file mode 100644 index 000000000..c2d385cbd --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.rs @@ -0,0 +1,28 @@ +// run-rustfix + +//issue #106496 + +struct S; + +trait X {} +impl X for S {} + +fn foo<T: X>(_: &T) {} +fn test_foo() { + let hello = &S; + foo(*hello); + //~^ ERROR mismatched types +} + +fn bar(_: &String) {} +fn test_bar() { + let v = String::from("hello"); + let s = &v; + bar(*s); + //~^ ERROR mismatched types +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/tests/ui/suggestions/suggest-remove-deref.stderr b/tests/ui/suggestions/suggest-remove-deref.stderr new file mode 100644 index 000000000..4253838eb --- /dev/null +++ b/tests/ui/suggestions/suggest-remove-deref.stderr @@ -0,0 +1,43 @@ +error[E0308]: mismatched types + --> $DIR/suggest-remove-deref.rs:13:9 + | +LL | foo(*hello); + | --- ^^^^^^ expected `&_`, found `S` + | | + | arguments to this function are incorrect + | + = note: expected reference `&_` + found struct `S` +note: function defined here + --> $DIR/suggest-remove-deref.rs:10:4 + | +LL | fn foo<T: X>(_: &T) {} + | ^^^ ----- +help: consider removing deref here + | +LL - foo(*hello); +LL + foo(hello); + | + +error[E0308]: mismatched types + --> $DIR/suggest-remove-deref.rs:21:9 + | +LL | bar(*s); + | --- ^^ expected `&String`, found `String` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/suggest-remove-deref.rs:17:4 + | +LL | fn bar(_: &String) {} + | ^^^ ---------- +help: consider removing deref here + | +LL - bar(*s); +LL + bar(s); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs new file mode 100644 index 000000000..fbaf41245 --- /dev/null +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.rs @@ -0,0 +1,8 @@ +pub struct Bar<S>(S); + +pub trait Foo {} + +impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {} +//~^ ERROR ambiguous associated type + +fn main() {} diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr new file mode 100644 index 000000000..0ca5b9b92 --- /dev/null +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr @@ -0,0 +1,9 @@ +error[E0223]: ambiguous associated type + --> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38 + | +LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {} + | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/suggestions/suggest-using-chars.stderr b/tests/ui/suggestions/suggest-using-chars.stderr index 99bcfb08a..ba80ec6a2 100644 --- a/tests/ui/suggestions/suggest-using-chars.stderr +++ b/tests/ui/suggestions/suggest-using-chars.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `iter` found for reference `&'static str` in the c --> $DIR/suggest-using-chars.rs:2:19 | LL | let _ = "foo".iter(); - | ^^^^ method not found in `&'static str` + | ^^^^ method not found in `&str` | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | @@ -13,7 +13,7 @@ error[E0599]: no method named `foo` found for reference `&'static str` in the cu --> $DIR/suggest-using-chars.rs:3:19 | LL | let _ = "foo".foo(); - | ^^^ method not found in `&'static str` + | ^^^ method not found in `&str` error[E0599]: no method named `iter` found for struct `String` in the current scope --> $DIR/suggest-using-chars.rs:4:33 diff --git a/tests/ui/suggestions/trait-hidden-method.rs b/tests/ui/suggestions/trait-hidden-method.rs new file mode 100644 index 000000000..ae7ef47e1 --- /dev/null +++ b/tests/ui/suggestions/trait-hidden-method.rs @@ -0,0 +1,11 @@ +// #107983 - testing that `__iterator_get_unchecked` isn't suggested +// HELP included so that compiletest errors on the bad suggestion +pub fn i_can_has_iterator() -> impl Iterator<Item = u32> { + //~^ ERROR expected `Box<dyn Iterator>` + //~| HELP consider constraining the associated type + Box::new(1..=10) as Box<dyn Iterator> + //~^ ERROR the value of the associated type `Item` + //~| HELP specify the associated type +} + +fn main() {} diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr new file mode 100644 index 000000000..a5a65d193 --- /dev/null +++ b/tests/ui/suggestions/trait-hidden-method.stderr @@ -0,0 +1,24 @@ +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/trait-hidden-method.rs:6:33 + | +LL | Box::new(1..=10) as Box<dyn Iterator> + | ^^^^^^^^ help: specify the associated type: `Iterator<Item = Type>` + +error[E0271]: expected `Box<dyn Iterator>` to be an iterator that yields `u32`, but it yields `<dyn Iterator as Iterator>::Item` + --> $DIR/trait-hidden-method.rs:3:32 + | +LL | pub fn i_can_has_iterator() -> impl Iterator<Item = u32> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `u32` +... +LL | Box::new(1..=10) as Box<dyn Iterator> + | ------------------------------------- return type was inferred to be `Box<dyn Iterator>` here + | + = note: expected associated type `<dyn Iterator as Iterator>::Item` + found type `u32` + = help: consider constraining the associated type `<dyn Iterator as Iterator>::Item` to `u32` or calling a method that returns `<dyn Iterator as Iterator>::Item` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0191, E0271. +For more information about an error, try `rustc --explain E0191`. diff --git a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr index f520d88c6..7deb9a434 100644 --- a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr +++ b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr @@ -90,7 +90,7 @@ LL | fn func(&self) -> Self::A; LL | fn funk(&self, _: Self::A); LL | fn funq(&self) -> Self::A {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq` -note: associated function defined here +note: method defined here --> $DIR/trait-with-missing-associated-type-restriction.rs:9:8 | LL | fn funk(&self, _: Self::A); diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index fcff02e09..4e3180e84 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -18,7 +18,7 @@ LL | let _: Vec<A:B> = A::B; = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable -error[E0107]: this struct takes at least 1 generic argument but 0 generic arguments were supplied +error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 | LL | let _: Vec<A:B> = A::B; diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.rs b/tests/ui/suggestions/type-mismatch-byte-literal.rs index 34199f8c3..80cd2ca7d 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.rs +++ b/tests/ui/suggestions/type-mismatch-byte-literal.rs @@ -12,7 +12,19 @@ fn main() { //~^ ERROR: mismatched types [E0308] //~| HELP: if you meant to write a byte literal, prefix with `b` + let _a: u8 = '\x20'; + //~^ ERROR: mismatched types [E0308] + //~| HELP: if you meant to write a byte literal, prefix with `b` + + // Do not issue the suggestion if the char literal is a Unicode escape + foo('\u{0080}'); + //~^ ERROR: mismatched types [E0308] + // Do not issue the suggestion if the char literal isn't ASCII let _t: u8 = '€'; //~^ ERROR: mismatched types [E0308] + + // Do not issue the suggestion if the char literal isn't ASCII + foo('\u{1f980}'); + //~^ ERROR: mismatched types [E0308] } diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index c9c2e7498..3d27149f0 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -30,13 +30,54 @@ LL | foo(b'#'); | ~~~~ error[E0308]: mismatched types - --> $DIR/type-mismatch-byte-literal.rs:16:18 + --> $DIR/type-mismatch-byte-literal.rs:15:18 + | +LL | let _a: u8 = '\x20'; + | -- ^^^^^^ expected `u8`, found `char` + | | + | expected due to this + | +help: if you meant to write a byte literal, prefix with `b` + | +LL | let _a: u8 = b'\x20'; + | ~~~~~~~ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:20:9 + | +LL | foo('\u{0080}'); + | --- ^^^^^^^^^^ expected `u8`, found `char` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/type-mismatch-byte-literal.rs:4:4 + | +LL | fn foo(_t: u8) {} + | ^^^ ------ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:24:18 | LL | let _t: u8 = '€'; | -- ^^^ expected `u8`, found `char` | | | expected due to this -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/type-mismatch-byte-literal.rs:28:9 + | +LL | foo('\u{1f980}'); + | --- ^^^^^^^^^^^ expected `u8`, found `char` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/type-mismatch-byte-literal.rs:4:4 + | +LL | fn foo(_t: u8) {} + | ^^^ ------ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index 34eaa8322..8b48ee9f1 100644 --- a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18 | LL | let _: f64 = 0..10; - | --- ^^^^^ expected `f64`, found struct `Range` + | --- ^^^^^ expected `f64`, found `Range<{integer}>` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18 | LL | let _: f64 = 1..; - | --- ^^^ expected `f64`, found struct `RangeFrom` + | --- ^^^ expected `f64`, found `RangeFrom<{integer}>` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18 | LL | let _: f64 = ..10; - | --- ^^^^ expected `f64`, found struct `RangeTo` + | --- ^^^^ expected `f64`, found `RangeTo<{integer}>` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 | LL | let _: f64 = std::ops::Range { start: 0, end: 1 }; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `Range` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found `Range<{integer}>` | | | expected due to this | diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs index 8b6e8cfd7..ed262fd39 100644 --- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs +++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -6,7 +6,7 @@ pub trait T<X, Y> { pub struct Foo { i: Box<dyn T<usize, usize, usize, usize, B=usize>>, //~^ ERROR must be specified - //~| ERROR this trait takes 2 generic arguments but 4 generic arguments were supplied + //~| ERROR trait takes 2 generic arguments but 4 generic arguments were supplied } diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index 75b919232..175a5fbba 100644 --- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -1,4 +1,4 @@ -error[E0107]: this trait takes 2 generic arguments but 4 generic arguments were supplied +error[E0107]: trait takes 2 generic arguments but 4 generic arguments were supplied --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 | LL | i: Box<dyn T<usize, usize, usize, usize, B=usize>>, |