1
Fork 0

Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Ki

When failing to import `core`, suggest `std`
This commit is contained in:
bors 2023-11-23 02:26:52 +00:00
commit 360bafad68
4 changed files with 29 additions and 12 deletions

View file

@ -1858,6 +1858,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Applicability::MaybeIncorrect,
)),
)
} else if ident.name == sym::core {
(
format!("maybe a missing crate `{ident}`?"),
Some((
vec![(ident.span, "std".to_string())],
"try using `std` instead of `core`".to_string(),
Applicability::MaybeIncorrect,
)),
)
} else if self.tcx.sess.is_rust_2015() {
(
format!("maybe a missing crate `{ident}`?"),