mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Don't discard PathKind::Abs information in lower_use::convert_path
This commit is contained in:
parent
13025ae2a1
commit
7b456552b8
2 changed files with 22 additions and 1 deletions
|
@ -798,3 +798,24 @@ mod foo;
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[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) => {
|
||||
// no type args in use
|
||||
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),
|
||||
});
|
||||
res.segments.push(name);
|
||||
|
|
Loading…
Reference in a new issue