File tree 5 files changed +44
-7
lines changed
5 files changed +44
-7
lines changed Original file line number Diff line number Diff line change @@ -4047,13 +4047,27 @@ impl<'a> Resolver<'a> {
4047
4047
} else {
4048
4048
// Items from the prelude
4049
4049
if !module. no_implicit_prelude {
4050
- names. extend ( self . extern_prelude . iter ( ) . map ( |( ident, _) | {
4051
- TypoSuggestion {
4052
- candidate : ident. name ,
4053
- article : "a" ,
4054
- kind : "crate" ,
4055
- }
4050
+ names. extend ( self . extern_prelude . clone ( ) . iter ( ) . flat_map ( |( ident, _) | {
4051
+ self . crate_loader
4052
+ . maybe_process_path_extern ( ident. name , ident. span )
4053
+ . and_then ( |crate_id| {
4054
+ let crate_mod = Def :: Mod ( DefId {
4055
+ krate : crate_id,
4056
+ index : CRATE_DEF_INDEX ,
4057
+ } ) ;
4058
+
4059
+ if filter_fn ( crate_mod) {
4060
+ Some ( TypoSuggestion {
4061
+ candidate : ident. name ,
4062
+ article : "a" ,
4063
+ kind : "crate" ,
4064
+ } )
4065
+ } else {
4066
+ None
4067
+ }
4068
+ } )
4056
4069
} ) ) ;
4070
+
4057
4071
if let Some ( prelude) = self . prelude {
4058
4072
add_module_candidates ( prelude, & mut names) ;
4059
4073
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ error: cannot find derive macro `attr_proc_macra` in this scope
20
20
--> $DIR/resolve-error.rs:44:10
21
21
|
22
22
LL | #[derive(attr_proc_macra)]
23
- | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`
23
+ | ^^^^^^^^^^^^^^^
24
24
25
25
error: cannot find macro `FooWithLongNama!` in this scope
26
26
--> $DIR/resolve-error.rs:49:5
Original file line number Diff line number Diff line change
1
+ //! Contains a struct with almost the same name as itself, to trigger Levenshtein suggestions.
2
+
3
+ pub struct Foo ;
Original file line number Diff line number Diff line change
1
+ // aux-build:foo.rs
2
+
3
+ extern crate foo;
4
+
5
+ type Output = Option < Foo > ; //~ ERROR cannot find type `Foo`
6
+
7
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0412]: cannot find type `Foo` in this scope
2
+ --> $DIR/no-extern-crate-in-type.rs:5:22
3
+ |
4
+ LL | type Output = Option<Foo>;
5
+ | ^^^ not found in this scope
6
+ help: possible candidate is found in another module, you can import it into scope
7
+ |
8
+ LL | use foo::Foo;
9
+ |
10
+
11
+ error: aborting due to previous error
12
+
13
+ For more information about this error, try `rustc --explain E0412`.
You can’t perform that action at this time.
0 commit comments