Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 96113b7

Browse files
committed
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.
1 parent 34a9129 commit 96113b7

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

crates/hir-def/src/nameres/collector.rs

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -547,33 +547,21 @@ impl DefCollector<'_> {
547547
Edition::Edition2015 => PathKind::Plain,
548548
_ => PathKind::Abs,
549549
};
550-
let path =
551-
ModPath::from_segments(path_kind, [krate.clone(), name![prelude], edition].into_iter());
552-
// Fall back to the older `std::prelude::v1` for compatibility with Rust <1.52.0
553-
// FIXME remove this fallback
554-
let fallback_path =
555-
ModPath::from_segments(path_kind, [krate, name![prelude], name![v1]].into_iter());
556-
557-
for path in &[path, fallback_path] {
558-
let (per_ns, _) = self.def_map.resolve_path(
559-
self.db,
560-
self.def_map.root,
561-
path,
562-
BuiltinShadowMode::Other,
563-
);
550+
let path = ModPath::from_segments(path_kind, [krate, name![prelude], edition]);
564551

565-
match per_ns.types {
566-
Some((ModuleDefId::ModuleId(m), _)) => {
567-
self.def_map.prelude = Some(m);
568-
break;
569-
}
570-
types => {
571-
tracing::debug!(
572-
"could not resolve prelude path `{}` to module (resolved to {:?})",
573-
path,
574-
types
575-
);
576-
}
552+
let (per_ns, _) =
553+
self.def_map.resolve_path(self.db, self.def_map.root, &path, BuiltinShadowMode::Other);
554+
555+
match per_ns.types {
556+
Some((ModuleDefId::ModuleId(m), _)) => {
557+
self.def_map.prelude = Some(m);
558+
}
559+
types => {
560+
tracing::debug!(
561+
"could not resolve prelude path `{}` to module (resolved to {:?})",
562+
path,
563+
types
564+
);
577565
}
578566
}
579567
}

0 commit comments

Comments
 (0)