Port rustc_reservation_impl to the new attribute parser
This commit is contained in:
parent
4cd4c18438
commit
6babe687a5
8 changed files with 42 additions and 12 deletions
|
|
@ -8,8 +8,10 @@ use std::fmt::Debug;
|
|||
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
||||
use rustc_errors::{Diag, EmissionGuarantee};
|
||||
use rustc_hir::attrs::AttributeKind;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
|
||||
use rustc_hir::find_attr;
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, TyCtxtInferExt};
|
||||
use rustc_infer::traits::PredicateObligations;
|
||||
use rustc_macros::{TypeFoldable, TypeVisitable};
|
||||
|
|
@ -23,7 +25,7 @@ use rustc_middle::ty::{
|
|||
};
|
||||
pub use rustc_next_trait_solver::coherence::*;
|
||||
use rustc_next_trait_solver::solve::SolverDelegateEvalExt;
|
||||
use rustc_span::{DUMMY_SP, Span, sym};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use tracing::{debug, instrument, warn};
|
||||
|
||||
use super::ObligationCtxt;
|
||||
|
|
@ -758,10 +760,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> {
|
|||
} = cand.kind()
|
||||
&& let ty::ImplPolarity::Reservation = infcx.tcx.impl_polarity(def_id)
|
||||
{
|
||||
let message = infcx
|
||||
.tcx
|
||||
.get_attr(def_id, sym::rustc_reservation_impl)
|
||||
.and_then(|a| a.value_str());
|
||||
let message = find_attr!(infcx.tcx.get_all_attrs(def_id), AttributeKind::RustcReservationImpl(_, message) => *message);
|
||||
if let Some(message) = message {
|
||||
self.causes.insert(IntercrateAmbiguityCause::ReservationImpl { message });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ use rustc_data_structures::assert_matches;
|
|||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{Diag, EmissionGuarantee};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_hir::attrs::AttributeKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, LangItem, find_attr};
|
||||
use rustc_infer::infer::BoundRegionConversionTime::{self, HigherRankedType};
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_infer::infer::at::ToTrace;
|
||||
|
|
@ -33,7 +33,7 @@ use rustc_middle::ty::{
|
|||
may_use_unstable_feature,
|
||||
};
|
||||
use rustc_next_trait_solver::solve::AliasBoundKind;
|
||||
use rustc_span::{Symbol, sym};
|
||||
use rustc_span::Symbol;
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use self::EvaluationResult::*;
|
||||
|
|
@ -1445,8 +1445,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
&& let ty::ImplPolarity::Reservation = tcx.impl_polarity(def_id)
|
||||
{
|
||||
if let Some(intercrate_ambiguity_clauses) = &mut self.intercrate_ambiguity_causes {
|
||||
let message =
|
||||
tcx.get_attr(def_id, sym::rustc_reservation_impl).and_then(|a| a.value_str());
|
||||
let message = find_attr!(tcx.get_all_attrs(def_id), AttributeKind::RustcReservationImpl(_, message) => *message);
|
||||
if let Some(message) = message {
|
||||
debug!(
|
||||
"filter_reservation_impls: \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue