Skip to content

Commit 14086e3

Browse files
bors[bot]Veykril
andauthored
Merge #6697
6697: Don't discard PathKind::Abs information in lower_use::convert_path r=matklad a=Veykril Fixes #6694 Co-authored-by: Lukas Wirth <[email protected]>
2 parents bb69772 + 7b45655 commit 14086e3

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

crates/hir_def/src/nameres/tests/mod_resolution.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,3 +798,24 @@ mod foo;
798798
"#,
799799
);
800800
}
801+
802+
#[test]
803+
fn abs_path_ignores_local() {
804+
check(
805+
r#"
806+
//- /main.rs crate:main deps:core
807+
pub use ::core::hash::Hash;
808+
pub mod core {}
809+
810+
//- /lib.rs crate:core
811+
pub mod hash { pub trait Hash {} }
812+
"#,
813+
expect![[r#"
814+
crate
815+
Hash: t
816+
core: t
817+
818+
crate::core
819+
"#]],
820+
);
821+
}

crates/hir_def/src/path/lower/lower_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn convert_path(prefix: Option<ModPath>, path: ast::Path, hygiene: &Hygiene) ->
7676
Either::Left(name) => {
7777
// no type args in use
7878
let mut res = prefix.unwrap_or_else(|| ModPath {
79-
kind: PathKind::Plain,
79+
kind: segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs),
8080
segments: Vec::with_capacity(1),
8181
});
8282
res.segments.push(name);

0 commit comments

Comments
 (0)