diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index e6999f9e3ac..710d847384e 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -263,7 +263,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn confirm_builtin_call( &self, - call_expr: &hir::Expr, + call_expr: &'tcx hir::Expr, callee_ty: Ty<'tcx>, arg_exprs: &'tcx [hir::Expr], expected: Expectation<'tcx>, @@ -425,7 +425,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); self.check_argument_types( call_expr.span, - call_expr.span, + call_expr, inputs, &expected_arg_tys[..], arg_exprs, @@ -439,7 +439,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn confirm_deferred_closure_call( &self, - call_expr: &hir::Expr, + call_expr: &'tcx hir::Expr, arg_exprs: &'tcx [hir::Expr], expected: Expectation<'tcx>, fn_sig: ty::FnSig<'tcx>, @@ -458,7 +458,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.check_argument_types( call_expr.span, - call_expr.span, + call_expr, fn_sig.inputs(), &expected_arg_tys, arg_exprs, @@ -472,14 +472,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn confirm_overloaded_call( &self, - call_expr: &hir::Expr, + call_expr: &'tcx hir::Expr, arg_exprs: &'tcx [hir::Expr], expected: Expectation<'tcx>, method_callee: MethodCallee<'tcx>, ) -> Ty<'tcx> { let output_type = self.check_method_argument_types( call_expr.span, - call_expr.span, + call_expr, Ok(method_callee), arg_exprs, TupleArgumentsFlag::TupleArguments, diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 1ae50b8cb28..e34a2c6f61c 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -796,7 +796,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Call the generic checker. self.check_method_argument_types( span, - expr.span, + expr, method, &args[1..], DontTupleArguments, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index edea91c717e..5fe554de258 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3070,12 +3070,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn check_method_argument_types( &self, sp: Span, - expr_sp: Span, + expr: &'tcx hir::Expr, method: Result, ()>, args_no_rcvr: &'tcx [hir::Expr], tuple_arguments: TupleArgumentsFlag, expected: Expectation<'tcx>, ) -> Ty<'tcx> { + let has_error = match method { Ok(method) => { method.substs.references_error() || method.sig.references_error() @@ -3090,8 +3091,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { TupleArguments => vec![self.tcx.intern_tup(&err_inputs[..])], }; - self.check_argument_types(sp, expr_sp, &err_inputs[..], &[], args_no_rcvr, - false, tuple_arguments, None); + self.check_argument_types( + sp, + expr, + &err_inputs[..], + &[], + args_no_rcvr, + false, + tuple_arguments, + None, + ); return self.tcx.types.err; } @@ -3103,9 +3112,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { method.sig.output(), &method.sig.inputs()[1..] ); - self.check_argument_types(sp, expr_sp, &method.sig.inputs()[1..], &expected_arg_tys[..], - args_no_rcvr, method.sig.c_variadic, tuple_arguments, - self.tcx.hir().span_if_local(method.def_id)); + self.check_argument_types( + sp, + expr, + &method.sig.inputs()[1..], + &expected_arg_tys[..], + args_no_rcvr, + method.sig.c_variadic, + tuple_arguments, + self.tcx.hir().span_if_local(method.def_id), + ); method.sig.output() } @@ -3182,7 +3198,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn check_argument_types( &self, sp: Span, - expr_sp: Span, + expr: &'tcx hir::Expr, fn_inputs: &[Ty<'tcx>], expected_arg_tys: &[Ty<'tcx>], args: &'tcx [hir::Expr], @@ -3191,7 +3207,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { def_span: Option, ) { let tcx = self.tcx; - // Grab the argument types, supplying fresh type variables // if the wrong number of arguments were supplied let supplied_arg_count = if tuple_arguments == DontTupleArguments { @@ -3225,7 +3240,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(def_s, "defined here"); } if sugg_unit { - let sugg_span = tcx.sess.source_map().end_point(expr_sp); + let sugg_span = tcx.sess.source_map().end_point(expr.span); // remove closing `)` from the span let sugg_span = sugg_span.shrink_to_lo(); err.span_suggestion( @@ -3319,6 +3334,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // the call. This helps coercions. if check_closures { self.select_obligations_where_possible(false, |errors| { + self.point_at_type_arg_instead_of_call_if_possible(errors, expr); self.point_at_arg_instead_of_call_if_possible( errors, &final_arg_types[..], @@ -3456,6 +3472,51 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } + /// Given a vec of evaluated `FullfillmentError`s and an `fn` call expression, we walk the + /// `PathSegment`s and resolve their type parameters to see if any of the `FullfillmentError`s + /// were caused by them. If they were, we point at the corresponding type argument's span + /// instead of the `fn` call path span. + fn point_at_type_arg_instead_of_call_if_possible( + &self, + errors: &mut Vec>, + call_expr: &'tcx hir::Expr, + ) { + if let hir::ExprKind::Call(path, _args) = &call_expr.node { + if let hir::ExprKind::Path(qpath) = &path.node { + if let hir::QPath::Resolved(_self, path) = &qpath { + for error in errors { + if let ty::Predicate::Trait(predicate) = error.obligation.predicate { + // If any of the type arguments in this path segment caused the + // `FullfillmentError`, point at its span (#61860). + for segment in &path.segments { + if let Some(args) = &segment.args { + for arg in &args.args { + if let hir::GenericArg::Type(hir_ty) = &arg { + if let hir::TyKind::Path( + hir::QPath::TypeRelative(..), + ) = &hir_ty.node { + // Avoid ICE with associated types. As this is best + // effort only, it's ok to ignore the case. It + // would trigger in `is_send::();` + // from `typeck-default-trait-impl-assoc-type.rs`. + } else { + let ty = AstConv::ast_ty_to_ty(self, hir_ty); + let ty = self.resolve_vars_if_possible(&ty); + if ty == predicate.skip_binder().self_ty() { + error.obligation.cause.span = hir_ty.span; + } + } + } + } + } + } + } + } + } + } + } + } + // AST fragment checking fn check_lit(&self, lit: &hir::Lit, diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index f560aefd637..45b6cc9ba5f 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -27,7 +27,7 @@ LL | bar::(); found type `&usize` error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:91:5 + --> $DIR/associated-types-eq-hr.rs:91:17 | LL | fn tuple_one() | --------- @@ -35,7 +35,7 @@ LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize> | ---------------------------------------------------------- required by this bound in `tuple_one` ... LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` + | ^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` | = help: the following implementations were found: > @@ -52,7 +52,7 @@ LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:97:5 + --> $DIR/associated-types-eq-hr.rs:97:17 | LL | fn tuple_two() | --------- @@ -60,7 +60,7 @@ LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize> | ---------------------------------------------------------- required by this bound in `tuple_two` ... LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` + | ^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` | = help: the following implementations were found: > @@ -77,7 +77,7 @@ LL | tuple_two::(); | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:107:5 + --> $DIR/associated-types-eq-hr.rs:107:18 | LL | fn tuple_four() | ---------- @@ -85,7 +85,7 @@ LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize)> | ------------------------------------------- required by this bound in `tuple_four` ... LL | tuple_four::(); - | ^^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` + | ^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` | = help: the following implementations were found: > diff --git a/src/test/ui/extern/extern-types-not-sync-send.stderr b/src/test/ui/extern/extern-types-not-sync-send.stderr index 803bd9dbac6..c395f3875ea 100644 --- a/src/test/ui/extern/extern-types-not-sync-send.stderr +++ b/src/test/ui/extern/extern-types-not-sync-send.stderr @@ -1,22 +1,22 @@ error[E0277]: `A` cannot be shared between threads safely - --> $DIR/extern-types-not-sync-send.rs:13:5 + --> $DIR/extern-types-not-sync-send.rs:13:19 | LL | fn assert_sync() { } | ----------- ---- required by this bound in `assert_sync` ... LL | assert_sync::(); - | ^^^^^^^^^^^^^^^^ `A` cannot be shared between threads safely + | ^ `A` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `A` error[E0277]: `A` cannot be sent between threads safely - --> $DIR/extern-types-not-sync-send.rs:16:5 + --> $DIR/extern-types-not-sync-send.rs:16:19 | LL | fn assert_send() { } | ----------- ---- required by this bound in `assert_send` ... LL | assert_send::(); - | ^^^^^^^^^^^^^^^^ `A` cannot be sent between threads safely + | ^ `A` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `A` diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 1f69a4e154e..0417186eed3 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:22:5 + --> $DIR/extern-types-unsized.rs:22:20 | LL | fn assert_sized() { } | ------------ - required by this bound in `assert_sized` ... LL | assert_sized::(); - | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `A` = note: to learn more, visit diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr index 205fa2b5bc8..9822b48f4f4 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied - --> $DIR/hrtb-conflate-regions.rs:27:10 + --> $DIR/hrtb-conflate-regions.rs:27:22 | LL | fn want_foo2() | --------- @@ -7,7 +7,7 @@ LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> | -------------------------------------- required by this bound in `want_foo2` ... LL | fn b() { want_foo2::(); } - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct` + | ^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct` | = help: the following implementations were found: > diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr index ceba22234be..969d9eda735 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Trait fn(&'b u32)>` is not satisfied - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:11 | LL | fn foo() | --- @@ -8,7 +8,7 @@ LL | T: Trait fn(&'b u32)>, | -------------------------- required by this bound in `foo` ... LL | foo::<()>(); - | ^^^^^^^^^ the trait `Trait fn(&'b u32)>` is not implemented for `()` + | ^^ the trait `Trait fn(&'b u32)>` is not implemented for `()` | = help: the following implementations were found: <() as Trait> diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr index a1cb3b230fe..dddc2bcce49 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Trait fn(fn(&'b u32))>` is not satisfied - --> $DIR/hrtb-exists-forall-trait-covariant.rs:36:5 + --> $DIR/hrtb-exists-forall-trait-covariant.rs:36:11 | LL | fn foo() | --- @@ -8,7 +8,7 @@ LL | T: Trait fn(fn(&'b u32))>, | ------------------------------ required by this bound in `foo` ... LL | foo::<()>(); - | ^^^^^^^^^ the trait `Trait fn(fn(&'b u32))>` is not implemented for `()` + | ^^ the trait `Trait fn(fn(&'b u32))>` is not implemented for `()` | = help: the following implementations were found: <() as Trait> diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr index 093bee375bb..23ef75944d3 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Trait fn(std::cell::Cell<&'b u32>)>` is not satisfied - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:11 | LL | fn foo() | --- @@ -8,7 +8,7 @@ LL | T: Trait fn(Cell<&'b u32>)>, | -------------------------------- required by this bound in `foo` ... LL | foo::<()>(); - | ^^^^^^^^^ the trait `Trait fn(std::cell::Cell<&'b u32>)>` is not implemented for `()` + | ^^ the trait `Trait fn(std::cell::Cell<&'b u32>)>` is not implemented for `()` | = help: the following implementations were found: <() as Trait)>> diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr index f4cf3555868..6ec0beefd60 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied - --> $DIR/hrtb-just-for-static.rs:24:5 + --> $DIR/hrtb-just-for-static.rs:24:17 | LL | fn want_hrtb() | --------- @@ -7,13 +7,13 @@ LL | where T : for<'a> Foo<&'a isize> | ---------------------- required by this bound in `want_hrtb` ... LL | want_hrtb::() - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt` + | ^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt` | = help: the following implementations were found: > error[E0277]: the trait bound `for<'a> &'a u32: Foo<&'a isize>` is not satisfied - --> $DIR/hrtb-just-for-static.rs:30:5 + --> $DIR/hrtb-just-for-static.rs:30:17 | LL | fn want_hrtb() | --------- @@ -21,7 +21,7 @@ LL | where T : for<'a> Foo<&'a isize> | ---------------------- required by this bound in `want_hrtb` ... LL | want_hrtb::<&'a u32>() - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `&'a u32` + | ^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `&'a u32` | = help: the following implementations were found: <&'a u32 as Foo<&'a isize>> diff --git a/src/test/ui/hrtb/issue-46989.stderr b/src/test/ui/hrtb/issue-46989.stderr index 4da3e3ddb7e..c818041e596 100644 --- a/src/test/ui/hrtb/issue-46989.stderr +++ b/src/test/ui/hrtb/issue-46989.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `for<'r> fn(&'r i32): Foo` is not satisfied - --> $DIR/issue-46989.rs:40:5 + --> $DIR/issue-46989.rs:40:18 | LL | fn assert_foo() {} | ---------- --- required by this bound in `assert_foo` ... LL | assert_foo::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `for<'r> fn(&'r i32)` + | ^^^^^^^^ the trait `Foo` is not implemented for `for<'r> fn(&'r i32)` | = help: the following implementations were found: diff --git a/src/test/ui/issues/issue-1920-1.stderr b/src/test/ui/issues/issue-1920-1.stderr index 56f70aa296c..089968ede7d 100644 --- a/src/test/ui/issues/issue-1920-1.stderr +++ b/src/test/ui/issues/issue-1920-1.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `foo::issue_1920::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-1.rs:12:5 + --> $DIR/issue-1920-1.rs:12:20 | LL | fn assert_clone() where T : Clone { } | ------------ ----- required by this bound in `assert_clone` ... LL | assert_clone::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `foo::issue_1920::S` + | ^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `foo::issue_1920::S` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1920-2.stderr b/src/test/ui/issues/issue-1920-2.stderr index 37027b05792..eaf34e076c0 100644 --- a/src/test/ui/issues/issue-1920-2.stderr +++ b/src/test/ui/issues/issue-1920-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `bar::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-2.rs:10:5 + --> $DIR/issue-1920-2.rs:10:20 | LL | fn assert_clone() where T : Clone { } | ------------ ----- required by this bound in `assert_clone` ... LL | assert_clone::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `bar::S` + | ^^^^^^ the trait `std::clone::Clone` is not implemented for `bar::S` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1920-3.stderr b/src/test/ui/issues/issue-1920-3.stderr index dbcb3aee117..0550f5feba5 100644 --- a/src/test/ui/issues/issue-1920-3.stderr +++ b/src/test/ui/issues/issue-1920-3.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `issue_1920::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-3.rs:14:5 + --> $DIR/issue-1920-3.rs:14:20 | LL | fn assert_clone() where T : Clone { } | ------------ ----- required by this bound in `assert_clone` ... LL | assert_clone::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `issue_1920::S` + | ^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `issue_1920::S` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 53b4448a757..fee9e2802a6 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -1,62 +1,68 @@ error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:27:5 + --> $DIR/kindck-copy.rs:27:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::<&'static mut isize>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize` + | -^^^^^^^^^^^^^^^^^ + | | + | the trait `std::marker::Copy` is not implemented for `&'static mut isize` + | help: consider removing 1 leading `&`-references | = help: the following implementations were found: error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:28:5 + --> $DIR/kindck-copy.rs:28:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::<&'a mut isize>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize` + | -^^^^^^^^^^^^ + | | + | the trait `std::marker::Copy` is not implemented for `&'a mut isize` + | help: consider removing 1 leading `&`-references | = help: the following implementations were found: error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:31:5 + --> $DIR/kindck-copy.rs:31:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` + | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:32:5 + --> $DIR/kindck-copy.rs:32:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::(); - | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` + | ^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` error[E0277]: the trait bound `std::vec::Vec: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:33:5 + --> $DIR/kindck-copy.rs:33:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy:: >(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec` + | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec` error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:34:5 + --> $DIR/kindck-copy.rs:34:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>` + | ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>` error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 @@ -77,31 +83,31 @@ LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:46:5 + --> $DIR/kindck-copy.rs:46:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::<&'a mut (dyn Dummy + Send)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:64:5 + --> $DIR/kindck-copy.rs:64:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct` + | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct` error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:67:5 + --> $DIR/kindck-copy.rs:67:19 | LL | fn assert_copy() { } | ----------- ---- required by this bound in `assert_copy` ... LL | assert_copy::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` + | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` error: aborting due to 11 previous errors diff --git a/src/test/ui/kindck/kindck-send-unsafe.stderr b/src/test/ui/kindck/kindck-send-unsafe.stderr index a46705ab175..05ed51d0f11 100644 --- a/src/test/ui/kindck/kindck-send-unsafe.stderr +++ b/src/test/ui/kindck/kindck-send-unsafe.stderr @@ -1,11 +1,11 @@ error[E0277]: `*mut &'a isize` cannot be sent between threads safely - --> $DIR/kindck-send-unsafe.rs:6:5 + --> $DIR/kindck-send-unsafe.rs:6:19 | LL | fn assert_send() { } | ----------- ---- required by this bound in `assert_send` ... LL | assert_send::<*mut &'a isize>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely + | ^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `*mut &'a isize` diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr index be5e649ef83..4508870746b 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied - --> $DIR/overlap-marker-trait.rs:27:5 + --> $DIR/overlap-marker-trait.rs:27:17 | LL | fn is_marker() { } | --------- ------ required by this bound in `is_marker` ... LL | is_marker::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` + | ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 6c249f62751..2daf4781c7e 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:16:13 + --> $DIR/unboxed-closures-vtable-mismatch.rs:16:24 | LL | fn call_itisize>(y: isize, mut f: F) -> isize { | ------- ------------------------- required by this bound in `call_it` diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/not-sync.stderr index 8871abedd00..8bb4ce2e2c7 100644 --- a/src/test/ui/not-sync.stderr +++ b/src/test/ui/not-sync.stderr @@ -1,66 +1,66 @@ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/not-sync.rs:8:5 + --> $DIR/not-sync.rs:8:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely + | ^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell` error[E0277]: `std::cell::RefCell` cannot be shared between threads safely - --> $DIR/not-sync.rs:10:5 + --> $DIR/not-sync.rs:10:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell` cannot be shared between threads safely + | ^^^^^^^^^^^^ `std::cell::RefCell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell` error[E0277]: `std::rc::Rc` cannot be shared between threads safely - --> $DIR/not-sync.rs:13:5 + --> $DIR/not-sync.rs:13:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be shared between threads safely + | ^^^^^^^ `std::rc::Rc` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc` error[E0277]: `std::rc::Weak` cannot be shared between threads safely - --> $DIR/not-sync.rs:15:5 + --> $DIR/not-sync.rs:15:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^^^ `std::rc::Weak` cannot be shared between threads safely + | ^^^^^^^^^ `std::rc::Weak` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::rc::Weak` error[E0277]: `std::sync::mpsc::Receiver` cannot be shared between threads safely - --> $DIR/not-sync.rs:18:5 + --> $DIR/not-sync.rs:18:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Receiver` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver` error[E0277]: `std::sync::mpsc::Sender` cannot be shared between threads safely - --> $DIR/not-sync.rs:20:5 + --> $DIR/not-sync.rs:20:12 | LL | fn test() {} | ---- ---- required by this bound in `test` ... LL | test::>(); - | ^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Sender` cannot be shared between threads safely + | ^^^^^^^^^^^ `std::sync::mpsc::Sender` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender` diff --git a/src/test/ui/overlap-marker-trait.stderr b/src/test/ui/overlap-marker-trait.stderr index daf4e5e69a2..15ebcd17b0d 100644 --- a/src/test/ui/overlap-marker-trait.stderr +++ b/src/test/ui/overlap-marker-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied - --> $DIR/overlap-marker-trait.rs:30:5 + --> $DIR/overlap-marker-trait.rs:30:17 | LL | fn is_marker() { } | --------- ------ required by this bound in `is_marker` ... LL | is_marker::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` + | ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` error: aborting due to previous error diff --git a/src/test/ui/traits/trait-alias/trait-alias-cross-crate.stderr b/src/test/ui/traits/trait-alias/trait-alias-cross-crate.stderr index 10a9506bd06..cad5c81f5a6 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-cross-crate.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-cross-crate.stderr @@ -1,22 +1,22 @@ error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/trait-alias-cross-crate.rs:14:5 + --> $DIR/trait-alias-cross-crate.rs:14:17 | LL | fn use_alias() {} | --------- -------- required by this bound in `use_alias` ... LL | use_alias::>(); - | ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be sent between threads safely + | ^^^^^^^ `std::rc::Rc` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc` error[E0277]: `std::rc::Rc` cannot be shared between threads safely - --> $DIR/trait-alias-cross-crate.rs:14:5 + --> $DIR/trait-alias-cross-crate.rs:14:17 | LL | fn use_alias() {} | --------- -------- required by this bound in `use_alias` ... LL | use_alias::>(); - | ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be shared between threads safely + | ^^^^^^^ `std::rc::Rc` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc` diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index a59306d3cb4..d15edaa9c81 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:9:5 + --> $DIR/trait-suggest-where-clause.rs:9:20 | LL | mem::size_of::(); - | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time | ::: $SRC_DIR/libcore/mem/mod.rs:LL:COL | @@ -56,10 +56,10 @@ LL | as From>::from; = note: required by `std::convert::From::from` error[E0277]: the size for values of type `[T]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:30:5 + --> $DIR/trait-suggest-where-clause.rs:30:20 | LL | mem::size_of::<[T]>(); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^ doesn't have a size known at compile-time | ::: $SRC_DIR/libcore/mem/mod.rs:LL:COL | diff --git a/src/test/ui/try-operator-on-main.stderr b/src/test/ui/try-operator-on-main.stderr index de75d3e313d..d2f1a04837b 100644 --- a/src/test/ui/try-operator-on-main.stderr +++ b/src/test/ui/try-operator-on-main.stderr @@ -17,10 +17,10 @@ LL | ()?; = note: required by `std::ops::Try::into_result` error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:15:5 + --> $DIR/try-operator-on-main.rs:15:25 | LL | try_trait_generic::<()>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` + | ^^ the trait `std::ops::Try` is not implemented for `()` ... LL | fn try_trait_generic() -> T { | ----------------- --- required by this bound in `try_trait_generic` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr index e5d275083df..22a2cb3e0ec 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-constituent-types.rs:20:5 + --> $DIR/typeck-default-trait-impl-constituent-types.rs:20:18 | LL | fn is_mytrait() {} | ---------- ------- required by this bound in `is_mytrait` ... LL | is_mytrait::(); - | ^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `MyS2` + | ^^^^ the trait `MyTrait` is not implemented for `MyS2` | = help: the following implementations were found: diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr index 2f5be975c6d..e30d4dfa1b3 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr @@ -1,11 +1,11 @@ error[E0277]: `MyNotSendable` cannot be sent between threads safely - --> $DIR/typeck-default-trait-impl-negation-send.rs:19:5 + --> $DIR/typeck-default-trait-impl-negation-send.rs:19:15 | LL | fn is_send() {} | ------- ---- required by this bound in `is_send` ... LL | is_send::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely + | ^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `MyNotSendable` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index 77e04a75a25..4dd8e01cf2d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -1,11 +1,11 @@ error[E0277]: `MyNotSync` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:33:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:33:15 | LL | fn is_sync() {} | ------- ---- required by this bound in `is_sync` ... LL | is_sync::(); - | ^^^^^^^^^^^^^^^^^^^^ `MyNotSync` cannot be shared between threads safely + | ^^^^^^^^^ `MyNotSync` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `MyNotSync` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr index 09c05825190..4b13fcc885a 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-negation.rs:21:5 + --> $DIR/typeck-default-trait-impl-negation.rs:21:19 | LL | fn is_my_trait() {} | ----------- ------- required by this bound in `is_my_trait` ... LL | is_my_trait::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + | ^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` | = help: the following implementations were found: error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-negation.rs:24:5 + --> $DIR/typeck-default-trait-impl-negation.rs:24:26 | LL | fn is_my_unsafe_trait() {} | ------------------ ------------- required by this bound in `is_my_unsafe_trait` ... LL | is_my_unsafe_trait::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + | ^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` | = help: the following implementations were found: diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 46731c0fbb0..b3139083b1a 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -1,8 +1,8 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/typeck-default-trait-impl-send-param.rs:5:5 + --> $DIR/typeck-default-trait-impl-send-param.rs:5:15 | LL | is_send::() - | ^^^^^^^^^^^^ `T` cannot be sent between threads safely + | ^ `T` cannot be sent between threads safely ... LL | fn is_send() { | ------- ---- required by this bound in `is_send` diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 565d5610337..e56176690a1 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -1,10 +1,10 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-bare-typaram.rs:2:23 + --> $DIR/unsized-bare-typaram.rs:2:29 | LL | fn bar() { } | --- - required by this bound in `bar` LL | fn foo() { bar::() } - | ^^^^^^^^ doesn't have a size known at compile-time + | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` = note: to learn more, visit