Skip to content

Commit

Permalink
no need to special case std
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Aug 27, 2018
1 parent 32da6cc commit ae85375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 4 additions & 8 deletions src/librustc_resolve/lib.rs
Expand Up @@ -4273,12 +4273,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
if self.session.rust_2018() {
// crate-local absolute paths start with `crate::` in edition 2018
// FIXME: may also be stabilized for Rust 2015 (Issues #45477, #44660)
let first_segment_ident = segms[0].ident;
if first_segment_ident.name != "std" {
segms.insert(
0, ast::PathSegment::from_ident(crate_name)
);
}
segms.insert(
0, ast::PathSegment::from_ident(crate_name)
);
}

segms.push(ast::PathSegment::from_ident(ident));
Expand Down Expand Up @@ -4307,8 +4304,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {

let is_extern_crate_that_also_appears_in_prelude =
name_binding.is_extern_crate() &&
self.session.rust_2018() &&
self.extern_prelude.contains(&ident.name);
self.session.rust_2018();

let is_visible_to_user =
!in_module_is_extern || name_binding.vis == ty::Visibility::Public;
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/rust-2018/issue-52202-use-suggestions.stderr
Expand Up @@ -9,11 +9,11 @@ LL | use crate::plumbing::Drain;
|
LL | use std::collections::binary_heap::Drain;
|
LL | use std::collections::binary_heap::Drain;
|
LL | use std::collections::hash_map::Drain;
|
and 9 other candidates
LL | use std::collections::hash_set::Drain;
|
and 3 other candidates

error: aborting due to previous error

Expand Down

0 comments on commit ae85375

Please sign in to comment.