Track implicit Sized obligations in type params

Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting
the HIR Generics. (Fix #98539)
This commit is contained in:
Esteban Küber 2022-07-01 16:47:26 -07:00
parent d5642acfe6
commit af10a456c1
59 changed files with 213 additions and 124 deletions

View file

@ -348,9 +348,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let type_param = generics.type_param(param_type, self.tcx); let type_param = generics.type_param(param_type, self.tcx);
Some(self.tcx.def_span(type_param.def_id)) Some(self.tcx.def_span(type_param.def_id))
} }
ty::Adt(def, _) if def.did().is_local() => { ty::Adt(def, _) if def.did().is_local() => Some(tcx.def_span(def.did())),
tcx.def_ident_span(def.did()).map(|span| span)
}
_ => None, _ => None,
}; };
@ -621,12 +619,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Find all the requirements that come from a local `impl` block. // Find all the requirements that come from a local `impl` block.
let mut skip_list: FxHashSet<_> = Default::default(); let mut skip_list: FxHashSet<_> = Default::default();
let mut spanned_predicates: FxHashMap<MultiSpan, _> = Default::default(); let mut spanned_predicates: FxHashMap<MultiSpan, _> = Default::default();
for (data, p, parent_p, impl_def_id, cause_span) in unsatisfied_predicates for (data, p, parent_p, impl_def_id, cause) in unsatisfied_predicates
.iter() .iter()
.filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c))) .filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c)))
.filter_map(|(p, parent, c)| match c.code() { .filter_map(|(p, parent, c)| match c.code() {
ObligationCauseCode::ImplDerivedObligation(ref data) => { ObligationCauseCode::ImplDerivedObligation(ref data) => {
Some((&data.derived, p, parent, data.impl_def_id, data.span)) Some((&data.derived, p, parent, data.impl_def_id, data))
} }
_ => None, _ => None,
}) })
@ -695,9 +693,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let _ = format_pred(*pred); let _ = format_pred(*pred);
} }
skip_list.insert(p); skip_list.insert(p);
let mut spans = if cause_span != *item_span { let mut spans = if cause.span != *item_span {
let mut spans: MultiSpan = cause_span.into(); let mut spans: MultiSpan = cause.span.into();
spans.push_span_label(cause_span, unsatisfied_msg); spans.push_span_label(cause.span, unsatisfied_msg);
spans spans
} else { } else {
ident.span.into() ident.span.into()
@ -709,7 +707,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Unmet obligation coming from an `impl`. // Unmet obligation coming from an `impl`.
Some(Node::Item(hir::Item { Some(Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }), kind:
hir::ItemKind::Impl(hir::Impl {
of_trait, self_ty, generics, ..
}),
span: item_span, span: item_span,
.. ..
})) if !matches!( })) if !matches!(
@ -725,14 +726,40 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
Some(ExpnKind::Macro(MacroKind::Derive, _)) Some(ExpnKind::Macro(MacroKind::Derive, _))
) => ) =>
{ {
let sized_pred =
unsatisfied_predicates.iter().any(|(pred, _, _)| {
match pred.kind().skip_binder() {
ty::PredicateKind::Trait(pred) => {
Some(pred.def_id())
== self.tcx.lang_items().sized_trait()
&& pred.polarity == ty::ImplPolarity::Positive
}
_ => false,
}
});
for param in generics.params {
if param.span == cause.span && sized_pred {
let (sp, sugg) = match param.colon_span {
Some(sp) => (sp.shrink_to_hi(), " ?Sized +"),
None => (param.span.shrink_to_hi(), ": ?Sized"),
};
err.span_suggestion_verbose(
sp,
"consider relaxing the type parameter's implicit \
`Sized` bound",
sugg,
Applicability::MachineApplicable,
);
}
}
if let Some(pred) = parent_p { if let Some(pred) = parent_p {
// Done to add the "doesn't satisfy" `span_label`. // Done to add the "doesn't satisfy" `span_label`.
let _ = format_pred(*pred); let _ = format_pred(*pred);
} }
skip_list.insert(p); skip_list.insert(p);
let mut spans = if cause_span != *item_span { let mut spans = if cause.span != *item_span {
let mut spans: MultiSpan = cause_span.into(); let mut spans: MultiSpan = cause.span.into();
spans.push_span_label(cause_span, unsatisfied_msg); spans.push_span_label(cause.span, unsatisfied_msg);
spans spans
} else { } else {
let mut spans = Vec::with_capacity(2); let mut spans = Vec::with_capacity(2);

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `mispellable` found for enum `
--> $DIR/associated-item-enum.rs:17:11 --> $DIR/associated-item-enum.rs:17:11
| |
LL | enum Enum { Variant } LL | enum Enum { Variant }
| ---- variant or associated item `mispellable` not found for this enum | --------- variant or associated item `mispellable` not found for this enum
... ...
LL | Enum::mispellable(); LL | Enum::mispellable();
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -14,7 +14,7 @@ error[E0599]: no variant or associated item named `mispellable_trait` found for
--> $DIR/associated-item-enum.rs:18:11 --> $DIR/associated-item-enum.rs:18:11
| |
LL | enum Enum { Variant } LL | enum Enum { Variant }
| ---- variant or associated item `mispellable_trait` not found for this enum | --------- variant or associated item `mispellable_trait` not found for this enum
... ...
LL | Enum::mispellable_trait(); LL | Enum::mispellable_trait();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
@ -26,7 +26,7 @@ error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `
--> $DIR/associated-item-enum.rs:19:11 --> $DIR/associated-item-enum.rs:19:11
| |
LL | enum Enum { Variant } LL | enum Enum { Variant }
| ---- variant or associated item `MISPELLABLE` not found for this enum | --------- variant or associated item `MISPELLABLE` not found for this enum
... ...
LL | Enum::MISPELLABLE; LL | Enum::MISPELLABLE;
| ^^^^^^^^^^^ | ^^^^^^^^^^^

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `poll` found for struct `Sleep` in the current sco
--> $DIR/pin-needed-to-poll.rs:42:20 --> $DIR/pin-needed-to-poll.rs:42:20
| |
LL | struct Sleep; LL | struct Sleep;
| ----- method `poll` not found for this struct | ------------ method `poll` not found for this struct
... ...
LL | self.sleep.poll(cx) LL | self.sleep.poll(cx)
| ^^^^ method not found in `Sleep` | ^^^^ method not found in `Sleep`

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `Hsl` found for enum `Color` i
--> $DIR/bogus-tag.rs:7:16 --> $DIR/bogus-tag.rs:7:16
| |
LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
| ----- variant or associated item `Hsl` not found for this enum | ---------- variant or associated item `Hsl` not found for this enum
... ...
LL | Color::Hsl(h, s, l) => { println!("hsl"); } LL | Color::Hsl(h, s, l) => { println!("hsl"); }
| ^^^ variant or associated item not found in `Color` | ^^^ variant or associated item not found in `Color`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `closure` found for struct `Obj` in the current sc
--> $DIR/issue-18343.rs:7:7 --> $DIR/issue-18343.rs:7:7
| |
LL | struct Obj<F> where F: FnMut() -> u32 { LL | struct Obj<F> where F: FnMut() -> u32 {
| --- method `closure` not found for this struct | ------------- method `closure` not found for this struct
... ...
LL | o.closure(); LL | o.closure();
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `closure` found for struct `Obj` in the current sc
--> $DIR/issue-2392.rs:36:15 --> $DIR/issue-2392.rs:36:15
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `closure` not found for this struct | ------------- method `closure` not found for this struct
... ...
LL | o_closure.closure(); LL | o_closure.closure();
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method
@ -16,7 +16,7 @@ error[E0599]: no method named `not_closure` found for struct `Obj` in the curren
--> $DIR/issue-2392.rs:38:15 --> $DIR/issue-2392.rs:38:15
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `not_closure` not found for this struct | ------------- method `not_closure` not found for this struct
... ...
LL | o_closure.not_closure(); LL | o_closure.not_closure();
| ^^^^^^^^^^^-- help: remove the arguments | ^^^^^^^^^^^-- help: remove the arguments
@ -27,7 +27,7 @@ error[E0599]: no method named `closure` found for struct `Obj` in the current sc
--> $DIR/issue-2392.rs:42:12 --> $DIR/issue-2392.rs:42:12
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `closure` not found for this struct | ------------- method `closure` not found for this struct
... ...
LL | o_func.closure(); LL | o_func.closure();
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method
@ -41,7 +41,7 @@ error[E0599]: no method named `boxed_closure` found for struct `BoxedObj` in the
--> $DIR/issue-2392.rs:45:14 --> $DIR/issue-2392.rs:45:14
| |
LL | struct BoxedObj { LL | struct BoxedObj {
| -------- method `boxed_closure` not found for this struct | --------------- method `boxed_closure` not found for this struct
... ...
LL | boxed_fn.boxed_closure(); LL | boxed_fn.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method | ^^^^^^^^^^^^^ field, not a method
@ -55,7 +55,7 @@ error[E0599]: no method named `boxed_closure` found for struct `BoxedObj` in the
--> $DIR/issue-2392.rs:48:19 --> $DIR/issue-2392.rs:48:19
| |
LL | struct BoxedObj { LL | struct BoxedObj {
| -------- method `boxed_closure` not found for this struct | --------------- method `boxed_closure` not found for this struct
... ...
LL | boxed_closure.boxed_closure(); LL | boxed_closure.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method | ^^^^^^^^^^^^^ field, not a method
@ -69,7 +69,7 @@ error[E0599]: no method named `closure` found for struct `Obj` in the current sc
--> $DIR/issue-2392.rs:53:12 --> $DIR/issue-2392.rs:53:12
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `closure` not found for this struct | ------------- method `closure` not found for this struct
... ...
LL | w.wrap.closure(); LL | w.wrap.closure();
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method
@ -83,7 +83,7 @@ error[E0599]: no method named `not_closure` found for struct `Obj` in the curren
--> $DIR/issue-2392.rs:55:12 --> $DIR/issue-2392.rs:55:12
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `not_closure` not found for this struct | ------------- method `not_closure` not found for this struct
... ...
LL | w.wrap.not_closure(); LL | w.wrap.not_closure();
| ^^^^^^^^^^^-- help: remove the arguments | ^^^^^^^^^^^-- help: remove the arguments
@ -94,7 +94,7 @@ error[E0599]: no method named `closure` found for struct `Obj` in the current sc
--> $DIR/issue-2392.rs:58:24 --> $DIR/issue-2392.rs:58:24
| |
LL | struct Obj<F> where F: FnOnce() -> u32 { LL | struct Obj<F> where F: FnOnce() -> u32 {
| --- method `closure` not found for this struct | ------------- method `closure` not found for this struct
... ...
LL | check_expression().closure(); LL | check_expression().closure();
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method
@ -108,7 +108,7 @@ error[E0599]: no method named `f1` found for struct `FuncContainer` in the curre
--> $DIR/issue-2392.rs:64:31 --> $DIR/issue-2392.rs:64:31
| |
LL | struct FuncContainer { LL | struct FuncContainer {
| ------------- method `f1` not found for this struct | -------------------- method `f1` not found for this struct
... ...
LL | (*self.container).f1(1); LL | (*self.container).f1(1);
| ^^ field, not a method | ^^ field, not a method
@ -122,7 +122,7 @@ error[E0599]: no method named `f2` found for struct `FuncContainer` in the curre
--> $DIR/issue-2392.rs:65:31 --> $DIR/issue-2392.rs:65:31
| |
LL | struct FuncContainer { LL | struct FuncContainer {
| ------------- method `f2` not found for this struct | -------------------- method `f2` not found for this struct
... ...
LL | (*self.container).f2(1); LL | (*self.container).f2(1);
| ^^ field, not a method | ^^ field, not a method
@ -136,7 +136,7 @@ error[E0599]: no method named `f3` found for struct `FuncContainer` in the curre
--> $DIR/issue-2392.rs:66:31 --> $DIR/issue-2392.rs:66:31
| |
LL | struct FuncContainer { LL | struct FuncContainer {
| ------------- method `f3` not found for this struct | -------------------- method `f3` not found for this struct
... ...
LL | (*self.container).f3(1); LL | (*self.container).f3(1);
| ^^ field, not a method | ^^ field, not a method

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `example` found for struct `Example` in the curren
--> $DIR/issue-32128.rs:12:10 --> $DIR/issue-32128.rs:12:10
| |
LL | struct Example { LL | struct Example {
| ------- method `example` not found for this struct | -------------- method `example` not found for this struct
... ...
LL | demo.example(1); LL | demo.example(1);
| ^^^^^^^ field, not a method | ^^^^^^^ field, not a method

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `dog_age` found for struct `Dog` in the current sc
--> $DIR/private-field.rs:16:23 --> $DIR/private-field.rs:16:23
| |
LL | pub struct Dog { LL | pub struct Dog {
| --- method `dog_age` not found for this struct | -------------- method `dog_age` not found for this struct
... ...
LL | let dog_age = dog.dog_age(); LL | let dog_age = dog.dog_age();
| ^^^^^^^ private field, not a method | ^^^^^^^ private field, not a method

View file

@ -8,7 +8,7 @@ error[E0599]: the function or associated item `foo` exists for struct `Foo<{_: u
--> $DIR/issue-69654.rs:17:10 --> $DIR/issue-69654.rs:17:10
| |
LL | struct Foo<const N: usize> {} LL | struct Foo<const N: usize> {}
| --- function or associated item `foo` not found for this struct | -------------------------- function or associated item `foo` not found for this struct
... ...
LL | Foo::foo(); LL | Foo::foo();
| ^^^ function or associated item cannot be called on `Foo<{_: usize}>` due to unsatisfied trait bounds | ^^^ function or associated item cannot be called on `Foo<{_: usize}>` due to unsatisfied trait bounds

View file

@ -16,7 +16,7 @@ error[E0599]: the function or associated item `new` exists for struct `Inline<dy
--> $DIR/issue-80742.rs:30:36 --> $DIR/issue-80742.rs:30:36
| |
LL | struct Inline<T> LL | struct Inline<T>
| ------ function or associated item `new` not found for this struct | ---------------- function or associated item `new` not found for this struct
... ...
LL | let dst = Inline::<dyn Debug>::new(0); LL | let dst = Inline::<dyn Debug>::new(0);
| ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds | ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds

View file

@ -16,7 +16,7 @@ error[E0599]: no method named `f` found for struct `S` in the current scope
--> $DIR/invalid-const-arg-for-type-param.rs:9:7 --> $DIR/invalid-const-arg-for-type-param.rs:9:7
| |
LL | struct S; LL | struct S;
| - method `f` not found for this struct | -------- method `f` not found for this struct
... ...
LL | S.f::<0>(); LL | S.f::<0>();
| ^ method not found in `S` | ^ method not found in `S`

View file

@ -2,7 +2,7 @@ error[E0599]: no function or associated item named `assert` found for struct `Bo
--> $DIR/const-needs_drop-monomorphic.rs:11:46 --> $DIR/const-needs_drop-monomorphic.rs:11:46
| |
LL | struct Bool<const B: bool> {} LL | struct Bool<const B: bool> {}
| ---- function or associated item `assert` not found for this struct | -------------------------- function or associated item `assert` not found for this struct
... ...
LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert(); LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert();
| ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::<T>() }>` due to unsatisfied trait bounds | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::<T>() }>` due to unsatisfied trait bounds

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `clone` found for struct `Foo` in the current scop
--> $DIR/copy-a-resource.rs:18:16 --> $DIR/copy-a-resource.rs:18:16
| |
LL | struct Foo { LL | struct Foo {
| --- method `clone` not found for this struct | ---------- method `clone` not found for this struct
... ...
LL | let _y = x.clone(); LL | let _y = x.clone();
| ^^^^^ method not found in `Foo` | ^^^^^ method not found in `Foo`

View file

@ -3,8 +3,8 @@ error[E0599]: the method `clone` exists for struct `Bar<NotClone>`, but its trai
| |
LL | struct Bar<T: Foo> { LL | struct Bar<T: Foo> {
| ------------------ | ------------------
| | | | |
| | method `clone` not found for this struct | method `clone` not found for this struct
| doesn't satisfy `Bar<NotClone>: Clone` | doesn't satisfy `Bar<NotClone>: Clone`
... ...
LL | struct NotClone; LL | struct NotClone;

View file

@ -37,7 +37,7 @@ LL | pub struct NoDerives;
| -------------------- doesn't satisfy `NoDerives: Clone` | -------------------- doesn't satisfy `NoDerives: Clone`
... ...
LL | struct Object<T, A>(T, A); LL | struct Object<T, A>(T, A);
| ------ method `use_clone` not found for this struct | ------------------- method `use_clone` not found for this struct
... ...
LL | foo.use_clone(); LL | foo.use_clone();
| ^^^^^^^^^ method cannot be called on `Object<NoDerives, SomeDerives>` due to unsatisfied trait bounds | ^^^^^^^^^ method cannot be called on `Object<NoDerives, SomeDerives>` due to unsatisfied trait bounds

View file

@ -25,7 +25,7 @@ LL | pub struct NoDerives;
| -------------------- doesn't satisfy `NoDerives: Eq` | -------------------- doesn't satisfy `NoDerives: Eq`
LL | LL |
LL | struct Object<T>(T); LL | struct Object<T>(T);
| ------ method `use_eq` not found for this struct | ---------------- method `use_eq` not found for this struct
... ...
LL | foo.use_eq(); LL | foo.use_eq();
| ^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds | ^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds
@ -44,7 +44,7 @@ LL | pub struct NoDerives;
| -------------------- doesn't satisfy `NoDerives: Ord` | -------------------- doesn't satisfy `NoDerives: Ord`
LL | LL |
LL | struct Object<T>(T); LL | struct Object<T>(T);
| ------ method `use_ord` not found for this struct | ---------------- method `use_ord` not found for this struct
... ...
LL | foo.use_ord(); LL | foo.use_ord();
| ^^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds | ^^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds
@ -66,7 +66,7 @@ LL | pub struct NoDerives;
| doesn't satisfy `NoDerives: PartialOrd` | doesn't satisfy `NoDerives: PartialOrd`
LL | LL |
LL | struct Object<T>(T); LL | struct Object<T>(T);
| ------ method `use_ord_and_partial_ord` not found for this struct | ---------------- method `use_ord_and_partial_ord` not found for this struct
... ...
LL | foo.use_ord_and_partial_ord(); LL | foo.use_ord_and_partial_ord();
| ^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds | ^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `Object<NoDerives>` due to unsatisfied trait bounds

View file

@ -88,7 +88,7 @@ error[E0599]: no method named `hello_method` found for struct `S` in the current
--> $DIR/issue-40006.rs:38:7 --> $DIR/issue-40006.rs:38:7
| |
LL | struct S; LL | struct S;
| - method `hello_method` not found for this struct | -------- method `hello_method` not found for this struct
... ...
LL | S.hello_method(); LL | S.hello_method();
| ^^^^^^^^^^^^ method not found in `S` | ^^^^^^^^^^^^ method not found in `S`

View file

@ -2,7 +2,7 @@ error[E0599]: no function or associated item named `new` found for struct `T` in
--> $DIR/dont-suggest-private-trait-method.rs:4:8 --> $DIR/dont-suggest-private-trait-method.rs:4:8
| |
LL | struct T; LL | struct T;
| - function or associated item `new` not found for this struct | -------- function or associated item `new` not found for this struct
... ...
LL | T::new(); LL | T::new();
| ^^^ function or associated item not found in `T` | ^^^ function or associated item not found in `T`

View file

@ -2,7 +2,7 @@ error[E0599]: no associated item named `NotEvenReal` found for struct `Foo` in t
--> $DIR/E0599.rs:4:20 --> $DIR/E0599.rs:4:20
| |
LL | struct Foo; LL | struct Foo;
| --- associated item `NotEvenReal` not found for this struct | ---------- associated item `NotEvenReal` not found for this struct
... ...
LL | || if let Foo::NotEvenReal() = Foo {}; LL | || if let Foo::NotEvenReal() = Foo {};
| ^^^^^^^^^^^ associated item not found in `Foo` | ^^^^^^^^^^^ associated item not found in `Foo`

View file

@ -3,8 +3,8 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were no
| |
LL | struct S; LL | struct S;
| -------- | --------
| | | | |
| | method `f` not found for this struct | method `f` not found for this struct
| doesn't satisfy `<S as X>::Y<i32> = i32` | doesn't satisfy `<S as X>::Y<i32> = i32`
| doesn't satisfy `S: M` | doesn't satisfy `S: M`
... ...

View file

@ -3,8 +3,8 @@ error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/
| |
LL | pub struct Map<S, F> { LL | pub struct Map<S, F> {
| -------------------- | --------------------
| | | | |
| | method `filterx` not found for this struct | method `filterx` not found for this struct
| doesn't satisfy `_: StreamExt` | doesn't satisfy `_: StreamExt`
... ...
LL | let filter = map.filterx(|x: &_| true); LL | let filter = map.filterx(|x: &_| true);
@ -28,8 +28,8 @@ error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r>
| |
LL | pub struct Filter<S, F> { LL | pub struct Filter<S, F> {
| ----------------------- | -----------------------
| | | | |
| | method `countx` not found for this struct | method `countx` not found for this struct
| doesn't satisfy `_: StreamExt` | doesn't satisfy `_: StreamExt`
... ...
LL | let count = filter.countx(); LL | let count = filter.countx();

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `foo` found for struct `Bar` in the current scope
--> $DIR/issue-21659-show-relevant-trait-impls-3.rs:20:8 --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:20:8
| |
LL | struct Bar; LL | struct Bar;
| --- method `foo` not found for this struct | ---------- method `foo` not found for this struct
... ...
LL | f1.foo(1usize); LL | f1.foo(1usize);
| ^^^ method not found in `Bar` | ^^^ method not found in `Bar`

View file

@ -21,7 +21,7 @@ LL | pub struct RawImpl<T>(PhantomData<T>);
| --------------------- doesn't satisfy `RawImpl<()>: Raw<()>` | --------------------- doesn't satisfy `RawImpl<()>: Raw<()>`
... ...
LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
| -------- function or associated item `foo` not found for this struct | ----------------------------------------- function or associated item `foo` not found for this struct
| |
= note: the following trait bounds were not satisfied: = note: the following trait bounds were not satisfied:
`RawImpl<()>: Raw<()>` `RawImpl<()>: Raw<()>`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `is_empty` found for struct `Foo` in the current s
--> $DIR/method-suggestion-no-duplication.rs:7:15 --> $DIR/method-suggestion-no-duplication.rs:7:15
| |
LL | struct Foo; LL | struct Foo;
| --- method `is_empty` not found for this struct | ---------- method `is_empty` not found for this struct
... ...
LL | foo(|s| s.is_empty()); LL | foo(|s| s.is_empty());
| ^^^^^^^^ method not found in `Foo` | ^^^^^^^^ method not found in `Foo`

View file

@ -94,7 +94,7 @@ error[E0599]: no method named `method` found for struct `Foo` in the current sco
--> $DIR/no-method-suggested-traits.rs:40:9 --> $DIR/no-method-suggested-traits.rs:40:9
| |
LL | struct Foo; LL | struct Foo;
| --- method `method` not found for this struct | ---------- method `method` not found for this struct
... ...
LL | Foo.method(); LL | Foo.method();
| ^^^^^^ method not found in `Foo` | ^^^^^^ method not found in `Foo`
@ -201,7 +201,7 @@ error[E0599]: no method named `method3` found for struct `Foo` in the current sc
--> $DIR/no-method-suggested-traits.rs:59:9 --> $DIR/no-method-suggested-traits.rs:59:9
| |
LL | struct Foo; LL | struct Foo;
| --- method `method3` not found for this struct | ---------- method `method3` not found for this struct
... ...
LL | Foo.method3(); LL | Foo.method3();
| ^^^^^^^ method not found in `Foo` | ^^^^^^^ method not found in `Foo`
@ -224,7 +224,7 @@ error[E0599]: no method named `method3` found for enum `Bar` in the current scop
--> $DIR/no-method-suggested-traits.rs:63:12 --> $DIR/no-method-suggested-traits.rs:63:12
| |
LL | enum Bar { X } LL | enum Bar { X }
| --- method `method3` not found for this enum | -------- method `method3` not found for this enum
... ...
LL | Bar::X.method3(); LL | Bar::X.method3();
| ^^^^^^^ method not found in `Bar` | ^^^^^^^ method not found in `Bar`

View file

@ -43,7 +43,7 @@ error[E0599]: no method named `bar` found for struct `Foo` in the current scope
--> $DIR/infinite-autoderef.rs:25:9 --> $DIR/infinite-autoderef.rs:25:9
| |
LL | struct Foo; LL | struct Foo;
| --- method `bar` not found for this struct | ---------- method `bar` not found for this struct
... ...
LL | Foo.bar(); LL | Foo.bar();
| ^^^ method not found in `Foo` | ^^^ method not found in `Foo`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `kaname` found for struct `Homura` in the current
--> $DIR/issue-19692.rs:4:40 --> $DIR/issue-19692.rs:4:40
| |
LL | struct Homura; LL | struct Homura;
| ------ method `kaname` not found for this struct | ------------- method `kaname` not found for this struct
... ...
LL | let Some(ref madoka) = Some(homura.kaname()); LL | let Some(ref madoka) = Some(homura.kaname());
| ^^^^^^ method not found in `Homura` | ^^^^^^ method not found in `Homura`

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `PIE` found for enum `Deliciou
--> $DIR/issue-22933-2.rs:4:55 --> $DIR/issue-22933-2.rs:4:55
| |
LL | enum Delicious { LL | enum Delicious {
| --------- variant or associated item `PIE` not found for this enum | -------------- variant or associated item `PIE` not found for this enum
... ...
LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
| ^^^ | ^^^

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `Homura` found for enum `Token
--> $DIR/issue-23173.rs:9:23 --> $DIR/issue-23173.rs:9:23
| |
LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ }
| ----- variant or associated item `Homura` not found for this enum | ---------- variant or associated item `Homura` not found for this enum
... ...
LL | use_token(&Token::Homura); LL | use_token(&Token::Homura);
| ^^^^^^ variant or associated item not found in `Token` | ^^^^^^ variant or associated item not found in `Token`
@ -11,7 +11,7 @@ error[E0599]: no function or associated item named `method` found for struct `St
--> $DIR/issue-23173.rs:10:13 --> $DIR/issue-23173.rs:10:13
| |
LL | struct Struct { LL | struct Struct {
| ------ function or associated item `method` not found for this struct | ------------- function or associated item `method` not found for this struct
... ...
LL | Struct::method(); LL | Struct::method();
| ^^^^^^ function or associated item not found in `Struct` | ^^^^^^ function or associated item not found in `Struct`
@ -20,7 +20,7 @@ error[E0599]: no function or associated item named `method` found for struct `St
--> $DIR/issue-23173.rs:11:13 --> $DIR/issue-23173.rs:11:13
| |
LL | struct Struct { LL | struct Struct {
| ------ function or associated item `method` not found for this struct | ------------- function or associated item `method` not found for this struct
... ...
LL | Struct::method; LL | Struct::method;
| ^^^^^^ function or associated item not found in `Struct` | ^^^^^^ function or associated item not found in `Struct`
@ -29,7 +29,7 @@ error[E0599]: no associated item named `Assoc` found for struct `Struct` in the
--> $DIR/issue-23173.rs:12:13 --> $DIR/issue-23173.rs:12:13
| |
LL | struct Struct { LL | struct Struct {
| ------ associated item `Assoc` not found for this struct | ------------- associated item `Assoc` not found for this struct
... ...
LL | Struct::Assoc; LL | Struct::Assoc;
| ^^^^^ associated item not found in `Struct` | ^^^^^ associated item not found in `Struct`

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `A` found for enum `SomeEnum`
--> $DIR/issue-23217.rs:2:19 --> $DIR/issue-23217.rs:2:19
| |
LL | pub enum SomeEnum { LL | pub enum SomeEnum {
| -------- variant or associated item `A` not found for this enum | ----------------- variant or associated item `A` not found for this enum
LL | B = SomeEnum::A, LL | B = SomeEnum::A,
| ^ | ^
| | | |

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `clone` found for struct `C` in the current scope
--> $DIR/issue-2823.rs:13:16 --> $DIR/issue-2823.rs:13:16
| |
LL | struct C { LL | struct C {
| - method `clone` not found for this struct | -------- method `clone` not found for this struct
... ...
LL | let _d = c.clone(); LL | let _d = c.clone();
| ^^^^^ method not found in `C` | ^^^^^ method not found in `C`

View file

@ -2,7 +2,7 @@ error[E0599]: no variant or associated item named `Baz` found for enum `Foo` in
--> $DIR/issue-28971.rs:7:18 --> $DIR/issue-28971.rs:7:18
| |
LL | enum Foo { LL | enum Foo {
| --- variant or associated item `Baz` not found for this enum | -------- variant or associated item `Baz` not found for this enum
... ...
LL | Foo::Baz(..) => (), LL | Foo::Baz(..) => (),
| ^^^ | ^^^

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `iter` found for struct `Iterate` in the current s
--> $DIR/issue-41880.rs:27:24 --> $DIR/issue-41880.rs:27:24
| |
LL | pub struct Iterate<T, F> { LL | pub struct Iterate<T, F> {
| ------- method `iter` not found for this struct | ------------------------ method `iter` not found for this struct
... ...
LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>()); LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
| ^^^^ method not found in `Iterate<{integer}, [closure@$DIR/issue-41880.rs:26:24: 26:31]>` | ^^^^ method not found in `Iterate<{integer}, [closure@$DIR/issue-41880.rs:26:24: 26:31]>`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `bar` found for struct `Foo` in the current scope
--> $DIR/issue-64430.rs:7:9 --> $DIR/issue-64430.rs:7:9
| |
LL | pub struct Foo; LL | pub struct Foo;
| --- method `bar` not found for this struct | -------------- method `bar` not found for this struct
... ...
LL | Foo.bar() LL | Foo.bar()
| ^^^ method not found in `Foo` | ^^^ method not found in `Foo`

View file

@ -2,7 +2,7 @@ error[E0599]: no function or associated item named `bar` found for struct `Foo`
--> $DIR/issue-7950.rs:6:10 --> $DIR/issue-7950.rs:6:10
| |
LL | struct Foo; LL | struct Foo;
| --- function or associated item `bar` not found for this struct | ---------- function or associated item `bar` not found for this struct
... ...
LL | Foo::bar(); LL | Foo::bar();
| ^^^ function or associated item not found in `Foo` | ^^^ function or associated item not found in `Foo`

View file

@ -51,8 +51,8 @@ error[E0599]: `Foo` is not an iterator
| |
LL | pub struct Foo; LL | pub struct Foo;
| -------------- | --------------
| | | | |
| | method `take` not found for this struct | method `take` not found for this struct
| doesn't satisfy `Foo: Iterator` | doesn't satisfy `Foo: Iterator`
... ...
LL | .take() LL | .take()

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `distance` found for struct `Point<i32>` in the cu
--> $DIR/method-not-found-generic-arg-elision.rs:82:23 --> $DIR/method-not-found-generic-arg-elision.rs:82:23
| |
LL | struct Point<T> { LL | struct Point<T> {
| ----- method `distance` not found for this struct | --------------- method `distance` not found for this struct
... ...
LL | let d = point_i32.distance(); LL | let d = point_i32.distance();
| ^^^^^^^^ method not found in `Point<i32>` | ^^^^^^^^ method not found in `Point<i32>`
@ -14,7 +14,7 @@ error[E0599]: no method named `other` found for struct `Point` in the current sc
--> $DIR/method-not-found-generic-arg-elision.rs:84:23 --> $DIR/method-not-found-generic-arg-elision.rs:84:23
| |
LL | struct Point<T> { LL | struct Point<T> {
| ----- method `other` not found for this struct | --------------- method `other` not found for this struct
... ...
LL | let d = point_i32.other(); LL | let d = point_i32.other();
| ^^^^^ method not found in `Point<i32>` | ^^^^^ method not found in `Point<i32>`
@ -29,7 +29,7 @@ error[E0599]: no method named `method` found for struct `Wrapper<bool>` in the c
--> $DIR/method-not-found-generic-arg-elision.rs:90:13 --> $DIR/method-not-found-generic-arg-elision.rs:90:13
| |
LL | struct Wrapper<T>(T); LL | struct Wrapper<T>(T);
| ------- method `method` not found for this struct | ----------------- method `method` not found for this struct
... ...
LL | wrapper.method(); LL | wrapper.method();
| ^^^^^^ method not found in `Wrapper<bool>` | ^^^^^^ method not found in `Wrapper<bool>`
@ -45,7 +45,7 @@ error[E0599]: no method named `other` found for struct `Wrapper` in the current
--> $DIR/method-not-found-generic-arg-elision.rs:92:13 --> $DIR/method-not-found-generic-arg-elision.rs:92:13
| |
LL | struct Wrapper<T>(T); LL | struct Wrapper<T>(T);
| ------- method `other` not found for this struct | ----------------- method `other` not found for this struct
... ...
LL | wrapper.other(); LL | wrapper.other();
| ^^^^^ method not found in `Wrapper<bool>` | ^^^^^ method not found in `Wrapper<bool>`
@ -54,7 +54,7 @@ error[E0599]: no method named `method` found for struct `Wrapper2<'_, bool, 3_us
--> $DIR/method-not-found-generic-arg-elision.rs:96:13 --> $DIR/method-not-found-generic-arg-elision.rs:96:13
| |
LL | struct Wrapper2<'a, T, const C: usize> { LL | struct Wrapper2<'a, T, const C: usize> {
| -------- method `method` not found for this struct | -------------------------------------- method `method` not found for this struct
... ...
LL | wrapper.method(); LL | wrapper.method();
| ^^^^^^ method not found in `Wrapper2<'_, bool, 3_usize>` | ^^^^^^ method not found in `Wrapper2<'_, bool, 3_usize>`
@ -68,7 +68,7 @@ error[E0599]: no method named `other` found for struct `Wrapper2` in the current
--> $DIR/method-not-found-generic-arg-elision.rs:98:13 --> $DIR/method-not-found-generic-arg-elision.rs:98:13
| |
LL | struct Wrapper2<'a, T, const C: usize> { LL | struct Wrapper2<'a, T, const C: usize> {
| -------- method `other` not found for this struct | -------------------------------------- method `other` not found for this struct
... ...
LL | wrapper.other(); LL | wrapper.other();
| ^^^^^ method not found in `Wrapper2<'_, bool, 3_usize>` | ^^^^^ method not found in `Wrapper2<'_, bool, 3_usize>`
@ -83,7 +83,7 @@ error[E0599]: the method `method` exists for struct `Struct<f64>`, but its trait
--> $DIR/method-not-found-generic-arg-elision.rs:104:7 --> $DIR/method-not-found-generic-arg-elision.rs:104:7
| |
LL | struct Struct<T>{ LL | struct Struct<T>{
| ------ method `method` not found for this struct | ---------------- method `method` not found for this struct
... ...
LL | s.method(); LL | s.method();
| ^^^^^^ method cannot be called on `Struct<f64>` due to unsatisfied trait bounds | ^^^^^^ method cannot be called on `Struct<f64>` due to unsatisfied trait bounds

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `clone` found for struct `Foo` in the current scop
--> $DIR/noncopyable-class.rs:34:16 --> $DIR/noncopyable-class.rs:34:16
| |
LL | struct Foo { LL | struct Foo {
| --- method `clone` not found for this struct | ---------- method `clone` not found for this struct
... ...
LL | let _y = x.clone(); LL | let _y = x.clone();
| ^^^^^ method not found in `Foo` | ^^^^^ method not found in `Foo`

View file

@ -77,7 +77,7 @@ error[E0599]: no function or associated item named `full_of✨` found for struct
--> $DIR/emoji-identifiers.rs:9:8 --> $DIR/emoji-identifiers.rs:9:8
| |
LL | struct 👀; LL | struct 👀;
| -- function or associated item `full_of✨` not found for this struct | --------- function or associated item `full_of✨` not found for this struct
... ...
LL | 👀::full_of✨() LL | 👀::full_of✨()
| ^^^^^^^^^ | ^^^^^^^^^

View file

@ -2,7 +2,7 @@ error[E0599]: no function or associated item named `deserialize` found for struc
--> $DIR/issue-87932.rs:13:8 --> $DIR/issue-87932.rs:13:8
| |
LL | pub struct A {} LL | pub struct A {}
| - function or associated item `deserialize` not found for this struct | ------------ function or associated item `deserialize` not found for this struct
... ...
LL | A::deserialize(); LL | A::deserialize();
| ^^^^^^^^^^^ function or associated item not found in `A` | ^^^^^^^^^^^ function or associated item not found in `A`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `foo` found for struct `A` in the current scope
--> $DIR/point-at-arbitrary-self-type-method.rs:8:7 --> $DIR/point-at-arbitrary-self-type-method.rs:8:7
| |
LL | struct A; LL | struct A;
| - method `foo` not found for this struct | -------- method `foo` not found for this struct
... ...
LL | fn foo(self: Box<Self>) {} LL | fn foo(self: Box<Self>) {}
| --- the method is available for `Box<A>` here | --- the method is available for `Box<A>` here

View file

@ -6,7 +6,7 @@ LL | trait B { fn foo(self: Box<Self>); }
| | | |
| the method is available for `Box<A>` here | the method is available for `Box<A>` here
LL | struct A; LL | struct A;
| - method `foo` not found for this struct | -------- method `foo` not found for this struct
... ...
LL | A.foo() LL | A.foo()
| ^^^ method not found in `A` | ^^^ method not found in `A`

View file

@ -42,7 +42,7 @@ error[E0599]: no method named `fff` found for struct `Myisize` in the current sc
--> $DIR/issue-7575.rs:62:30 --> $DIR/issue-7575.rs:62:30
| |
LL | struct Myisize(isize); LL | struct Myisize(isize);
| ------- method `fff` not found for this struct | -------------- method `fff` not found for this struct
... ...
LL | u.f8(42) + u.f9(342) + m.fff(42) LL | u.f8(42) + u.f9(342) + m.fff(42)
| --^^^ | --^^^

View file

@ -13,8 +13,8 @@ error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait b
| |
LL | struct MyStruct; LL | struct MyStruct;
| --------------- | ---------------
| | | | |
| | method `foo_one` not found for this struct | method `foo_one` not found for this struct
| doesn't satisfy `MyStruct: Foo` | doesn't satisfy `MyStruct: Foo`
... ...
LL | println!("{}", MyStruct.foo_one()); LL | println!("{}", MyStruct.foo_one());

View file

@ -11,7 +11,7 @@ LL | enum CloneEnum {
| -------------- doesn't satisfy `CloneEnum: Default` | -------------- doesn't satisfy `CloneEnum: Default`
... ...
LL | struct Foo<X, Y> (X, Y); LL | struct Foo<X, Y> (X, Y);
| --- method `test` not found for this struct | ---------------- method `test` not found for this struct
... ...
LL | let y = x.test(); LL | let y = x.test();
| ^^^^ method cannot be called on `Foo<Enum, CloneEnum>` due to unsatisfied trait bounds | ^^^^ method cannot be called on `Foo<Enum, CloneEnum>` due to unsatisfied trait bounds
@ -43,7 +43,7 @@ LL | struct CloneStruct {
| ------------------ doesn't satisfy `CloneStruct: Default` | ------------------ doesn't satisfy `CloneStruct: Default`
... ...
LL | struct Foo<X, Y> (X, Y); LL | struct Foo<X, Y> (X, Y);
| --- method `test` not found for this struct | ---------------- method `test` not found for this struct
... ...
LL | let y = x.test(); LL | let y = x.test();
| ^^^^ method cannot be called on `Foo<Struct, CloneStruct>` due to unsatisfied trait bounds | ^^^^ method cannot be called on `Foo<Struct, CloneStruct>` due to unsatisfied trait bounds
@ -65,7 +65,7 @@ error[E0599]: the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but
--> $DIR/derive-trait-for-method-call.rs:40:15 --> $DIR/derive-trait-for-method-call.rs:40:15
| |
LL | struct Foo<X, Y> (X, Y); LL | struct Foo<X, Y> (X, Y);
| --- method `test` not found for this struct | ---------------- method `test` not found for this struct
... ...
LL | let y = x.test(); LL | let y = x.test();
| ^^^^ method cannot be called on `Foo<Vec<Enum>, Instant>` due to unsatisfied trait bounds | ^^^^ method cannot be called on `Foo<Vec<Enum>, Instant>` due to unsatisfied trait bounds

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `pick` found for struct `Chaenomeles` in the curre
--> $DIR/dont-wrap-ambiguous-receivers.rs:18:25 --> $DIR/dont-wrap-ambiguous-receivers.rs:18:25
| |
LL | pub struct Chaenomeles; LL | pub struct Chaenomeles;
| ----------- method `pick` not found for this struct | ---------------------- method `pick` not found for this struct
... ...
LL | banana::Chaenomeles.pick() LL | banana::Chaenomeles.pick()
| ^^^^ method not found in `Chaenomeles` | ^^^^ method not found in `Chaenomeles`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `kind` found for struct `InferOk` in the current s
--> $DIR/field-has-method.rs:19:15 --> $DIR/field-has-method.rs:19:15
| |
LL | struct InferOk<T> { LL | struct InferOk<T> {
| ------- method `kind` not found for this struct | ----------------- method `kind` not found for this struct
... ...
LL | let k = i.kind(); LL | let k = i.kind();
| ^^^^ method not found in `InferOk<Ty>` | ^^^^ method not found in `InferOk<Ty>`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `default_hello` found for struct `GenericAssocMeth
--> $DIR/suggest-assoc-fn-call-with-turbofish.rs:9:7 --> $DIR/suggest-assoc-fn-call-with-turbofish.rs:9:7
| |
LL | struct GenericAssocMethod<T>(T); LL | struct GenericAssocMethod<T>(T);
| ------------------ method `default_hello` not found for this struct | ---------------------------- method `default_hello` not found for this struct
... ...
LL | x.default_hello(); LL | x.default_hello();
| --^^^^^^^^^^^^^ | --^^^^^^^^^^^^^

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `bat` found for struct `Foo` in the current scope
--> $DIR/suggest-methods.rs:18:7 --> $DIR/suggest-methods.rs:18:7
| |
LL | struct Foo; LL | struct Foo;
| --- method `bat` not found for this struct | ---------- method `bat` not found for this struct
... ...
LL | f.bat(1.0); LL | f.bat(1.0);
| ^^^ help: there is an associated function with a similar name: `bar` | ^^^ help: there is an associated function with a similar name: `bar`

View file

@ -29,7 +29,7 @@ error[E0599]: no variant or associated item named `Squareee` found for enum `Sha
--> $DIR/suggest-variants.rs:15:12 --> $DIR/suggest-variants.rs:15:12
| |
LL | enum Shape { LL | enum Shape {
| ----- variant or associated item `Squareee` not found for this enum | ---------- variant or associated item `Squareee` not found for this enum
... ...
LL | Shape::Squareee; LL | Shape::Squareee;
| ^^^^^^^^ | ^^^^^^^^
@ -41,7 +41,7 @@ error[E0599]: no variant or associated item named `Circl` found for enum `Shape`
--> $DIR/suggest-variants.rs:16:12 --> $DIR/suggest-variants.rs:16:12
| |
LL | enum Shape { LL | enum Shape {
| ----- variant or associated item `Circl` not found for this enum | ---------- variant or associated item `Circl` not found for this enum
... ...
LL | Shape::Circl; LL | Shape::Circl;
| ^^^^^ | ^^^^^
@ -53,7 +53,7 @@ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape
--> $DIR/suggest-variants.rs:17:12 --> $DIR/suggest-variants.rs:17:12
| |
LL | enum Shape { LL | enum Shape {
| ----- variant or associated item `Rombus` not found for this enum | ---------- variant or associated item `Rombus` not found for this enum
... ...
LL | Shape::Rombus; LL | Shape::Rombus;
| ^^^^^^ variant or associated item not found in `Shape` | ^^^^^^ variant or associated item not found in `Shape`

View file

@ -8,7 +8,7 @@ LL | fn abc(&self) {}
| --- the method is available for `S` here | --- the method is available for `S` here
LL | } LL | }
LL | pub struct S; LL | pub struct S;
| - method `abc` not found for this struct | ------------ method `abc` not found for this struct
| |
= help: items from traits can only be used if the trait is in scope = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it: help: the following trait is implemented but not in scope; perhaps add a `use` for it:

View file

@ -0,0 +1,33 @@
struct Victim<'a, T: Perpetrator + ?Sized> {
value: u8,
perp: &'a T,
}
trait VictimTrait {
type Ret;
fn get(self) -> Self::Ret;
}
// Actual fix is here
impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
type Ret = u8;
fn get(self) -> Self::Ret {
self.value
}
}
trait Perpetrator {
fn getter<'a>(&'a self) -> Victim<'a, Self> {
Victim {
value: 0,
perp: self,
}
}
fn trigger(&self) {
self.getter().get();
//~^ ERROR the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied
}
}
fn main() {}

View file

@ -0,0 +1,31 @@
error[E0599]: the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied
--> $DIR/impl-derived-implicit-sized-bound-2.rs:28:19
|
LL | struct Victim<'a, T: Perpetrator + ?Sized> {
| ------------------------------------------
| |
| method `get` not found for this struct
| doesn't satisfy `Victim<'_, Self>: VictimTrait`
...
LL | self.getter().get();
| ^^^ method cannot be called on `Victim<'_, Self>` due to unsatisfied trait bounds
|
note: trait bound `Self: Sized` was not satisfied
--> $DIR/impl-derived-implicit-sized-bound-2.rs:12:10
|
LL | impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
| ^ ----------- -------------
| |
| unsatisfied trait bound introduced here
help: consider relaxing the type parameter's implicit `Sized` bound
|
LL | impl<'a, T: ?Sized + Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
| ++++++++
help: consider restricting the type parameter to satisfy the trait bound
|
LL | struct Victim<'a, T: Perpetrator + ?Sized> where Self: Sized {
| +++++++++++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View file

@ -1,16 +1,10 @@
error[E0599]: the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied error[E0599]: the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied
--> $DIR/impl-derived-implicit-sized-bound.rs:31:19 --> $DIR/impl-derived-implicit-sized-bound.rs:31:19
| |
LL | / struct Victim<'a, T: Perpetrator + ?Sized> LL | struct Victim<'a, T: Perpetrator + ?Sized>
LL | | where | ------------------------------------------
LL | | Self: Sized | |
LL | | { | method `get` not found for this struct
LL | | value: u8,
LL | | perp: &'a T,
LL | | }
| | -
| | |
| |_method `get` not found for this
| doesn't satisfy `Victim<'_, Self>: VictimTrait` | doesn't satisfy `Victim<'_, Self>: VictimTrait`
... ...
LL | self.getter().get(); LL | self.getter().get();
@ -23,6 +17,10 @@ LL | impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
| ^ ----------- ------------- | ^ ----------- -------------
| | | |
| unsatisfied trait bound introduced here | unsatisfied trait bound introduced here
help: consider relaxing the type parameter's implicit `Sized` bound
|
LL | impl<'a, T: ?Sized + Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> {
| ++++++++
help: consider restricting the type parameter to satisfy the trait bound help: consider restricting the type parameter to satisfy the trait bound
| |
LL | Self: Sized, Self: Sized LL | Self: Sized, Self: Sized

View file

@ -11,7 +11,7 @@ error[E0599]: no function or associated item named `new` found for struct `Point
--> $DIR/issue-3973.rs:22:20 --> $DIR/issue-3973.rs:22:20
| |
LL | struct Point { LL | struct Point {
| ----- function or associated item `new` not found for this struct | ------------ function or associated item `new` not found for this struct
... ...
LL | let p = Point::new(0.0, 0.0); LL | let p = Point::new(0.0, 0.0);
| ^^^ function or associated item not found in `Point` | ^^^ function or associated item not found in `Point`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `a` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:67:7 --> $DIR/item-privacy.rs:67:7
| |
LL | struct S; LL | struct S;
| - method `a` not found for this struct | -------- method `a` not found for this struct
... ...
LL | S.a(); LL | S.a();
| ^ method not found in `S` | ^ method not found in `S`
@ -18,7 +18,7 @@ error[E0599]: no method named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:68:7 --> $DIR/item-privacy.rs:68:7
| |
LL | struct S; LL | struct S;
| - method `b` not found for this struct | -------- method `b` not found for this struct
... ...
LL | fn b(&self) { } LL | fn b(&self) { }
| - the method is available for `S` here | - the method is available for `S` here
@ -45,7 +45,7 @@ error[E0599]: no function or associated item named `a` found for struct `S` in t
--> $DIR/item-privacy.rs:78:8 --> $DIR/item-privacy.rs:78:8
| |
LL | struct S; LL | struct S;
| - function or associated item `a` not found for this struct | -------- function or associated item `a` not found for this struct
... ...
LL | S::a(&S); LL | S::a(&S);
| ^ function or associated item not found in `S` | ^ function or associated item not found in `S`
@ -61,7 +61,7 @@ error[E0599]: no function or associated item named `b` found for struct `S` in t
--> $DIR/item-privacy.rs:80:8 --> $DIR/item-privacy.rs:80:8
| |
LL | struct S; LL | struct S;
| - function or associated item `b` not found for this struct | -------- function or associated item `b` not found for this struct
... ...
LL | S::b(&S); LL | S::b(&S);
| ^ function or associated item not found in `S` | ^ function or associated item not found in `S`
@ -85,7 +85,7 @@ error[E0599]: no associated item named `A` found for struct `S` in the current s
--> $DIR/item-privacy.rs:97:8 --> $DIR/item-privacy.rs:97:8
| |
LL | struct S; LL | struct S;
| - associated item `A` not found for this struct | -------- associated item `A` not found for this struct
... ...
LL | S::A; LL | S::A;
| ^ associated item not found in `S` | ^ associated item not found in `S`
@ -101,7 +101,7 @@ error[E0599]: no associated item named `B` found for struct `S` in the current s
--> $DIR/item-privacy.rs:98:8 --> $DIR/item-privacy.rs:98:8
| |
LL | struct S; LL | struct S;
| - associated item `B` not found for this struct | -------- associated item `B` not found for this struct
... ...
LL | S::B; LL | S::B;
| ^ associated item not found in `S` | ^ associated item not found in `S`

View file

@ -2,7 +2,7 @@ error[E0599]: no method named `clone` found for struct `Qux` in the current scop
--> $DIR/explicitly-unimplemented-error-message.rs:34:9 --> $DIR/explicitly-unimplemented-error-message.rs:34:9
| |
LL | struct Qux; LL | struct Qux;
| --- method `clone` not found for this struct | ---------- method `clone` not found for this struct
... ...
LL | Qux.clone(); LL | Qux.clone();
| ^^^^^ method not found in `Qux` | ^^^^^ method not found in `Qux`
@ -23,7 +23,7 @@ error[E0599]: no method named `foo` found for struct `Qux` in the current scope
--> $DIR/explicitly-unimplemented-error-message.rs:44:9 --> $DIR/explicitly-unimplemented-error-message.rs:44:9
| |
LL | struct Qux; LL | struct Qux;
| --- method `foo` not found for this struct | ---------- method `foo` not found for this struct
... ...
LL | Qux.foo(); LL | Qux.foo();
| ^^^ method not found in `Qux` | ^^^ method not found in `Qux`

View file

@ -3,8 +3,8 @@ error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its tra
| |
LL | union U5<T> { LL | union U5<T> {
| ----------- | -----------
| | | | |
| | method `clone` not found for this union | method `clone` not found for this union
| doesn't satisfy `U5<CloneNoCopy>: Clone` | doesn't satisfy `U5<CloneNoCopy>: Clone`
... ...
LL | struct CloneNoCopy; LL | struct CloneNoCopy;

View file

@ -3,8 +3,8 @@ error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its tra
| |
LL | union U5<T> { LL | union U5<T> {
| ----------- | -----------
| | | | |
| | method `clone` not found for this union | method `clone` not found for this union
| doesn't satisfy `U5<CloneNoCopy>: Clone` | doesn't satisfy `U5<CloneNoCopy>: Clone`
... ...
LL | struct CloneNoCopy; LL | struct CloneNoCopy;