diff options
Diffstat (limited to 'crates/ra_hir_def/src/path')
-rw-r--r-- | crates/ra_hir_def/src/path/lower.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path/lower/lower_use.rs | 11 |
2 files changed, 13 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index 62aafd508..0934520d7 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs | |||
@@ -101,8 +101,12 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> | |||
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | ast::PathSegmentKind::SuperKw => { | 103 | ast::PathSegmentKind::SuperKw => { |
104 | kind = PathKind::Super(1); | 104 | let nested_super_count = if let PathKind::Super(n) = kind { |
105 | break; | 105 | n |
106 | } else { | ||
107 | 0 | ||
108 | }; | ||
109 | kind = PathKind::Super(nested_super_count + 1); | ||
106 | } | 110 | } |
107 | } | 111 | } |
108 | path = match qualifier(&path) { | 112 | path = match qualifier(&path) { |
diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs index b6d1125e2..278d5196e 100644 --- a/crates/ra_hir_def/src/path/lower/lower_use.rs +++ b/crates/ra_hir_def/src/path/lower/lower_use.rs | |||
@@ -103,10 +103,13 @@ fn convert_path(prefix: Option<ModPath>, path: ast::Path, hygiene: &Hygiene) -> | |||
103 | ModPath::from_segments(PathKind::Super(0), iter::empty()) | 103 | ModPath::from_segments(PathKind::Super(0), iter::empty()) |
104 | } | 104 | } |
105 | ast::PathSegmentKind::SuperKw => { | 105 | ast::PathSegmentKind::SuperKw => { |
106 | if prefix.is_some() { | 106 | let nested_super_count = match prefix.map(|p| p.kind) { |
107 | return None; | 107 | Some(PathKind::Super(n)) => n, |
108 | } | 108 | Some(_) => return None, |
109 | ModPath::from_segments(PathKind::Super(1), iter::empty()) | 109 | None => 0, |
110 | }; | ||
111 | |||
112 | ModPath::from_segments(PathKind::Super(nested_super_count + 1), iter::empty()) | ||
110 | } | 113 | } |
111 | ast::PathSegmentKind::Type { .. } => { | 114 | ast::PathSegmentKind::Type { .. } => { |
112 | // not allowed in imports | 115 | // not allowed in imports |