Don't discard PathKind::Abs information in lower_use::convert_path
This commit is contained in:
parent
13025ae2a1
commit
7b456552b8
@ -798,3 +798,24 @@ fn circular_mods() {
|
|||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn abs_path_ignores_local() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- /main.rs crate:main deps:core
|
||||||
|
pub use ::core::hash::Hash;
|
||||||
|
pub mod core {}
|
||||||
|
|
||||||
|
//- /lib.rs crate:core
|
||||||
|
pub mod hash { pub trait Hash {} }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
crate
|
||||||
|
Hash: t
|
||||||
|
core: t
|
||||||
|
|
||||||
|
crate::core
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -76,7 +76,7 @@ fn convert_path(prefix: Option<ModPath>, path: ast::Path, hygiene: &Hygiene) ->
|
|||||||
Either::Left(name) => {
|
Either::Left(name) => {
|
||||||
// no type args in use
|
// no type args in use
|
||||||
let mut res = prefix.unwrap_or_else(|| ModPath {
|
let mut res = prefix.unwrap_or_else(|| ModPath {
|
||||||
kind: PathKind::Plain,
|
kind: segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs),
|
||||||
segments: Vec::with_capacity(1),
|
segments: Vec::with_capacity(1),
|
||||||
});
|
});
|
||||||
res.segments.push(name);
|
res.segments.push(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user