Skip to content

Commit 5009958

Browse files
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]>
2 parents c72b0c3 + 6239fe4 commit 5009958

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/hir_def/src/nameres/path_resolution.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ impl DefMap {
108108
shadow: BuiltinShadowMode,
109109
) -> ResolvePathResult {
110110
let mut result = ResolvePathResult::empty(ReachedFixedPoint::No);
111-
result.segment_index = Some(usize::max_value());
112111

113112
let mut arc;
114113
let mut current_map = self;
@@ -128,7 +127,11 @@ impl DefMap {
128127
}
129128
// FIXME: this doesn't seem right; what if the different namespace resolutions come from different crates?
130129
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+
};
132135

133136
match &current_map.block {
134137
Some(block) => {

0 commit comments

Comments
 (0)