mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Fix merging of segment_index
in path resolution
This commit is contained in:
parent
ac5958485e
commit
6239fe4730
1 changed files with 5 additions and 2 deletions
|
@ -108,7 +108,6 @@ impl DefMap {
|
||||||
shadow: BuiltinShadowMode,
|
shadow: BuiltinShadowMode,
|
||||||
) -> ResolvePathResult {
|
) -> ResolvePathResult {
|
||||||
let mut result = ResolvePathResult::empty(ReachedFixedPoint::No);
|
let mut result = ResolvePathResult::empty(ReachedFixedPoint::No);
|
||||||
result.segment_index = Some(usize::max_value());
|
|
||||||
|
|
||||||
let mut arc;
|
let mut arc;
|
||||||
let mut current_map = self;
|
let mut current_map = self;
|
||||||
|
@ -128,7 +127,11 @@ impl DefMap {
|
||||||
}
|
}
|
||||||
// FIXME: this doesn't seem right; what if the different namespace resolutions come from different crates?
|
// FIXME: this doesn't seem right; what if the different namespace resolutions come from different crates?
|
||||||
result.krate = result.krate.or(new.krate);
|
result.krate = result.krate.or(new.krate);
|
||||||
result.segment_index = result.segment_index.min(new.segment_index);
|
result.segment_index = match (result.segment_index, new.segment_index) {
|
||||||
|
(Some(idx), None) => Some(idx),
|
||||||
|
(Some(old), Some(new)) => Some(old.max(new)),
|
||||||
|
(None, new) => new,
|
||||||
|
};
|
||||||
|
|
||||||
match ¤t_map.block {
|
match ¤t_map.block {
|
||||||
Some(block) => {
|
Some(block) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue