Skip to content

Commit

Permalink
avoid looking twice into external prelude crates
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Aug 16, 2018
1 parent 6b9b750 commit 2b3e492
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/librustc_resolve/lib.rs
Expand Up @@ -4302,7 +4302,14 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
let mut path_segments = path_segments.clone();
path_segments.push(ast::PathSegment::from_ident(ident));

if !in_module_is_extern || name_binding.vis == ty::Visibility::Public {
let is_extern_crate_that_also_appears_in_prelude =
name_binding.is_extern_crate() &&
self.extern_prelude.contains(&ident.name);

let is_visible_to_user =
!in_module_is_extern || name_binding.vis == ty::Visibility::Public;

if !is_extern_crate_that_also_appears_in_prelude || is_visible_to_user {
// add the module to the lookup
let is_extern = in_module_is_extern || name_binding.is_extern_crate();
if seen_modules.insert(module.def_id().unwrap()) {
Expand Down

0 comments on commit 2b3e492

Please sign in to comment.