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 @@ -4046,13 +4046,27 @@ impl<'a> Resolver<'a> {
4046
4046
} else {
4047
4047
// Items from the prelude
4048
4048
if !module. no_implicit_prelude {
4049
- names. extend ( self . extern_prelude . iter ( ) . map ( |( ident, _) | {
4050
- TypoSuggestion {
4051
- candidate : ident. name ,
4052
- article : "a" ,
4053
- kind : "crate" ,
4054
- }
4049
+ names. extend ( self . extern_prelude . clone ( ) . iter ( ) . flat_map ( |( ident, _) | {
4050
+ self . crate_loader
4051
+ . maybe_process_path_extern ( ident. name , ident. span )
4052
+ . and_then ( |crate_id| {
4053
+ let crate_mod = Def :: Mod ( DefId {
4054
+ krate : crate_id,
4055
+ index : CRATE_DEF_INDEX ,
4056
+ } ) ;
4057
+
4058
+ if filter_fn ( crate_mod) {
4059
+ Some ( TypoSuggestion {
4060
+ candidate : ident. name ,
4061
+ article : "a" ,
4062
+ kind : "crate" ,
4063
+ } )
4064
+ } else {
4065
+ None
4066
+ }
4067
+ } )
4055
4068
} ) ) ;
4069
+
4056
4070
if let Some ( prelude) = self . prelude {
4057
4071
add_module_candidates ( prelude, & mut names) ;
4058
4072
}
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