diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index b19fb6da6de..e426b937542 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -231,7 +231,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let inferred_sig = self.normalize( span, self.deduce_sig_from_projection( - Some(span), + Some(span), bound_predicate.rebind(proj_predicate), ), ); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs index f6a5b8f97a1..2acb43c51da 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs @@ -20,10 +20,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { else { return false; }; - let hir = self.tcx.hir(); - let hir::Node::Expr(expr) = hir.get(hir_id) else { - return false; - }; let Some(unsubstituted_pred) = self .tcx @@ -47,6 +43,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => return false, }; + let direct_param = if let ty::ClauseKind::Trait(pred) = unsubstituted_pred.kind().skip_binder() + && let ty = pred.trait_ref.self_ty() + && let ty::Param(_param) = ty.kind() + && let Some(arg) = predicate_args.get(0) + && let ty::GenericArgKind::Type(arg_ty) = arg.unpack() + && arg_ty == ty + { + Some(*arg) + } else { + None + }; let find_param_matching = |matches: &dyn Fn(ty::ParamTerm) -> bool| { predicate_args.iter().find_map(|arg| { arg.walk().find_map(|arg| { @@ -96,54 +103,83 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.find_ambiguous_parameter_in(def_id, error.root_obligation.predicate); } - if self.closure_span_overlaps_error(error, expr.span) { - return false; - } + let hir = self.tcx.hir(); + let (expr, qpath) = match hir.get(hir_id) { + hir::Node::Expr(expr) => { + if self.closure_span_overlaps_error(error, expr.span) { + return false; + } + let qpath = + if let hir::ExprKind::Path(qpath) = expr.kind { Some(qpath) } else { None }; - match &expr.kind { - hir::ExprKind::Path(qpath) => { - if let hir::Node::Expr(hir::Expr { - kind: hir::ExprKind::Call(callee, args), - hir_id: call_hir_id, - span: call_span, - .. - }) = hir.get_parent(expr.hir_id) - && callee.hir_id == expr.hir_id - { - if self.closure_span_overlaps_error(error, *call_span) { - return false; - } + (Some(*expr), qpath) + } + hir::Node::Ty(hir::Ty { kind: hir::TyKind::Path(qpath), .. }) => (None, Some(*qpath)), + _ => return false, + }; - for param in - [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] - .into_iter() - .flatten() - { - if self.blame_specific_arg_if_possible( - error, - def_id, - param, - *call_hir_id, - callee.span, - None, - args, - ) - { - return true; - } - } + if let Some(qpath) = qpath { + if let Some(param) = direct_param { + if self.point_at_path_if_possible(error, def_id, param, &qpath) { + return true; + } + } + if let hir::Node::Expr(hir::Expr { + kind: hir::ExprKind::Call(callee, args), + hir_id: call_hir_id, + span: call_span, + .. + }) = hir.get_parent(hir_id) + && callee.hir_id == hir_id + { + if self.closure_span_overlaps_error(error, *call_span) { + return false; } - for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] + for param in + [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] .into_iter() .flatten() { - if self.point_at_path_if_possible(error, def_id, param, qpath) { + if self.blame_specific_arg_if_possible( + error, + def_id, + param, + *call_hir_id, + callee.span, + None, + args, + ) + { return true; } } } - hir::ExprKind::MethodCall(segment, receiver, args, ..) => { + + for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] + .into_iter() + .flatten() + { + if self.point_at_path_if_possible(error, def_id, param, &qpath) { + return true; + } + } + } + + match expr.map(|e| e.kind) { + Some(hir::ExprKind::MethodCall(segment, receiver, args, ..)) => { + if let Some(param) = direct_param + && self.point_at_generic_if_possible(error, def_id, param, segment) + { + error.obligation.cause.map_code(|parent_code| { + ObligationCauseCode::FunctionArgumentObligation { + arg_hir_id: receiver.hir_id, + call_hir_id: hir_id, + parent_code, + } + }); + return true; + } for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] .into_iter() .flatten() @@ -175,7 +211,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return true; } } - hir::ExprKind::Struct(qpath, fields, ..) => { + Some(hir::ExprKind::Struct(qpath, fields, ..)) => { if let Res::Def(DefKind::Struct | DefKind::Variant, variant_def_id) = self.typeck_results.borrow().qpath_res(qpath, hir_id) { @@ -200,9 +236,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at] - .into_iter() - .flatten() + for param in [ + direct_param, + param_to_point_at, + fallback_param_to_point_at, + self_param_to_point_at, + ] + .into_iter() + .flatten() { if self.point_at_path_if_possible(error, def_id, param, qpath) { return true; @@ -434,7 +475,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } /** - * Recursively searches for the most-specific blamable expression. + * Recursively searches for the most-specific blameable expression. * For example, if you have a chain of constraints like: * - want `Vec: Copy` * - because `Option>: Copy` needs `Vec: Copy` because `impl Copy for Option` diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 6a82b00211e..7707cc6de54 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -317,7 +317,18 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> { fn record_ty(&self, hir_id: hir::HirId, ty: Ty<'tcx>, span: Span) { // FIXME: normalization and escaping regions - let ty = if !ty.has_escaping_bound_vars() { self.normalize(span, ty) } else { ty }; + let ty = if !ty.has_escaping_bound_vars() { + if let ty::Alias( + ty::AliasKind::Projection | ty::AliasKind::Weak, + ty::AliasTy { args, def_id, .. }, + ) = ty.kind() + { + self.add_required_obligations_for_hir(span, *def_id, args, hir_id); + } + self.normalize(span, ty) + } else { + ty + }; self.write_ty(hir_id, ty) } diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 2504f616fb7..966f56e2a15 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -14,12 +14,10 @@ LL | fn foo(i: impl std::fmt::Display) {} = note: `impl Trait` cannot be explicitly specified as a generic argument error[E0277]: `()` doesn't implement `std::fmt::Display` - --> $DIR/issue-100154.rs:4:15 + --> $DIR/issue-100154.rs:4:11 | LL | foo::<()>(()); - | --------- ^^ `()` cannot be formatted with the default formatter - | | - | required by a bound introduced by this call + | ^^ `()` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead diff --git a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr index 8fecfdf7b93..676d6353d98 100644 --- a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr +++ b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:12 + --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:13 | LL | let u: >::Bar = t.get_bar(); - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` + | ^ the trait `Foo` is not implemented for `T` | help: consider further restricting this bound | diff --git a/tests/ui/const-generics/exhaustive-value.stderr b/tests/ui/const-generics/exhaustive-value.stderr index 0828f7896dc..deb65ddba70 100644 --- a/tests/ui/const-generics/exhaustive-value.stderr +++ b/tests/ui/const-generics/exhaustive-value.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/exhaustive-value.rs:262:16 + --> $DIR/exhaustive-value.rs:262:6 | LL | <() as Foo>::test() - | ^ the trait `Foo` is not implemented for `()` + | ^^ the trait `Foo` is not implemented for `()` | = help: the following other types implement trait `Foo`: <() as Foo<0>> diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr index 870f1805b58..dcfec53eeb9 100644 --- a/tests/ui/function-pointer/unsized-ret.stderr +++ b/tests/ui/function-pointer/unsized-ret.stderr @@ -1,10 +1,8 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/unsized-ret.rs:10:27 + --> $DIR/unsized-ret.rs:10:11 | LL | foo:: str, _>(None, ()); - | --------------------- ^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `fn() -> str`, the trait `Sized` is not implemented for `str` = note: required because it appears within the type `fn() -> str` @@ -15,12 +13,10 @@ LL | fn foo, T:std::marker::Tuple>(f: Option, t: T) { | ^^^^^ required by this bound in `foo` error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot be known at compilation time - --> $DIR/unsized-ret.rs:13:66 + --> $DIR/unsized-ret.rs:13:11 | LL | foo:: fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),)); - | ------------------------------------------------------------ ^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)` = note: required because it appears within the type `fn(&()) -> dyn Display` diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs new file mode 100644 index 00000000000..b127b3f6e1f --- /dev/null +++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs @@ -0,0 +1,10 @@ +trait Trait { + type P; +} +impl Trait for () { + type P = (); +} +fn main() { + let _: <() as Trait>::P; + //~^ ERROR the trait bound `String: Copy` is not satisfied +} diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr new file mode 100644 index 00000000000..72a987b4a1d --- /dev/null +++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/multiple-type-params-with-unmet-bounds.rs:8:29 + | +LL | let _: <() as Trait>::P; + | ^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `Trait::P` + --> $DIR/multiple-type-params-with-unmet-bounds.rs:2:15 + | +LL | type P; + | ^^^^ required by this bound in `Trait::P` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/own-bound-span.stderr b/tests/ui/generic-associated-types/own-bound-span.stderr index 8ab8ea623b2..4a0566ca7b5 100644 --- a/tests/ui/generic-associated-types/own-bound-span.stderr +++ b/tests/ui/generic-associated-types/own-bound-span.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/own-bound-span.rs:14:12 + --> $DIR/own-bound-span.rs:14:24 | LL | let _: ::P; - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | ^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `D::P` --> $DIR/own-bound-span.rs:4:15 diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr index 8eda71ec09b..9b96e6dd89b 100644 --- a/tests/ui/inference/issue-72690.stderr +++ b/tests/ui/inference/issue-72690.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:7:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -71,7 +71,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:21:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -97,7 +97,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:28:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -123,7 +123,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:37:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -149,7 +149,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:46:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -175,7 +175,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:53:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; @@ -201,7 +201,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:62:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` + | ^^^^^^ cannot infer type for reference `&_` | = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - impl<> From<&String> for String; diff --git a/tests/ui/issues/issue-29147.stderr b/tests/ui/issues/issue-29147.stderr index 138d477dc6b..d0d9485310b 100644 --- a/tests/ui/issues/issue-29147.stderr +++ b/tests/ui/issues/issue-29147.stderr @@ -1,8 +1,8 @@ error[E0283]: type annotations needed - --> $DIR/issue-29147.rs:22:13 + --> $DIR/issue-29147.rs:22:14 | LL | let _ = >::xxx; - | ^^^^^^^^^^^^ cannot infer type for struct `S5<_>` + | ^^^^^ cannot infer type for struct `S5<_>` | note: multiple `impl`s satisfying `S5<_>: Foo` found --> $DIR/issue-29147.rs:18:1 diff --git a/tests/ui/issues/issue-66353.stderr b/tests/ui/issues/issue-66353.stderr index 3356180974f..71530f58220 100644 --- a/tests/ui/issues/issue-66353.stderr +++ b/tests/ui/issues/issue-66353.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `(): _A` is not satisfied - --> $DIR/issue-66353.rs:12:14 + --> $DIR/issue-66353.rs:12:15 | LL | _Func::< <() as _A>::AssocT >::func(()); - | ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()` + | ^^ the trait `_A` is not implemented for `()` error[E0277]: the trait bound `(): _Func<_>` is not satisfied --> $DIR/issue-66353.rs:12:41 diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr index cec482a53ba..22b1da64cb3 100644 --- a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -17,10 +17,12 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:39 | LL | let x3 = x1.into_iter().collect::>(); - | ^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` + | ------- ^^^^^^^^ value of type `Vec` cannot be built from `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `FromIterator<&f64>` is not implemented for `Vec` = help: the trait `FromIterator` is implemented for `Vec` diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr index 0ec5e73f39a..67949b37d40 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/issues/issue-87199.stderr @@ -17,12 +17,10 @@ LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-87199.rs:18:22 + --> $DIR/issue-87199.rs:18:15 | LL | ref_arg::<[i32]>(&[5]); - | ---------------- ^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` note: required by a bound in `ref_arg` diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr index 7f1b9c38e67..e728fec2910 100644 --- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}` - --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:41 + --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:47 | LL | let x = Some(()).iter().map(|()| 1).sum::(); - | ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Sum`: diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr index a2688107d10..b355da5cb76 100644 --- a/tests/ui/iterators/invalid-iterator-chain.stderr +++ b/tests/ui/iterators/invalid-iterator-chain.stderr @@ -17,10 +17,12 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` - --> $DIR/invalid-iterator-chain.rs:15:27 + --> $DIR/invalid-iterator-chain.rs:15:33 | LL | println!("{}", scores.sum::()); - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: @@ -42,10 +44,12 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` - --> $DIR/invalid-iterator-chain.rs:26:14 + --> $DIR/invalid-iterator-chain.rs:26:20 | LL | .sum::(), - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: @@ -74,10 +78,12 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64` - --> $DIR/invalid-iterator-chain.rs:36:14 + --> $DIR/invalid-iterator-chain.rs:36:20 | LL | .sum::(), - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum` is not implemented for `i32` = help: the following other types implement trait `Sum`: @@ -102,10 +108,12 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` - --> $DIR/invalid-iterator-chain.rs:38:54 + --> $DIR/invalid-iterator-chain.rs:38:60 | LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: @@ -123,10 +131,12 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()` - --> $DIR/invalid-iterator-chain.rs:39:40 + --> $DIR/invalid-iterator-chain.rs:39:46 | LL | println!("{}", vec![(), ()].iter().sum::()); - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<&()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr index 9e0e2bfa872..3b216ac1581 100644 --- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr +++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr @@ -1,14 +1,14 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12 + --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24 | LL | let _: lazy::Alias; - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | ^^^^^^ the trait `Copy` is not implemented for `String` | -note: required by a bound on the type alias `Alias` +note: required by a bound in `lazy::Alias` --> $DIR/auxiliary/lazy.rs:4:19 | LL | pub type Alias = Option; - | ^^^^ required by this bound + | ^^^^ required by this bound in `Alias` error: aborting due to previous error diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr index 9e0e2bfa872..3b216ac1581 100644 --- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr +++ b/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr @@ -1,14 +1,14 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:12 + --> $DIR/extern-crate-has-lazy-type-aliases.rs:15:24 | LL | let _: lazy::Alias; - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | ^^^^^^ the trait `Copy` is not implemented for `String` | -note: required by a bound on the type alias `Alias` +note: required by a bound in `lazy::Alias` --> $DIR/auxiliary/lazy.rs:4:19 | LL | pub type Alias = Option; - | ^^^^ required by this bound + | ^^^^ required by this bound in `Alias` error: aborting due to previous error diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/lazy-type-alias/trailing-where-clause.stderr index d7606ba6b2a..193f80b23d3 100644 --- a/tests/ui/lazy-type-alias/trailing-where-clause.stderr +++ b/tests/ui/lazy-type-alias/trailing-where-clause.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `String: From<()>` is not satisfied - --> $DIR/trailing-where-clause.rs:12:12 + --> $DIR/trailing-where-clause.rs:12:18 | LL | let _: Alias<()>; - | ^^^^^^^^^ the trait `From<()>` is not implemented for `String` + | ^^ the trait `From<()>` is not implemented for `String` | = help: the following other types implement trait `From`: > @@ -11,11 +11,14 @@ LL | let _: Alias<()>; > > > -note: required by a bound on the type alias `Alias` +note: required by a bound in `Alias` --> $DIR/trailing-where-clause.rs:8:13 | +LL | type Alias = T + | ----- required by a bound in this type alias +LL | where LL | String: From; - | ^^^^^^^ required by this bound + | ^^^^^^^ required by this bound in `Alias` error: aborting due to previous error diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr index a8afdeb8401..a329b52e373 100644 --- a/tests/ui/methods/issues/issue-61525.stderr +++ b/tests/ui/methods/issues/issue-61525.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time - --> $DIR/issue-61525.rs:14:33 + --> $DIR/issue-61525.rs:14:19 | LL | 1.query::("") - | ----- ^^ doesn't have a size known at compile-time + | ----- ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | required by a bound introduced by this call | diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr index 06e902bca70..54c16230fe6 100644 --- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr +++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied - --> $DIR/never-value-fallback-issue-66757.rs:28:26 + --> $DIR/never-value-fallback-issue-66757.rs:28:6 | LL | >::from(never); - | -------------------- ^^^^^ the trait `From<()>` is not implemented for `E` - | | - | required by a bound introduced by this call + | ^ the trait `From<()>` is not implemented for `E` | = help: the trait `From` is implemented for `E` diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr index f8488d842e2..6b5bc360349 100644 --- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr +++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr @@ -13,12 +13,12 @@ LL | fn bop() where T: Sized { | ++++++++++++++ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/assoc_type_bounds_sized_used.rs:12:13 + --> $DIR/assoc_type_bounds_sized_used.rs:12:14 | LL | fn bop() { | - this type parameter needs to be `Sized` LL | let _ = ::Bar::default(); - | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time | note: required by a bound in `Bop::Bar` --> $DIR/assoc_type_bounds_sized_used.rs:8:15 diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr index a2357e49b07..257dec20074 100644 --- a/tests/ui/on-unimplemented/sum.stderr +++ b/tests/ui/on-unimplemented/sum.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()` - --> $DIR/sum.rs:4:25 + --> $DIR/sum.rs:4:31 | LL | vec![(), ()].iter().sum::(); - | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Sum<&()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: @@ -19,10 +21,12 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator - --> $DIR/sum.rs:7:25 + --> $DIR/sum.rs:7:35 | LL | vec![(), ()].iter().product::(); - | ^^^^^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator` + | ------- ^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator` + | | + | required by a bound introduced by this call | = help: the trait `Product<&()>` is not implemented for `i32` = help: the following other types implement trait `Product`: diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr index 4fcfe9d4769..ad11c090f12 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/assoc-type-const-bound-usage.rs:12:5 + --> $DIR/assoc-type-const-bound-usage.rs:12:6 | LL | ::Assoc::foo(); - | ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` + | ^ the trait `Foo` is not implemented for `T` | help: consider further restricting this bound | diff --git a/tests/ui/suggestions/assoc-const-as-fn.stderr b/tests/ui/suggestions/assoc-const-as-fn.stderr index 3b6e947c59f..d55d968b600 100644 --- a/tests/ui/suggestions/assoc-const-as-fn.stderr +++ b/tests/ui/suggestions/assoc-const-as-fn.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied - --> $DIR/assoc-const-as-fn.rs:14:40 + --> $DIR/assoc-const-as-fn.rs:14:6 | LL | ::FACTORY(1, value); - | ------------------------------- ^^^^^ the trait `GlUniformScalar` is not implemented for `T` - | | - | required by a bound introduced by this call + | ^ the trait `GlUniformScalar` is not implemented for `T` | help: consider further restricting this bound | diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr index 074284cbdd4..bdcfbe79558 100644 --- a/tests/ui/traits/bad-method-typaram-kind.stderr +++ b/tests/ui/traits/bad-method-typaram-kind.stderr @@ -2,7 +2,9 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/bad-method-typaram-kind.rs:2:13 | LL | 1.bar::(); - | ^ `T` cannot be sent between threads safely + | --- ^ `T` cannot be sent between threads safely + | | + | required by a bound introduced by this call | = note: consider using `std::sync::Arc`; for more information visit note: required by a bound in `Bar::bar` diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr index 934d20b2267..263c59ee327 100644 --- a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr +++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr @@ -5,12 +5,10 @@ LL | >::ref_foo(unknown); | ^^^^^^^ not found in this scope error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied - --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35 + --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:6 | LL | >::ref_foo(unknown); - | ----------------------------- ^^^^^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>` - | | - | required by a bound introduced by this call + | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>` | note: required for `i32` to implement `RefFoo` --> $DIR/dont-autoderef-ty-with-escaping-var.rs:9:9 diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr index 656e0d0bf26..7027fa69e03 100644 --- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -24,12 +24,10 @@ LL | fn with_trait>(c: &C) -> bool { | ++++++++++++++++ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:34:37 + --> $DIR/repeated-supertrait-ambig.rs:34:6 | LL | ::same_as(c, 22) - | ---------------------------- ^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | = help: the following other types implement trait `CompareTo`: > diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index d4fea05fe4b..33cc186ac0b 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -35,23 +35,12 @@ help: consider specifying the generic argument LL | opts.get::(opt.as_ref()); | +++++ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/issue-77982.rs:13:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | --------- ^^^^ - | | - | required by a bound introduced by this call + | ^^^^ | - = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate: - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for T; - - impl From for T; help: try using a fully qualified path to specify the expected types | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(>::into(0u32))).collect(); @@ -95,4 +84,5 @@ LL | let _: Box = (&()).bar(); error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0283`. +Some errors have detailed explanations: E0282, E0283. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr index f7551739b13..4eaa259617b 100644 --- a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr +++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr @@ -1,10 +1,8 @@ error[E0277]: expected a `Fn<_>` closure, found `fn() -> str` - --> $DIR/builtin-fn-must-return-sized.rs:15:27 + --> $DIR/builtin-fn-must-return-sized.rs:15:11 | LL | foo:: str, _>(None, ()); - | --------------------- ^^^^ expected an `Fn<_>` closure, found `fn() -> str` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^ expected an `Fn<_>` closure, found `fn() -> str` | = help: the trait `Fn<_>` is not implemented for `fn() -> str` note: required by a bound in `foo` diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr index 7d3535e1f01..a861156711d 100644 --- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr +++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr @@ -5,10 +5,10 @@ LL | impls::>(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls` error[E0275]: overflow evaluating the requirement `W<_>: Trait` - --> $DIR/fixpoint-exponential-growth.rs:29:5 + --> $DIR/fixpoint-exponential-growth.rs:29:13 | LL | impls::>(); - | ^^^^^^^^^^^^^ + | ^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`) note: required by a bound in `impls` diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr index 4b8846da535..a3404da51f0 100644 --- a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr +++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `(): Trait` - --> $DIR/double-cycle-inductive-coinductive.rs:32:5 + --> $DIR/double-cycle-inductive-coinductive.rs:32:19 | LL | impls_trait::<()>(); - | ^^^^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait` @@ -12,10 +12,10 @@ LL | fn impls_trait() {} | ^^^^^ required by this bound in `impls_trait` error[E0275]: overflow evaluating the requirement `(): TraitRev` - --> $DIR/double-cycle-inductive-coinductive.rs:35:5 + --> $DIR/double-cycle-inductive-coinductive.rs:35:23 | LL | impls_trait_rev::<()>(); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait_rev` diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr index 0e1c86c1bb3..34115334063 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr +++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `(): AR` - --> $DIR/inductive-not-on-stack.rs:44:5 + --> $DIR/inductive-not-on-stack.rs:44:16 | LL | impls_ar::<()>(); - | ^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`) note: required by a bound in `impls_ar` diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr index ec1c3231abc..a31bfd9589b 100644 --- a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -1,8 +1,8 @@ error[E0283]: type annotations needed: cannot satisfy `Foo: Send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5 + --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18 | LL | needs_send::(); - | ^^^^^^^^^^^^^^^^^ + | ^^^ | = note: cannot satisfy `Foo: Send` note: required by a bound in `needs_send` diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr index 28a99cbbca6..beed40f3649 100644 --- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr +++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr @@ -5,10 +5,10 @@ LL | impls::>(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls` error[E0275]: overflow evaluating the requirement `W<_>: Trait` - --> $DIR/exponential-trait-goals.rs:17:5 + --> $DIR/exponential-trait-goals.rs:17:13 | LL | impls::>(); - | ^^^^^^^^^^^^^ + | ^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`exponential_trait_goals`) note: required by a bound in `impls` diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/new-solver/overflow/global-cache.stderr index f3b86a083ad..ebb03d84b87 100644 --- a/tests/ui/traits/new-solver/overflow/global-cache.stderr +++ b/tests/ui/traits/new-solver/overflow/global-cache.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `Inc>>>>>>: Trait` - --> $DIR/global-cache.rs:21:5 + --> $DIR/global-cache.rs:21:19 | LL | impls_trait::>>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`) note: required by a bound in `impls_trait` diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr index eebaf21d7df..1dc63fae98c 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `::Assoc1: Bar` - --> $DIR/recursive-self-normalization-2.rs:16:5 + --> $DIR/recursive-self-normalization-2.rs:16:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`) note: required by a bound in `needs_bar` diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr index 6a87fe2f121..afc5bfa54ac 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `::Assoc: Bar` - --> $DIR/recursive-self-normalization.rs:12:5 + --> $DIR/recursive-self-normalization.rs:12:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`) note: required by a bound in `needs_bar` diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr index 83a0452b088..b311ac6b5a6 100644 --- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr @@ -1,8 +1,8 @@ error[E0283]: type annotations needed: cannot satisfy `T: Bar` - --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:5 + --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^ + | ^ | = note: cannot satisfy `T: Bar` = help: the trait `Bar` is implemented for `T` diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr index 542e3a28adf..632f0f81624 100644 --- a/tests/ui/traits/reservation-impl/no-use.next.stderr +++ b/tests/ui/traits/reservation-impl/no-use.next.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): MyTrait` is not satisfied - --> $DIR/no-use.rs:11:26 + --> $DIR/no-use.rs:11:6 | LL | <() as MyTrait>::foo(&()); - | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^ the trait `MyTrait` is not implemented for `()` | = help: the trait `MyTrait` is implemented for `()` diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr index 542e3a28adf..632f0f81624 100644 --- a/tests/ui/traits/reservation-impl/no-use.old.stderr +++ b/tests/ui/traits/reservation-impl/no-use.old.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): MyTrait` is not satisfied - --> $DIR/no-use.rs:11:26 + --> $DIR/no-use.rs:11:6 | LL | <() as MyTrait>::foo(&()); - | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^ the trait `MyTrait` is not implemented for `()` | = help: the trait `MyTrait` is implemented for `()` diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr index 5a539884873..e3bbf768c6e 100644 --- a/tests/ui/traits/suggest-where-clause.stderr +++ b/tests/ui/traits/suggest-where-clause.stderr @@ -38,10 +38,10 @@ LL + fn check() { | error[E0277]: the trait bound `u64: From` is not satisfied - --> $DIR/suggest-where-clause.rs:15:18 + --> $DIR/suggest-where-clause.rs:15:6 | LL | >::from; - | ^ the trait `From` is not implemented for `u64` + | ^^^ the trait `From` is not implemented for `u64` | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | @@ -49,10 +49,10 @@ LL | fn check() where u64: From { | ++++++++++++++++++ error[E0277]: the trait bound `u64: From<::Item>` is not satisfied - --> $DIR/suggest-where-clause.rs:18:18 + --> $DIR/suggest-where-clause.rs:18:6 | LL | ::Item>>::from; - | ^^^^^^^^^^^^^^^^^^^^^ the trait `From<::Item>` is not implemented for `u64` + | ^^^ the trait `From<::Item>` is not implemented for `u64` | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | @@ -60,10 +60,10 @@ LL | fn check() where u64: From<::Item> { | ++++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `Misc<_>: From` is not satisfied - --> $DIR/suggest-where-clause.rs:23:22 + --> $DIR/suggest-where-clause.rs:23:6 | LL | as From>::from; - | ^ the trait `From` is not implemented for `Misc<_>` + | ^^^^^^^ the trait `From` is not implemented for `Misc<_>` error[E0277]: the size for values of type `[T]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:28:20 diff --git a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr index 08eab025370..a75024aa248 100644 --- a/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr +++ b/tests/ui/typeck/issue-90804-incorrect-reference-suggestion.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): Marker` is not satisfied - --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:17 + --> $DIR/issue-90804-incorrect-reference-suggestion.rs:10:13 | LL | check::<()>(()); - | ----------- ^^ the trait `Marker` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^ the trait `Marker` is not implemented for `()` | note: required by a bound in `check` --> $DIR/issue-90804-incorrect-reference-suggestion.rs:7:17 diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 85adf775139..ae0a06e6328 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -1,10 +1,8 @@ error[E0277]: cannot add `u32` to `i32` - --> $DIR/ufcs-qpath-self-mismatch.rs:4:31 + --> $DIR/ufcs-qpath-self-mismatch.rs:4:6 | LL | >::add(1, 2); - | ---------------------- ^ no implementation for `i32 + u32` - | | - | required by a bound introduced by this call + | ^^^ no implementation for `i32 + u32` | = help: the trait `Add` is not implemented for `i32` = help: the following other types implement trait `Add`: diff --git a/tests/ui/unsized/unsized3.stderr b/tests/ui/unsized/unsized3.stderr index 3ef9a875358..a11243980d1 100644 --- a/tests/ui/unsized/unsized3.stderr +++ b/tests/ui/unsized/unsized3.stderr @@ -1,12 +1,10 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:7:13 + --> $DIR/unsized3.rs:7:10 | LL | fn f1(x: &X) { | - this type parameter needs to be `Sized` LL | f2::(x); - | ------- ^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^ doesn't have a size known at compile-time | note: required by a bound in `f2` --> $DIR/unsized3.rs:10:7 @@ -24,14 +22,12 @@ LL | fn f2(x: &X) { | ++++++++ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:18:13 + --> $DIR/unsized3.rs:18:10 | LL | fn f3(x: &X) { | - this type parameter needs to be `Sized` LL | f4::(x); - | ------- ^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^ doesn't have a size known at compile-time | note: required by a bound in `f4` --> $DIR/unsized3.rs:21:7