diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/nameres/path_resolution.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index f2b59172d..036e389b0 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs | |||
@@ -108,7 +108,6 @@ impl DefMap { | |||
108 | shadow: BuiltinShadowMode, | 108 | shadow: BuiltinShadowMode, |
109 | ) -> ResolvePathResult { | 109 | ) -> ResolvePathResult { |
110 | let mut result = ResolvePathResult::empty(ReachedFixedPoint::No); | 110 | let mut result = ResolvePathResult::empty(ReachedFixedPoint::No); |
111 | result.segment_index = Some(usize::max_value()); | ||
112 | 111 | ||
113 | let mut arc; | 112 | let mut arc; |
114 | let mut current_map = self; | 113 | let mut current_map = self; |
@@ -128,7 +127,11 @@ impl DefMap { | |||
128 | } | 127 | } |
129 | // FIXME: this doesn't seem right; what if the different namespace resolutions come from different crates? | 128 | // FIXME: this doesn't seem right; what if the different namespace resolutions come from different crates? |
130 | result.krate = result.krate.or(new.krate); | 129 | result.krate = result.krate.or(new.krate); |
131 | result.segment_index = result.segment_index.min(new.segment_index); | 130 | result.segment_index = match (result.segment_index, new.segment_index) { |
131 | (Some(idx), None) => Some(idx), | ||
132 | (Some(old), Some(new)) => Some(old.max(new)), | ||
133 | (None, new) => new, | ||
134 | }; | ||
132 | 135 | ||
133 | match ¤t_map.block { | 136 | match ¤t_map.block { |
134 | Some(block) => { | 137 | Some(block) => { |