aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path/lower/lower_use.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-01 13:36:44 +0000
committerGitHub <[email protected]>2020-03-01 13:36:44 +0000
commitea67e2346e64a1a14206e6d0f163c6c2e19d0afb (patch)
tree80a4f5c9b04008df8502ed75b230661fb9041742 /crates/ra_hir_def/src/path/lower/lower_use.rs
parent6db2da4993d3956fc7c8ebf152963a132611426a (diff)
parent0057d1e10d1bc94557e94e551079be0c9c281d3f (diff)
Merge #3384
3384: fix #2377 super::super::* r=flodiebold a=JoshMcguigan Thanks @matklad for the detailed explanation on #2377. I believe this fixes it. One thing I'm not sure about is you said the fix would involve changing `crates/ra_hir_def/src/path/lower/lower.rs`, but I only changed `crates/ra_hir_def/src/path/lower/lower_use.rs`. I'm not sure what kind of test code I'd have to write to expose the issue in `lower.rs`, but I'd be happy to add it if you are able to provide additional guidance. closes #2377 Co-authored-by: Josh Mcguigan <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/path/lower/lower_use.rs')
-rw-r--r--crates/ra_hir_def/src/path/lower/lower_use.rs11
1 files changed, 7 insertions, 4 deletions
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