mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17: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,
|
||||
_ => PathKind::Abs,
|
||||
};
|
||||
let path =
|
||||
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());
|
||||
let path = ModPath::from_segments(path_kind, [krate, name![prelude], edition]);
|
||||
|
||||
for path in &[path, fallback_path] {
|
||||
let (per_ns, _) = self.def_map.resolve_path(
|
||||
self.db,
|
||||
self.def_map.root,
|
||||
path,
|
||||
BuiltinShadowMode::Other,
|
||||
);
|
||||
let (per_ns, _) =
|
||||
self.def_map.resolve_path(self.db, self.def_map.root, &path, BuiltinShadowMode::Other);
|
||||
|
||||
match per_ns.types {
|
||||
Some((ModuleDefId::ModuleId(m), _)) => {
|
||||
self.def_map.prelude = Some(m);
|
||||
break;
|
||||
}
|
||||
types => {
|
||||
tracing::debug!(
|
||||
"could not resolve prelude path `{}` to module (resolved to {:?})",
|
||||
path,
|
||||
types
|
||||
);
|
||||
}
|
||||
match per_ns.types {
|
||||
Some((ModuleDefId::ModuleId(m), _)) => {
|
||||
self.def_map.prelude = Some(m);
|
||||
}
|
||||
types => {
|
||||
tracing::debug!(
|
||||
"could not resolve prelude path `{}` to module (resolved to {:?})",
|
||||
path,
|
||||
types
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue