Disable future_prelude_collision
for 2021 edition
This commit is contained in:
parent
79388aa067
commit
01bdb8e38a
1 changed files with 43 additions and 39 deletions
|
@ -22,6 +22,7 @@ use rustc_middle::ty::subst::{InternalSubsts, SubstsRef};
|
|||
use rustc_middle::ty::GenericParamDefKind;
|
||||
use rustc_middle::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TypeFoldable, WithConstness};
|
||||
use rustc_session::lint::builtin::FUTURE_PRELUDE_COLLISION;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::Span;
|
||||
use rustc_trait_selection::traits;
|
||||
|
@ -199,9 +200,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let pick =
|
||||
self.lookup_probe(span, segment.ident, self_ty, call_expr, ProbeScope::TraitsInScope)?;
|
||||
|
||||
if span.edition() < Edition::Edition2021 {
|
||||
if let sym::try_from | sym::try_into = segment.ident.name {
|
||||
if let probe::PickKind::TraitPick = pick.kind {
|
||||
if !matches!(self.tcx.crate_name(pick.item.def_id.krate), sym::std | sym::core) {
|
||||
if !matches!(self.tcx.crate_name(pick.item.def_id.krate), sym::std | sym::core)
|
||||
{
|
||||
self.tcx.struct_span_lint_hir(
|
||||
FUTURE_PRELUDE_COLLISION,
|
||||
call_expr.hir_id,
|
||||
|
@ -244,6 +247,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for import_id in &pick.import_ids {
|
||||
debug!("used_trait_import: {:?}", import_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue