1
Fork 0

When failing to import core, suggest std

This commit is contained in:
Esteban Küber 2023-11-19 16:34:22 +00:00
parent 2831701757
commit ec50f1c90b
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}`?"),