resolve: Do not skip extern prelude during speculative resolution
This commit is contained in:
parent
37ba1071c6
commit
350f9a2be5
|
@ -1980,9 +1980,15 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !module.no_implicit_prelude {
|
if !module.no_implicit_prelude {
|
||||||
// `record_used` means that we don't try to load crates during speculative resolution
|
if ns == TypeNS && self.extern_prelude.contains(&ident.name) {
|
||||||
if record_used && ns == TypeNS && self.extern_prelude.contains(&ident.name) {
|
let crate_id = if record_used {
|
||||||
let crate_id = self.crate_loader.process_path_extern(ident.name, ident.span);
|
self.crate_loader.process_path_extern(ident.name, ident.span)
|
||||||
|
} else if let Some(crate_id) =
|
||||||
|
self.crate_loader.maybe_process_path_extern(ident.name, ident.span) {
|
||||||
|
crate_id
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
|
let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
|
||||||
self.populate_module_if_necessary(&crate_root);
|
self.populate_module_if_necessary(&crate_root);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// run-pass
|
// run-pass
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
// compile-flags: --extern LooksLikeExternCrate=/path/to/nowhere
|
// compile-flags: --extern LooksLikeExternCrate
|
||||||
|
|
||||||
mod m {
|
mod m {
|
||||||
pub struct LooksLikeExternCrate;
|
pub struct LooksLikeExternCrate;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
pub trait MyTrait {}
|
|
@ -0,0 +1,10 @@
|
||||||
|
// aux-build:extra-item.rs
|
||||||
|
// compile-flags:--extern extra_item
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
|
||||||
|
impl extra_item::MyTrait for S {
|
||||||
|
fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,9 @@
|
||||||
|
error[E0407]: method `extra` is not a member of trait `extra_item::MyTrait`
|
||||||
|
--> $DIR/extra-item.rs:7:5
|
||||||
|
|
|
||||||
|
LL | fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait`
|
||||||
|
| ^^^^^^^^^^^^^ not a member of trait `extra_item::MyTrait`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0407`.
|
Loading…
Reference in New Issue