You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which emits (ignoring the extra suggestion from a crate visible to the playground):
error[E0405]: cannot find trait `Trait` in `A`
--> src/lib.rs:6:20
|
6 | struct A<H: A::Trait>(H);
| ^^^^^ not found in `A`
|
help: consider importing one of these items
|
6 | use crate::A::Trait;
|
The error is correct - in mod BA refers to struct A itself, which has no associated item called Trait.
The suggestion is invalid - whether Trait is imported in the current module has no effect on the path A::Trait.
(Note that the playground's click-to-insert-use-statement feature also inserts the suggestion in the wrong position - at the top of the file instead of in mod B - which isn't a compiler issue.)
Activity
SNCPlay42 commentedon Mar 28, 2022
Reduced some:
Which emits (ignoring the extra suggestion from a crate visible to the playground):
The error is correct - in
mod BArefers tostruct Aitself, which has no associated item calledTrait.The suggestion is invalid - whether
Traitis imported in the current module has no effect on the pathA::Trait.(Note that the playground's click-to-insert-
use-statement feature also inserts the suggestion in the wrong position - at the top of the file instead of inmod B- which isn't a compiler issue.)@rustbot label A-diagnostics A-resolve A-associated-items D-confusing D-invalid-suggestion
When suggesting to import an item, also suggest changing the path if …
Rollup merge of rust-lang#96353 - estebank:issue-95413, r=compiler-er…
Auto merge of rust-lang#96353 - estebank:issue-95413, r=compiler-errors