diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-02 12:16:19 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-02 12:16:19 +0000 |
commit | 14086e311853d2c40f50102821ff6355c828d0e3 (patch) | |
tree | 720cbf93466f5b95011926eb08f9068dbdf7eb18 /crates/hir_def/src | |
parent | bb697727a2e43d734a1bf3aae7644a9249aee11e (diff) | |
parent | 7b456552b8ea254b060a2182907d3db98494fcbb (diff) |
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]>
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r-- | crates/hir_def/src/nameres/tests/mod_resolution.rs | 21 | ||||
-rw-r--r-- | crates/hir_def/src/path/lower/lower_use.rs | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/tests/mod_resolution.rs b/crates/hir_def/src/nameres/tests/mod_resolution.rs index ba295fd9e..ef6f85e15 100644 --- a/crates/hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/hir_def/src/nameres/tests/mod_resolution.rs | |||
@@ -798,3 +798,24 @@ mod foo; | |||
798 | "#, | 798 | "#, |
799 | ); | 799 | ); |
800 | } | 800 | } |
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 | } | ||
diff --git a/crates/hir_def/src/path/lower/lower_use.rs b/crates/hir_def/src/path/lower/lower_use.rs index 53cecb05f..ba0d1f0e7 100644 --- a/crates/hir_def/src/path/lower/lower_use.rs +++ b/crates/hir_def/src/path/lower/lower_use.rs | |||
@@ -76,7 +76,7 @@ fn convert_path(prefix: Option<ModPath>, path: ast::Path, hygiene: &Hygiene) -> | |||
76 | Either::Left(name) => { | 76 | Either::Left(name) => { |
77 | // no type args in use | 77 | // no type args in use |
78 | let mut res = prefix.unwrap_or_else(|| ModPath { | 78 | let mut res = prefix.unwrap_or_else(|| ModPath { |
79 | kind: PathKind::Plain, | 79 | kind: segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs), |
80 | segments: Vec::with_capacity(1), | 80 | segments: Vec::with_capacity(1), |
81 | }); | 81 | }); |
82 | res.segments.push(name); | 82 | res.segments.push(name); |