Point at type param when it's cause of unfulfilled obligation

This commit is contained in:
Esteban Küber 2019-09-20 11:58:20 -07:00
parent 4e0437ee8e
commit 4be51c879e
30 changed files with 176 additions and 109 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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<MethodCallee<'tcx>, ()>,
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<Span>,
) {
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<traits::FulfillmentError<'_>>,
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::<T::AssocType>();`
// 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,

View file

@ -27,7 +27,7 @@ LL | bar::<IntStruct>();
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<T>()
| ---------
@ -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::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ 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:
<Tuple as TheTrait<(&'a isize, &'a isize)>>
@ -52,7 +52,7 @@ LL | tuple_one::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ 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<T>()
| ---------
@ -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::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ 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:
<Tuple as TheTrait<(&'a isize, &'a isize)>>
@ -77,7 +77,7 @@ LL | tuple_two::<Tuple>();
| ^^^^^^^^^^^^^^^^^^ 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<T>()
| ----------
@ -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::<Tuple>();
| ^^^^^^^^^^^^^^^^^^^ 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:
<Tuple as TheTrait<(&'a isize, &'a isize)>>

View file

@ -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<T: ?Sized + Sync>() { }
| ----------- ---- required by this bound in `assert_sync`
...
LL | assert_sync::<A>();
| ^^^^^^^^^^^^^^^^ `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<T: ?Sized + Send>() { }
| ----------- ---- required by this bound in `assert_send`
...
LL | assert_send::<A>();
| ^^^^^^^^^^^^^^^^ `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`

View file

@ -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<T>() { }
| ------------ - required by this bound in `assert_sized`
...
LL | assert_sized::<A>();
| ^^^^^^^^^^^^^^^^^ 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 <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

View file

@ -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<T>()
| ---------
@ -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::<SomeStruct>(); }
| ^^^^^^^^^^^^^^^^^^^^^^^ 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:
<SomeStruct as Foo<(&'a isize, &'a isize)>>

View file

@ -1,5 +1,5 @@
error[E0277]: the trait bound `(): Trait<for<'b> 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<T>()
| ---
@ -8,7 +8,7 @@ LL | T: Trait<for<'b> fn(&'b u32)>,
| -------------------------- required by this bound in `foo`
...
LL | foo::<()>();
| ^^^^^^^^^ the trait `Trait<for<'b> fn(&'b u32)>` is not implemented for `()`
| ^^ the trait `Trait<for<'b> fn(&'b u32)>` is not implemented for `()`
|
= help: the following implementations were found:
<() as Trait<fn(&'a u32)>>

View file

@ -1,5 +1,5 @@
error[E0277]: the trait bound `(): Trait<for<'b> 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<T>()
| ---
@ -8,7 +8,7 @@ LL | T: Trait<for<'b> fn(fn(&'b u32))>,
| ------------------------------ required by this bound in `foo`
...
LL | foo::<()>();
| ^^^^^^^^^ the trait `Trait<for<'b> fn(fn(&'b u32))>` is not implemented for `()`
| ^^ the trait `Trait<for<'b> fn(fn(&'b u32))>` is not implemented for `()`
|
= help: the following implementations were found:
<() as Trait<fn(fn(&'a u32))>>

View file

@ -1,5 +1,5 @@
error[E0277]: the trait bound `(): Trait<for<'b> 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<T>()
| ---
@ -8,7 +8,7 @@ LL | T: Trait<for<'b> fn(Cell<&'b u32>)>,
| -------------------------------- required by this bound in `foo`
...
LL | foo::<()>();
| ^^^^^^^^^ the trait `Trait<for<'b> fn(std::cell::Cell<&'b u32>)>` is not implemented for `()`
| ^^ the trait `Trait<for<'b> fn(std::cell::Cell<&'b u32>)>` is not implemented for `()`
|
= help: the following implementations were found:
<() as Trait<fn(std::cell::Cell<&'a u32>)>>

View file

@ -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<T>()
| ---------
@ -7,13 +7,13 @@ LL | where T : for<'a> Foo<&'a isize>
| ---------------------- required by this bound in `want_hrtb`
...
LL | want_hrtb::<StaticInt>()
| ^^^^^^^^^^^^^^^^^^^^^^ 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:
<StaticInt as Foo<&'static isize>>
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<T>()
| ---------
@ -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>>

View file

@ -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<T: Foo>() {}
| ---------- --- required by this bound in `assert_foo`
...
LL | assert_foo::<fn(&i32)>();
| ^^^^^^^^^^^^^^^^^^^^^^ 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:
<fn(A) as Foo>

View file

@ -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<T>() where T : Clone { }
| ------------ ----- required by this bound in `assert_clone`
...
LL | assert_clone::<foo::issue_1920::S>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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

View file

@ -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<T>() where T : Clone { }
| ------------ ----- required by this bound in `assert_clone`
...
LL | assert_clone::<bar::S>();
| ^^^^^^^^^^^^^^^^^^^^^^ 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

View file

@ -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<T>() where T : Clone { }
| ------------ ----- required by this bound in `assert_clone`
...
LL | assert_clone::<foo::issue_1920::S>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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

View file

@ -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<T: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:
<isize as std::marker::Copy>
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<T: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:
<isize as std::marker::Copy>
error[E0277]: the trait bound `std::boxed::Box<isize>: std::marker::Copy` is not satisfied
--> $DIR/kindck-copy.rs:31:5
--> $DIR/kindck-copy.rs:31:19
|
LL | fn assert_copy<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<Box<isize>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<isize>`
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<isize>`
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<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<String>();
| ^^^^^^^^^^^^^^^^^^^^^ 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<isize>: std::marker::Copy` is not satisfied
--> $DIR/kindck-copy.rs:33:5
--> $DIR/kindck-copy.rs:33:19
|
LL | fn assert_copy<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<Vec<isize> >();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec<isize>`
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec<isize>`
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<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<Box<&'a mut isize>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<dyn Dummy>: std::marker::Copy` is not satisfied
--> $DIR/kindck-copy.rs:42:5
@ -77,31 +83,31 @@ LL | assert_copy::<Box<dyn Dummy + Send>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<dyn Dummy + std::marker::Send>`
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<T: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<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<MyNoncopyStruct>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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<isize>: std::marker::Copy` is not satisfied
--> $DIR/kindck-copy.rs:67:5
--> $DIR/kindck-copy.rs:67:19
|
LL | fn assert_copy<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<Rc<isize>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<isize>`
| ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<isize>`
error: aborting due to 11 previous errors

View file

@ -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<T: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`

View file

@ -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<T: Marker>() { }
| --------- ------ required by this bound in `is_marker`
...
LL | is_marker::<NotDebugOrDisplay>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
error: aborting due to previous error

View file

@ -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_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize {
| ------- ------------------------- required by this bound in `call_it`

View file

@ -1,66 +1,66 @@
error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:8:5
--> $DIR/not-sync.rs:8:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<Cell<i32>>();
| ^^^^^^^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
| ^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell<i32>`
error[E0277]: `std::cell::RefCell<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:10:5
--> $DIR/not-sync.rs:10:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<RefCell<i32>>();
| ^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell<i32>` cannot be shared between threads safely
| ^^^^^^^^^^^^ `std::cell::RefCell<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<i32>`
error[E0277]: `std::rc::Rc<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:13:5
--> $DIR/not-sync.rs:13:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<Rc<i32>>();
| ^^^^^^^^^^^^^^^ `std::rc::Rc<i32>` cannot be shared between threads safely
| ^^^^^^^ `std::rc::Rc<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc<i32>`
error[E0277]: `std::rc::Weak<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:15:5
--> $DIR/not-sync.rs:15:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<Weak<i32>>();
| ^^^^^^^^^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely
| ^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::rc::Weak<i32>`
error[E0277]: `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:18:5
--> $DIR/not-sync.rs:18:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<Receiver<i32>>();
| ^^^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<i32>`
error[E0277]: `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely
--> $DIR/not-sync.rs:20:5
--> $DIR/not-sync.rs:20:12
|
LL | fn test<T: Sync>() {}
| ---- ---- required by this bound in `test`
...
LL | test::<Sender<i32>>();
| ^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely
| ^^^^^^^^^^^ `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<i32>`

View file

@ -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<T: Marker>() { }
| --------- ------ required by this bound in `is_marker`
...
LL | is_marker::<NotDebugOrDisplay>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
error: aborting due to previous error

View file

@ -1,22 +1,22 @@
error[E0277]: `std::rc::Rc<u32>` 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<T: SendSync>() {}
| --------- -------- required by this bound in `use_alias`
...
LL | use_alias::<Rc<u32>>();
| ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<u32>` cannot be sent between threads safely
| ^^^^^^^ `std::rc::Rc<u32>` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `std::rc::Rc<u32>`
error[E0277]: `std::rc::Rc<u32>` 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<T: SendSync>() {}
| --------- -------- required by this bound in `use_alias`
...
LL | use_alias::<Rc<u32>>();
| ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<u32>` cannot be shared between threads safely
| ^^^^^^^ `std::rc::Rc<u32>` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc<u32>`

View file

@ -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::<U>();
| ^^^^^^^^^^^^^^^^^ 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 | <Misc<_> as From<T>>::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
|

View file

@ -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: Try>() -> T {
| ----------------- --- required by this bound in `try_trait_generic`

View file

@ -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<T: MyTrait>() {}
| ---------- ------- required by this bound in `is_mytrait`
...
LL | is_mytrait::<MyS2>();
| ^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `MyS2`
| ^^^^ the trait `MyTrait` is not implemented for `MyS2`
|
= help: the following implementations were found:
<MyS2 as MyTrait>

View file

@ -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<T: Send>() {}
| ------- ---- required by this bound in `is_send`
...
LL | is_send::<MyNotSendable>();
| ^^^^^^^^^^^^^^^^^^^^^^^^ `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`

View file

@ -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<T: Sync>() {}
| ------- ---- required by this bound in `is_sync`
...
LL | is_sync::<MyNotSync>();
| ^^^^^^^^^^^^^^^^^^^^ `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`

View file

@ -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<T: MyTrait>() {}
| ----------- ------- required by this bound in `is_my_trait`
...
LL | is_my_trait::<ThisImplsUnsafeTrait>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait`
| ^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait`
|
= help: the following implementations were found:
<ThisImplsUnsafeTrait as MyTrait>
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<T: MyUnsafeTrait>() {}
| ------------------ ------------- required by this bound in `is_my_unsafe_trait`
...
LL | is_my_unsafe_trait::<ThisImplsTrait>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait`
| ^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait`
|
= help: the following implementations were found:
<ThisImplsTrait as MyUnsafeTrait>

View file

@ -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>()
| ^^^^^^^^^^^^ `T` cannot be sent between threads safely
| ^ `T` cannot be sent between threads safely
...
LL | fn is_send<T:Send>() {
| ------- ---- required by this bound in `is_send`

View file

@ -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<T: Sized>() { }
| --- - required by this bound in `bar`
LL | fn foo<T: ?Sized>() { bar::<T>() }
| ^^^^^^^^ 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 <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>