aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/path.rs8
-rw-r--r--crates/hir_def/src/path/lower.rs2
-rw-r--r--crates/hir_def/src/path/lower/lower_use.rs7
3 files changed, 9 insertions, 8 deletions
diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs
index 0caad53d3..0e60dc2b6 100644
--- a/crates/hir_def/src/path.rs
+++ b/crates/hir_def/src/path.rs
@@ -201,10 +201,10 @@ impl Path {
201 } 201 }
202 let res = Path { 202 let res = Path {
203 type_anchor: self.type_anchor.clone(), 203 type_anchor: self.type_anchor.clone(),
204 mod_path: ModPath { 204 mod_path: ModPath::from_segments(
205 kind: self.mod_path.kind.clone(), 205 self.mod_path.kind.clone(),
206 segments: self.mod_path.segments[..self.mod_path.segments.len() - 1].to_vec(), 206 self.mod_path.segments[..self.mod_path.segments.len() - 1].iter().cloned(),
207 }, 207 ),
208 generic_args: self.generic_args[..self.generic_args.len() - 1].to_vec(), 208 generic_args: self.generic_args[..self.generic_args.len() - 1].to_vec(),
209 }; 209 };
210 Some(res) 210 Some(res)
diff --git a/crates/hir_def/src/path/lower.rs b/crates/hir_def/src/path/lower.rs
index 9518ac109..a469546c1 100644
--- a/crates/hir_def/src/path/lower.rs
+++ b/crates/hir_def/src/path/lower.rs
@@ -129,7 +129,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
129 } 129 }
130 } 130 }
131 131
132 let mod_path = ModPath { kind, segments }; 132 let mod_path = ModPath::from_segments(kind, segments);
133 return Some(Path { type_anchor, mod_path, generic_args }); 133 return Some(Path { type_anchor, mod_path, generic_args });
134 134
135 fn qualifier(path: &ast::Path) -> Option<ast::Path> { 135 fn qualifier(path: &ast::Path) -> Option<ast::Path> {
diff --git a/crates/hir_def/src/path/lower/lower_use.rs b/crates/hir_def/src/path/lower/lower_use.rs
index ba0d1f0e7..d584b0b70 100644
--- a/crates/hir_def/src/path/lower/lower_use.rs
+++ b/crates/hir_def/src/path/lower/lower_use.rs
@@ -75,9 +75,10 @@ fn convert_path(prefix: Option<ModPath>, path: ast::Path, hygiene: &Hygiene) ->
75 match hygiene.name_ref_to_name(name_ref) { 75 match hygiene.name_ref_to_name(name_ref) {
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(|| {
79 kind: segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs), 79 ModPath::from_kind(
80 segments: Vec::with_capacity(1), 80 segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs),
81 )
81 }); 82 });
82 res.segments.push(name); 83 res.segments.push(name);
83 res 84 res