diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-05 14:16:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-05 14:16:12 +0000 |
commit | 5009958847efa5d3cd85f2a9a84074069ca2088d (patch) | |
tree | c962a851c20d9d9cc0c2aefe6eeae36abf139bbb | |
parent | c72b0c3719f93027773983e0384432e33b69f36b (diff) | |
parent | 6239fe47306b6fa5a33e92e82d1e4dba76e4503f (diff) |
Merge #7568
7568: Fix merging of `segment_index` in path resolution r=jonas-schievink a=jonas-schievink
This caused associated item lookup to fail when modifying `resolver.rs` to handle block expressions with inner items.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
-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) => { |