mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Remove prelude fallback path for Rust <1.52.0
We've already removed non-sysroot proc macro server, which effectively removed support for Rust <1.64.0, so this removal of fallback path shouldn't be problem at this point.
This commit is contained in:
parent
34a9129333
commit
96113b7b8e
1 changed files with 13 additions and 25 deletions
|
@ -547,33 +547,21 @@ impl DefCollector<'_> {
|
||||||
Edition::Edition2015 => PathKind::Plain,
|
Edition::Edition2015 => PathKind::Plain,
|
||||||
_ => PathKind::Abs,
|
_ => PathKind::Abs,
|
||||||
};
|
};
|
||||||
let path =
|
let path = ModPath::from_segments(path_kind, [krate, name![prelude], edition]);
|
||||||
ModPath::from_segments(path_kind, [krate.clone(), name![prelude], edition].into_iter());
|
|
||||||
// Fall back to the older `std::prelude::v1` for compatibility with Rust <1.52.0
|
|
||||||
// FIXME remove this fallback
|
|
||||||
let fallback_path =
|
|
||||||
ModPath::from_segments(path_kind, [krate, name![prelude], name![v1]].into_iter());
|
|
||||||
|
|
||||||
for path in &[path, fallback_path] {
|
let (per_ns, _) =
|
||||||
let (per_ns, _) = self.def_map.resolve_path(
|
self.def_map.resolve_path(self.db, self.def_map.root, &path, BuiltinShadowMode::Other);
|
||||||
self.db,
|
|
||||||
self.def_map.root,
|
|
||||||
path,
|
|
||||||
BuiltinShadowMode::Other,
|
|
||||||
);
|
|
||||||
|
|
||||||
match per_ns.types {
|
match per_ns.types {
|
||||||
Some((ModuleDefId::ModuleId(m), _)) => {
|
Some((ModuleDefId::ModuleId(m), _)) => {
|
||||||
self.def_map.prelude = Some(m);
|
self.def_map.prelude = Some(m);
|
||||||
break;
|
}
|
||||||
}
|
types => {
|
||||||
types => {
|
tracing::debug!(
|
||||||
tracing::debug!(
|
"could not resolve prelude path `{}` to module (resolved to {:?})",
|
||||||
"could not resolve prelude path `{}` to module (resolved to {:?})",
|
path,
|
||||||
path,
|
types
|
||||||
types
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue