Add more context to E0599 errors
Point at the intermediary unfullfilled trait bounds.
This commit is contained in:
parent
eaa02f599f
commit
f037d5ca1b
27 changed files with 203 additions and 56 deletions
|
@ -645,8 +645,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
self.tcx.sess,
|
||||
span,
|
||||
E0491,
|
||||
"in type `{}`, reference has a longer lifetime \
|
||||
than the data it references",
|
||||
"in type `{}`, reference has a longer lifetime than the data it references",
|
||||
self.ty_to_string(ty)
|
||||
);
|
||||
note_and_explain_region(
|
||||
|
|
|
@ -1404,15 +1404,40 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||
// `potentially_unsatisfied_predicates`.
|
||||
return ProbeResult::NoMatch;
|
||||
} else {
|
||||
// Some nested subobligation of this predicate
|
||||
// failed.
|
||||
//
|
||||
// FIXME: try to find the exact nested subobligation
|
||||
// and point at it rather than reporting the entire
|
||||
// trait-ref?
|
||||
result = ProbeResult::NoMatch;
|
||||
let trait_ref = self.resolve_vars_if_possible(&trait_ref);
|
||||
possibly_unsatisfied_predicates.push(trait_ref);
|
||||
self.probe(|_| {
|
||||
match self.select_trait_candidate(trait_ref) {
|
||||
Ok(Some(traits::VtableImpl(traits::VtableImplData {
|
||||
nested,
|
||||
..
|
||||
}))) if !nested.is_empty() => {
|
||||
for obligation in nested {
|
||||
// Determine exactly which obligation wasn't met, so
|
||||
// that we can give more context in the error.
|
||||
if !self.predicate_may_hold(&obligation) {
|
||||
result = ProbeResult::NoMatch;
|
||||
if let Some(poly_trait_ref) =
|
||||
obligation.predicate.to_opt_poly_trait_ref()
|
||||
{
|
||||
let trait_ref = poly_trait_ref.clone();
|
||||
let trait_ref = trait_ref.skip_binder();
|
||||
possibly_unsatisfied_predicates
|
||||
.push(*trait_ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
// Some nested subobligation of this predicate
|
||||
// failed.
|
||||
//
|
||||
// FIXME: try to find the exact nested subobligation
|
||||
// and point at it rather than reporting the entire
|
||||
// trait-ref?
|
||||
result = ProbeResult::NoMatch;
|
||||
let trait_ref = self.resolve_vars_if_possible(&trait_ref);
|
||||
possibly_unsatisfied_predicates.push(trait_ref);
|
||||
});
|
||||
}
|
||||
}
|
||||
vec![]
|
||||
|
|
|
@ -394,6 +394,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
tcx.sess.diagnostic().struct_dummy()
|
||||
};
|
||||
|
||||
// FIXME: Unify with unmet bound label.
|
||||
if let Some(def) = actual.ty_adt_def() {
|
||||
if let Some(full_sp) = tcx.hir().span_if_local(def.did) {
|
||||
let def_sp = tcx.sess.source_map().def_span(full_sp);
|
||||
|
@ -535,16 +536,54 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
if !unsatisfied_predicates.is_empty() {
|
||||
let mut bound_spans = vec![];
|
||||
let mut bound_list = unsatisfied_predicates
|
||||
.iter()
|
||||
.map(|p| format!("`{} : {}`", p.self_ty(), p.print_only_trait_path()))
|
||||
.map(|p| {
|
||||
let self_ty = p.self_ty();
|
||||
match &self_ty.kind {
|
||||
ty::Adt(def, _) => bound_spans.push((
|
||||
self.tcx.sess.source_map().def_span(self.tcx.def_span(def.did)),
|
||||
format!(
|
||||
"this type doesn't satisfy the bound `{}`",
|
||||
p.print_only_trait_path()
|
||||
),
|
||||
)),
|
||||
ty::Dynamic(preds, _) => {
|
||||
for pred in *preds.skip_binder() {
|
||||
match pred {
|
||||
ty::ExistentialPredicate::Trait(tr) => bound_spans
|
||||
.push((
|
||||
self.tcx
|
||||
.sess
|
||||
.source_map()
|
||||
.def_span(self.tcx.def_span(tr.def_id)),
|
||||
format!(
|
||||
"this trait doesn't satisfy the bound `{}`",
|
||||
p.print_only_trait_path()
|
||||
),
|
||||
)),
|
||||
ty::ExistentialPredicate::Projection(_)
|
||||
| ty::ExistentialPredicate::AutoTrait(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
format!("`{}: {}`", p.self_ty(), p.print_only_trait_path())
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
bound_list.sort();
|
||||
bound_list.dedup(); // #35677
|
||||
bound_spans.sort();
|
||||
bound_spans.dedup(); // #35677
|
||||
for (span, msg) in bound_spans.into_iter() {
|
||||
err.span_label(span, &msg);
|
||||
}
|
||||
let bound_list = bound_list.join("\n");
|
||||
err.note(&format!(
|
||||
"the method `{}` exists but the following trait bounds \
|
||||
were not satisfied:\n{}",
|
||||
"the method `{}` exists but the following trait bounds were not \
|
||||
satisfied:\n{}",
|
||||
item_name, bound_list
|
||||
));
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
|
|||
| ^^^^^^^^^ associated item not found in `Foo<A, B>`
|
||||
|
|
||||
= note: the method `HOST_SIZE` exists but the following trait bounds were not satisfied:
|
||||
`A : std::marker::Sized`
|
||||
`B : std::marker::Sized`
|
||||
`A: std::marker::Sized`
|
||||
`B: std::marker::Sized`
|
||||
|
||||
error[E0277]: the size for values of type `A` cannot be known at compilation time
|
||||
--> $DIR/too_generic_eval_ice.rs:7:13
|
||||
|
|
|
@ -2,13 +2,20 @@ error[E0599]: no method named `clone` found for struct `Bar<NotClone>` in the cu
|
|||
--> $DIR/derive-assoc-type-not-impl.rs:18:30
|
||||
|
|
||||
LL | struct Bar<T: Foo> {
|
||||
| ------------------ method `clone` not found for this
|
||||
| ------------------
|
||||
| |
|
||||
| method `clone` not found for this
|
||||
| this type doesn't satisfy the bound `std::clone::Clone`
|
||||
...
|
||||
LL | struct NotClone;
|
||||
| ---------------- this type doesn't satisfy the bound `std::clone::Clone`
|
||||
...
|
||||
LL | Bar::<NotClone> { x: 1 }.clone();
|
||||
| ^^^^^ method not found in `Bar<NotClone>`
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`Bar<NotClone> : std::clone::Clone`
|
||||
`Bar<NotClone>: std::clone::Clone`
|
||||
`NotClone: std::clone::Clone`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
candidate #1: `std::clone::Clone`
|
||||
|
|
|
@ -7,7 +7,8 @@ LL | println!("{}", z.to_string());
|
|||
= note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref
|
||||
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior
|
||||
= note: the method `to_string` exists but the following trait bounds were not satisfied:
|
||||
`*const u8 : std::string::ToString`
|
||||
`*const u8: std::fmt::Display`
|
||||
`*const u8: std::string::ToString`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// FIXME: missing sysroot spans (#53081)
|
||||
// ignore-i586-unknown-linux-gnu
|
||||
// ignore-i586-unknown-linux-musl
|
||||
// ignore-i686-unknown-linux-musl
|
||||
use std::vec::IntoIter;
|
||||
|
||||
pub fn get_tok(it: &mut IntoIter<u8>) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0271]: type mismatch resolving `<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as std::iter::Iterator>::Item == &_`
|
||||
--> $DIR/issue-31173.rs:10:10
|
||||
error[E0271]: type mismatch resolving `<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]> as std::iter::Iterator>::Item == &_`
|
||||
--> $DIR/issue-31173.rs:14:10
|
||||
|
|
||||
LL | .cloned()
|
||||
| ^^^^^^ expected `u8`, found reference
|
||||
|
@ -7,15 +7,20 @@ LL | .cloned()
|
|||
= note: expected type `u8`
|
||||
found reference `&_`
|
||||
|
||||
error[E0599]: no method named `collect` found for struct `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope
|
||||
--> $DIR/issue-31173.rs:14:10
|
||||
error[E0599]: no method named `collect` found for struct `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>` in the current scope
|
||||
--> $DIR/issue-31173.rs:18:10
|
||||
|
|
||||
LL | .collect();
|
||||
| ^^^^^^^ method not found in `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>`
|
||||
| ^^^^^^^ method not found in `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>`
|
||||
|
|
||||
::: $SRC_DIR/libcore/iter/adapters/mod.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Cloned<I> {
|
||||
| -------------------- this type doesn't satisfy the bound `std::iter::Iterator`
|
||||
|
|
||||
= note: the method `collect` exists but the following trait bounds were not satisfied:
|
||||
`&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>> : std::iter::Iterator`
|
||||
`std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>> : std::iter::Iterator`
|
||||
`&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>: std::iter::Iterator`
|
||||
`std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>: std::iter::Iterator`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ LL | this.is_subset(other)
|
|||
| ^^^^^^^^^ method not found in `&std::collections::HashSet<T>`
|
||||
|
|
||||
= note: the method `is_subset` exists but the following trait bounds were not satisfied:
|
||||
`T : std::cmp::Eq`
|
||||
`T : std::hash::Hash`
|
||||
`T: std::cmp::Eq`
|
||||
`T: std::hash::Hash`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &Some(42).as_deref();
|
|||
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
|
||||
|
|
||||
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::Deref`
|
||||
`{integer}: std::ops::Deref`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &mut Some(42).as_deref_mut();
|
|||
| ^^^^^^^^^^^^ method not found in `std::option::Option<{integer}>`
|
||||
|
|
||||
= note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::DerefMut`
|
||||
`{integer}: std::ops::DerefMut`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &Ok(42).as_deref();
|
|||
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
|
||||
|
|
||||
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::Deref`
|
||||
`{integer}: std::ops::Deref`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &Err(41).as_deref_err();
|
|||
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut`
|
||||
|
|
||||
= note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::Deref`
|
||||
`{integer}: std::ops::Deref`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &mut Ok(42).as_deref_mut();
|
|||
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
|
||||
|
|
||||
= note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::DerefMut`
|
||||
`{integer}: std::ops::DerefMut`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let _result = &mut Err(41).as_deref_mut_err();
|
|||
| ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut`
|
||||
|
|
||||
= note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
|
||||
`{integer} : std::ops::DerefMut`
|
||||
`{integer}: std::ops::DerefMut`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -35,13 +35,17 @@ error[E0599]: no method named `take` found for struct `Foo` in the current scope
|
|||
--> $DIR/method-call-err-msg.rs:19:7
|
||||
|
|
||||
LL | pub struct Foo;
|
||||
| --------------- method `take` not found for this
|
||||
| ---------------
|
||||
| |
|
||||
| method `take` not found for this
|
||||
| this type doesn't satisfy the bound `std::iter::Iterator`
|
||||
...
|
||||
LL | .take()
|
||||
| ^^^^ method not found in `Foo`
|
||||
|
|
||||
= note: the method `take` exists but the following trait bounds were not satisfied:
|
||||
`&mut Foo : std::iter::Iterator`
|
||||
`&mut Foo: std::iter::Iterator`
|
||||
`Foo: std::iter::Iterator`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following traits define an item `take`, perhaps you need to implement one of them:
|
||||
candidate #1: `std::io::Read`
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// FIXME: missing sysroot spans (#53081)
|
||||
// ignore-i586-unknown-linux-gnu
|
||||
// ignore-i586-unknown-linux-musl
|
||||
// ignore-i686-unknown-linux-musl
|
||||
// Regression test for #36053. ICE was caused due to obligations
|
||||
// being added to a special, dedicated fulfillment cx during
|
||||
// a probe.
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
error[E0599]: no method named `count` found for struct `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>` in the current scope
|
||||
--> $DIR/issue-36053-2.rs:7:55
|
||||
error[E0599]: no method named `count` found for struct `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>` in the current scope
|
||||
--> $DIR/issue-36053-2.rs:11:55
|
||||
|
|
||||
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
|
||||
| ^^^^^ method not found in `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>`
|
||||
| ^^^^^ method not found in `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>`
|
||||
|
|
||||
::: $SRC_DIR/libcore/iter/adapters/mod.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Filter<I, P> {
|
||||
| ----------------------- this type doesn't satisfy the bound `std::iter::Iterator`
|
||||
|
|
||||
= note: the method `count` exists but the following trait bounds were not satisfied:
|
||||
`&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]> : std::iter::Iterator`
|
||||
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]> : std::iter::Iterator`
|
||||
`&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
|
||||
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&_,)>`
|
||||
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
|
||||
|
||||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/issue-36053-2.rs:7:32
|
||||
--> $DIR/issue-36053-2.rs:11:32
|
||||
|
|
||||
LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
|
||||
| ^^^^^^ -------------- found signature of `for<'r> fn(&'r str) -> _`
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
error[E0599]: no method named `unwrap` found for enum `std::result::Result<(), Foo>` in the current scope
|
||||
--> $DIR/method-help-unsatisfied-bound.rs:5:7
|
||||
|
|
||||
LL | struct Foo;
|
||||
| ----------- this type doesn't satisfy the bound `std::fmt::Debug`
|
||||
...
|
||||
LL | a.unwrap();
|
||||
| ^^^^^^ method not found in `std::result::Result<(), Foo>`
|
||||
|
|
||||
= note: the method `unwrap` exists but the following trait bounds were not satisfied:
|
||||
`Foo : std::fmt::Debug`
|
||||
`Foo: std::fmt::Debug`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,13 +2,16 @@ error[E0599]: no method named `foo_one` found for struct `MyStruct` in the curre
|
|||
--> $DIR/specialization-trait-not-implemented.rs:22:29
|
||||
|
|
||||
LL | struct MyStruct;
|
||||
| ---------------- method `foo_one` not found for this
|
||||
| ----------------
|
||||
| |
|
||||
| method `foo_one` not found for this
|
||||
| this type doesn't satisfy the bound `Foo`
|
||||
...
|
||||
LL | println!("{}", MyStruct.foo_one());
|
||||
| ^^^^^^^ method not found in `MyStruct`
|
||||
|
|
||||
= note: the method `foo_one` exists but the following trait bounds were not satisfied:
|
||||
`MyStruct : Foo`
|
||||
`MyStruct: Foo`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `foo_one`, perhaps you need to implement it:
|
||||
candidate #1: `Foo`
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// FIXME: missing sysroot spans (#53081)
|
||||
// ignore-i586-unknown-linux-gnu
|
||||
// ignore-i586-unknown-linux-musl
|
||||
// ignore-i686-unknown-linux-musl
|
||||
use std::env::args;
|
||||
use std::fs::File;
|
||||
use std::io::{stdout, Write, BufWriter};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:17:29
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:21:29
|
||||
|
|
||||
LL | let fp = BufWriter::new(fp);
|
||||
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
||||
|
@ -8,7 +8,7 @@ LL | let fp = BufWriter::new(fp);
|
|||
= note: required by `std::io::BufWriter::<W>::new`
|
||||
|
||||
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:21:14
|
||||
|
|
||||
LL | let fp = BufWriter::new(fp);
|
||||
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
||||
|
@ -17,7 +17,7 @@ LL | let fp = BufWriter::new(fp);
|
|||
= note: required by `std::io::BufWriter`
|
||||
|
||||
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:21:14
|
||||
|
|
||||
LL | let fp = BufWriter::new(fp);
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
||||
|
@ -26,13 +26,19 @@ LL | let fp = BufWriter::new(fp);
|
|||
= note: required by `std::io::BufWriter`
|
||||
|
||||
error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:22:5
|
||||
--> $DIR/mut-borrow-needed-by-trait.rs:26:5
|
||||
|
|
||||
LL | writeln!(fp, "hello world").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `std::io::BufWriter<&dyn std::io::Write>`
|
||||
|
|
||||
::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
|
||||
|
|
||||
LL | pub struct BufWriter<W: Write> {
|
||||
| ------------------------------ this type doesn't satisfy the bound `std::io::Write`
|
||||
|
|
||||
= note: the method `write_fmt` exists but the following trait bounds were not satisfied:
|
||||
`std::io::BufWriter<&dyn std::io::Write> : std::io::Write`
|
||||
`&dyn std::io::Write: std::io::Write`
|
||||
`std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
|
@ -11,13 +11,20 @@ error[E0599]: no method named `clone` found for union `U5<CloneNoCopy>` in the c
|
|||
--> $DIR/union-derive-clone.rs:37:15
|
||||
|
|
||||
LL | union U5<T> {
|
||||
| ----------- method `clone` not found for this
|
||||
| -----------
|
||||
| |
|
||||
| method `clone` not found for this
|
||||
| this type doesn't satisfy the bound `std::clone::Clone`
|
||||
...
|
||||
LL | struct CloneNoCopy;
|
||||
| ------------------- this type doesn't satisfy the bound `std::marker::Copy`
|
||||
...
|
||||
LL | let w = u.clone();
|
||||
| ^^^^^ method not found in `U5<CloneNoCopy>`
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`U5<CloneNoCopy> : std::clone::Clone`
|
||||
`CloneNoCopy: std::marker::Copy`
|
||||
`U5<CloneNoCopy>: std::clone::Clone`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
candidate #1: `std::clone::Clone`
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// FIXME: missing sysroot spans (#53081)
|
||||
// ignore-i586-unknown-linux-gnu
|
||||
// ignore-i586-unknown-linux-musl
|
||||
// ignore-i686-unknown-linux-musl
|
||||
#![feature(box_syntax)]
|
||||
|
||||
trait Foo {
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
error[E0599]: no method named `clone` found for struct `std::boxed::Box<dyn Foo>` in the current scope
|
||||
--> $DIR/unique-object-noncopyable.rs:24:16
|
||||
--> $DIR/unique-object-noncopyable.rs:28:16
|
||||
|
|
||||
LL | trait Foo {
|
||||
| ---------
|
||||
| |
|
||||
| this trait doesn't satisfy the bound `std::clone::Clone`
|
||||
| this trait doesn't satisfy the bound `std::marker::Sized`
|
||||
...
|
||||
LL | let _z = y.clone();
|
||||
| ^^^^^ method not found in `std::boxed::Box<dyn Foo>`
|
||||
|
|
||||
::: $SRC_DIR/liballoc/boxed.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Box<T: ?Sized>(Unique<T>);
|
||||
| ------------------------------------- this type doesn't satisfy the bound `std::clone::Clone`
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`std::boxed::Box<dyn Foo> : std::clone::Clone`
|
||||
`dyn Foo: std::clone::Clone`
|
||||
`dyn Foo: std::marker::Sized`
|
||||
`std::boxed::Box<dyn Foo>: std::clone::Clone`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
candidate #1: `std::clone::Clone`
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// FIXME: missing sysroot spans (#53081)
|
||||
// ignore-i586-unknown-linux-gnu
|
||||
// ignore-i586-unknown-linux-musl
|
||||
// ignore-i686-unknown-linux-musl
|
||||
#[derive(Debug)]
|
||||
struct R {
|
||||
b: bool,
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
error[E0599]: no method named `clone` found for struct `std::boxed::Box<R>` in the current scope
|
||||
--> $DIR/unique-pinned-nocopy.rs:12:16
|
||||
--> $DIR/unique-pinned-nocopy.rs:16:16
|
||||
|
|
||||
LL | struct R {
|
||||
| -------- this type doesn't satisfy the bound `std::clone::Clone`
|
||||
...
|
||||
LL | let _j = i.clone();
|
||||
| ^^^^^ method not found in `std::boxed::Box<R>`
|
||||
|
|
||||
::: $SRC_DIR/liballoc/boxed.rs:LL:COL
|
||||
|
|
||||
LL | pub struct Box<T: ?Sized>(Unique<T>);
|
||||
| ------------------------------------- this type doesn't satisfy the bound `std::clone::Clone`
|
||||
|
|
||||
= note: the method `clone` exists but the following trait bounds were not satisfied:
|
||||
`std::boxed::Box<R> : std::clone::Clone`
|
||||
`R: std::clone::Clone`
|
||||
`std::boxed::Box<R>: std::clone::Clone`
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `clone`, perhaps you need to implement it:
|
||||
candidate #1: `std::clone::Clone`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue