Skip to content

Commit 9f84ccf

Browse files
committed
special-case std
1 parent 231bf22 commit 9f84ccf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc_resolve/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,7 +4250,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
42504250
let mut worklist = Vec::new();
42514251
let mut seen_modules = FxHashSet();
42524252
let not_local_module = crate_name != keywords::Crate.ident();
4253-
worklist.push((start_module, Vec::new(), not_local_module));
4253+
worklist.push((start_module, Vec::<ast::PathSegment>::new(), not_local_module));
42544254

42554255
while let Some((in_module,
42564256
path_segments,
@@ -4273,10 +4273,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
42734273
if self.session.rust_2018() {
42744274
// crate-local absolute paths start with `crate::` in edition 2018
42754275
// FIXME: may also be stabilized for Rust 2015 (Issues #45477, #44660)
4276-
4277-
segms.insert(
4278-
0, ast::PathSegment::from_ident(crate_name)
4279-
);
4276+
let first_segment_ident = segms[0].ident;
4277+
if first_segment_ident.name != "std" {
4278+
segms.insert(
4279+
0, ast::PathSegment::from_ident(crate_name)
4280+
);
4281+
}
42804282
}
42814283

42824284
segms.push(ast::PathSegment::from_ident(ident));

0 commit comments

Comments
 (0)