diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index b5256433306..00b4d0857ac 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2020,7 +2020,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { subst, impl_candidates, ErrorCode::E0283, - false, + true, ); let obligation = Obligation::new( @@ -2132,7 +2132,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { a.into(), vec![], ErrorCode::E0282, - false, + true, ) } ty::PredicateKind::Projection(data) => { @@ -2149,7 +2149,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { self_ty.into(), vec![], ErrorCode::E0284, - false, + true, ); err.note(&format!("cannot satisfy `{}`", predicate)); err diff --git a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr index 463605e2431..688db695fa8 100644 --- a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Mask<_, LANES>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ + | ^ ------------------- type must be known at this point | = note: cannot satisfy `_: MaskElement` note: required by a bound in `Mask::::splat` diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr index 220602c124c..c1e43f0b721 100644 --- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr +++ b/src/test/ui/inference/cannot-infer-partial-try-return.stderr @@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>` | LL | let x = || -> Result<_, QualifiedError<_>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | infallible()?; + | ------------- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/inference/erase-type-params-in-label.stderr b/src/test/ui/inference/erase-type-params-in-label.stderr index fd58844c238..7bb281802d2 100644 --- a/src/test/ui/inference/erase-type-params-in-label.stderr +++ b/src/test/ui/inference/erase-type-params-in-label.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Foo` --> $DIR/erase-type-params-in-label.rs:2:9 | LL | let foo = foo(1, ""); - | ^^^ + | ^^^ --- type must be known at this point | = note: cannot satisfy `_: Default` note: required by a bound in `foo` @@ -23,7 +23,7 @@ error[E0283]: type annotations needed for `Bar` --> $DIR/erase-type-params-in-label.rs:5:9 | LL | let bar = bar(1, ""); - | ^^^ + | ^^^ --- type must be known at this point | = note: cannot satisfy `_: Default` note: required by a bound in `bar` diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr index 3c53d8126e7..a71ce9a8ef2 100644 --- a/src/test/ui/inference/issue-72616.stderr +++ b/src/test/ui/inference/issue-72616.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72616.rs:20:37 | LL | if String::from("a") == "a".try_into().unwrap() {} - | ^^^^^^^^ + | -- ^^^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `String: PartialEq<_>` found in the `alloc` crate: - impl PartialEq for String; diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index 9edf14ef291..d4eeda07366 100644 --- a/src/test/ui/inference/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr @@ -55,7 +55,7 @@ error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:17:9 | LL | let _ = "x".as_ref(); - | ^ + | ^ ------ type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef for str; diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr index 6641b29b30b..e395e65fad0 100644 --- a/src/test/ui/inference/issue-86162-1.stderr +++ b/src/test/ui/inference/issue-86162-1.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-1.rs:7:9 | LL | foo(gen()); //<- Do not suggest `foo::()`! - | ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | | + | type must be known at this point | = note: cannot satisfy `_: Clone` note: required by a bound in `foo` diff --git a/src/test/ui/inference/issue-86162-2.stderr b/src/test/ui/inference/issue-86162-2.stderr index d2a026a9269..30e6e10eaa2 100644 --- a/src/test/ui/inference/issue-86162-2.stderr +++ b/src/test/ui/inference/issue-86162-2.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-86162-2.rs:12:14 | LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::()`! - | ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | -------- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` + | | + | type must be known at this point | = note: cannot satisfy `_: Clone` note: required by a bound in `Foo::bar` diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index 6c4eafbc8b3..9be6c2f8564 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -14,7 +14,9 @@ error[E0283]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | + | type must be known at this point | note: multiple `impl`s satisfying `u64: Test<_>` found --> $DIR/issue-69455.rs:11:1 diff --git a/src/test/ui/issues/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr index 3aee61bd5a5..2a747f679a8 100644 --- a/src/test/ui/issues/issue-7813.stderr +++ b/src/test/ui/issues/issue-7813.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `&[_; 0]` --> $DIR/issue-7813.rs:2:9 | LL | let v = &[]; - | ^ + | ^ --- type must be known at this point | help: consider giving `v` an explicit type, where the placeholders `_` are specified | diff --git a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr index 3116211b52c..f4c2eb7ff34 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-1.rs:4:18 | LL | unbound_drop(|| -> _ { [] }); - | ^^^^^^^ + | ^^^^^^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr index f368e7de467..88bf263043d 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-2.rs:4:18 | LL | unbound_drop(|| { [] }) - | ^^ + | ^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr index 41769321533..bc4107528d2 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/suggest-closure-return-type-3.rs:4:18 | LL | unbound_drop(|| []); - | ^^ + | ^^ -- type must be known at this point | help: try giving this closure an explicit return type | diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 5aa42b5b1d3..a2d23c4e9df 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -26,7 +26,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------ type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`: - impl AsRef for String; @@ -42,7 +44,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:13:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | ^^^^ + | --------- ^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: - impl From for u32; @@ -59,7 +63,7 @@ error[E0283]: type annotations needed for `Box` --> $DIR/issue-77982.rs:36:9 | LL | let _ = ().foo(); - | ^ + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `(): Foo<'_, _>` found --> $DIR/issue-77982.rs:29:1 @@ -77,7 +81,7 @@ error[E0283]: type annotations needed for `Box` --> $DIR/issue-77982.rs:40:9 | LL | let _ = (&()).bar(); - | ^ + | ^ --- type must be known at this point | note: multiple `impl`s satisfying `&(): Bar<'_, _>` found --> $DIR/issue-77982.rs:32:1 diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr index d68d5e5d40b..e823bad2668 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `[_; 0]` --> $DIR/cannot_infer_local_or_array.rs:2:9 | LL | let x = []; - | ^ + | ^ -- type must be known at this point | help: consider giving `x` an explicit type, where the placeholders `_` are specified |