More rename fallout
This commit is contained in:
parent
534e267d48
commit
9108294a6c
25 changed files with 93 additions and 91 deletions
|
@ -425,7 +425,7 @@ fn derive_cause<'tcx>(
|
|||
tcx.predicates_of(impl_def_id).instantiate_identity(tcx).iter().nth(idx)
|
||||
{
|
||||
cause = cause.derived_cause(parent_trait_pred, |derived| {
|
||||
ObligationCauseCode::ImplDerived(Box::new(traits::ImplDerivedObligationCause {
|
||||
ObligationCauseCode::ImplDerived(Box::new(traits::ImplDerivedCause {
|
||||
derived,
|
||||
impl_or_alias_def_id: impl_def_id,
|
||||
impl_def_predicate_index: Some(idx),
|
||||
|
@ -435,8 +435,7 @@ fn derive_cause<'tcx>(
|
|||
}
|
||||
}
|
||||
ProbeKind::TraitCandidate { source: CandidateSource::BuiltinImpl(..), result: _ } => {
|
||||
cause = cause
|
||||
.derived_cause(parent_trait_pred, ObligationCauseCode::BuiltinDerivedObligation);
|
||||
cause = cause.derived_cause(parent_trait_pred, ObligationCauseCode::BuiltinDerived);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ use super::{
|
|||
|
||||
use crate::errors;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::{ImplDerivedObligationCause, NormalizeExt, ObligationCtxt};
|
||||
use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt};
|
||||
|
||||
use hir::def::CtorOf;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
|
@ -1400,10 +1400,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
if let ObligationCauseCode::ImplDerived(cause) = &*code {
|
||||
try_borrowing(cause.derived.parent_trait_pred, &[])
|
||||
} else if let ObligationCauseCode::Where(_, _)
|
||||
} else if let ObligationCauseCode::SpannedItem(_, _)
|
||||
| ObligationCauseCode::MiscItem(_)
|
||||
| ObligationCauseCode::MiscItemInExpr(..)
|
||||
| ObligationCauseCode::WhereInExpr(..) = code
|
||||
| ObligationCauseCode::SpannedItemInExpr(..) = code
|
||||
{
|
||||
try_borrowing(poly_trait_pred, &never_suggest_borrow)
|
||||
} else {
|
||||
|
@ -2099,10 +2099,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
cause: &ObligationCauseCode<'tcx>,
|
||||
err: &mut Diag<'tcx>,
|
||||
) {
|
||||
// First, look for an `ExprBindingObligation`, which means we can get
|
||||
// First, look for an `SpannedItemInExpr`, which means we can get
|
||||
// the uninstantiated predicate list of the called function. And check
|
||||
// that the predicate that we failed to satisfy is a `Fn`-like trait.
|
||||
if let ObligationCauseCode::WhereInExpr(def_id, _, _, idx) = cause
|
||||
if let ObligationCauseCode::SpannedItemInExpr(def_id, _, _, idx) = cause
|
||||
&& let predicates = self.tcx.predicates_of(def_id).instantiate_identity(self.tcx)
|
||||
&& let Some(pred) = predicates.predicates.get(*idx)
|
||||
&& let ty::ClauseKind::Trait(trait_pred) = pred.kind().skip_binder()
|
||||
|
@ -2747,8 +2747,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
// We hold the `DefId` of the item introducing the obligation, but displaying it
|
||||
// doesn't add user usable information. It always point at an associated item.
|
||||
}
|
||||
ObligationCauseCode::Where(item_def_id, span)
|
||||
| ObligationCauseCode::WhereInExpr(item_def_id, span, ..) => {
|
||||
ObligationCauseCode::SpannedItem(item_def_id, span)
|
||||
| ObligationCauseCode::SpannedItemInExpr(item_def_id, span, ..) => {
|
||||
let item_name = tcx.def_path_str(item_def_id);
|
||||
let short_item_name = with_forced_trimmed_paths!(tcx.def_path_str(item_def_id));
|
||||
let mut multispan = MultiSpan::from(span);
|
||||
|
@ -3799,7 +3799,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
// to an associated type (as seen from `trait_pred`) in the predicate. Like in
|
||||
// trait_pred `S: Sum<<Self as Iterator>::Item>` and predicate `i32: Sum<&()>`
|
||||
let mut type_diffs = vec![];
|
||||
if let ObligationCauseCode::WhereInExpr(def_id, _, _, idx) = parent_code
|
||||
if let ObligationCauseCode::SpannedItemInExpr(def_id, _, _, idx) = parent_code
|
||||
&& let Some(node_args) = typeck_results.node_args_opt(call_hir_id)
|
||||
&& let where_clauses =
|
||||
self.tcx.predicates_of(def_id).instantiate(self.tcx, node_args)
|
||||
|
@ -4955,7 +4955,7 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
|
|||
trait_name: &str,
|
||||
predicate: ty::Predicate<'_>,
|
||||
generics: &hir::Generics<'_>,
|
||||
data: &ImplDerivedObligationCause<'_>,
|
||||
data: &ImplDerivedCause<'_>,
|
||||
) {
|
||||
let ty::PredicateKind::Clause(clause) = predicate.kind().skip_binder() else {
|
||||
return;
|
||||
|
|
|
@ -1533,9 +1533,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
*err,
|
||||
);
|
||||
let code = error.obligation.cause.code().peel_derives().peel_match_impls();
|
||||
if let ObligationCauseCode::Where(..)
|
||||
if let ObligationCauseCode::SpannedItem(..)
|
||||
| ObligationCauseCode::MiscItem(..)
|
||||
| ObligationCauseCode::WhereInExpr(..)
|
||||
| ObligationCauseCode::SpannedItemInExpr(..)
|
||||
| ObligationCauseCode::MiscItemInExpr(..) = code
|
||||
{
|
||||
self.note_obligation_cause_code(
|
||||
|
@ -1611,9 +1611,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
let is_normalized_term_expected = !matches!(
|
||||
obligation.cause.code().peel_derives(),
|
||||
ObligationCauseCode::MiscItem(_)
|
||||
| ObligationCauseCode::Where(_, _)
|
||||
| ObligationCauseCode::SpannedItem(_, _)
|
||||
| ObligationCauseCode::MiscItemInExpr(..)
|
||||
| ObligationCauseCode::WhereInExpr(..)
|
||||
| ObligationCauseCode::SpannedItemInExpr(..)
|
||||
| ObligationCauseCode::Coercion { .. }
|
||||
);
|
||||
|
||||
|
@ -2881,8 +2881,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
else {
|
||||
return;
|
||||
};
|
||||
let (ObligationCauseCode::Where(item_def_id, span)
|
||||
| ObligationCauseCode::WhereInExpr(item_def_id, span, ..)) =
|
||||
let (ObligationCauseCode::SpannedItem(item_def_id, span)
|
||||
| ObligationCauseCode::SpannedItemInExpr(item_def_id, span, ..)) =
|
||||
*obligation.cause.code().peel_derives()
|
||||
else {
|
||||
return;
|
||||
|
@ -3179,7 +3179,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
ObligationCauseCode::RustCall => {
|
||||
err.primary_message("functions with the \"rust-call\" ABI must take a single non-self tuple argument");
|
||||
}
|
||||
ObligationCauseCode::Where(def_id, _) | ObligationCauseCode::MiscItem(def_id)
|
||||
ObligationCauseCode::SpannedItem(def_id, _) | ObligationCauseCode::MiscItem(def_id)
|
||||
if self.tcx.is_fn_trait(*def_id) =>
|
||||
{
|
||||
err.code(E0059);
|
||||
|
|
|
@ -576,7 +576,7 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>(
|
|||
if span.is_dummy() {
|
||||
ObligationCauseCode::MiscItem(alias_ty.def_id)
|
||||
} else {
|
||||
ObligationCauseCode::Where(alias_ty.def_id, span)
|
||||
ObligationCauseCode::SpannedItem(alias_ty.def_id, span)
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -2129,7 +2129,7 @@ fn assoc_ty_own_obligations<'cx, 'tcx>(
|
|||
ObligationCause::new(
|
||||
obligation.cause.span,
|
||||
obligation.cause.body_id,
|
||||
ObligationCauseCode::Where(obligation.predicate.def_id, span),
|
||||
ObligationCauseCode::SpannedItem(obligation.predicate.def_id, span),
|
||||
)
|
||||
};
|
||||
nested.push(Obligation::with_depth(
|
||||
|
|
|
@ -26,7 +26,7 @@ use crate::traits::vtable::{
|
|||
VtblSegment,
|
||||
};
|
||||
use crate::traits::{
|
||||
ImplDerivedObligationCause, ImplSource, ImplSourceUserDefinedData, Normalized, Obligation,
|
||||
ImplDerivedCause, ImplSource, ImplSourceUserDefinedData, Normalized, Obligation,
|
||||
ObligationCause, PolyTraitObligation, PredicateObligation, Selection, SelectionError,
|
||||
SignatureMismatch, TraitNotObjectSafe, TraitObligation, Unimplemented,
|
||||
};
|
||||
|
@ -275,7 +275,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
bug!("obligation {:?} had matched a builtin impl but now doesn't", obligation);
|
||||
};
|
||||
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerivedObligation);
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerived);
|
||||
self.collect_predicates_for_types(
|
||||
obligation.param_env,
|
||||
cause,
|
||||
|
@ -435,7 +435,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> Vec<PredicateObligation<'tcx>> {
|
||||
debug!(?nested, "vtable_auto_impl");
|
||||
ensure_sufficient_stack(|| {
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerivedObligation);
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerived);
|
||||
|
||||
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
|
||||
let trait_ref = self.infcx.enter_forall_and_leak_universe(poly_trait_ref);
|
||||
|
@ -723,7 +723,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let mut nested =
|
||||
self.equate_trait_refs(obligation.with(tcx, placeholder_predicate), trait_ref)?;
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerivedObligation);
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerived);
|
||||
|
||||
// Confirm the `type Output: Sized;` bound that is present on `FnOnce`
|
||||
let output_ty = self.infcx.enter_forall_and_leak_universe(sig.output());
|
||||
|
@ -1381,7 +1381,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let self_ty = obligation.self_ty().map_bound(|ty| self.infcx.shallow_resolve(ty));
|
||||
|
||||
let mut nested = vec![];
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerivedObligation);
|
||||
let cause = obligation.derived_cause(ObligationCauseCode::BuiltinDerived);
|
||||
|
||||
// If we have a custom `impl const Drop`, then
|
||||
// first check it like a regular impl candidate.
|
||||
|
@ -1396,7 +1396,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
debug!(?args, "impl args");
|
||||
|
||||
let cause = obligation.derived_cause(|derived| {
|
||||
ObligationCauseCode::ImplDerived(Box::new(ImplDerivedObligationCause {
|
||||
ObligationCauseCode::ImplDerived(Box::new(ImplDerivedCause {
|
||||
derived,
|
||||
impl_or_alias_def_id: impl_def_id,
|
||||
impl_def_predicate_index: None,
|
||||
|
|
|
@ -13,8 +13,8 @@ use super::util;
|
|||
use super::util::closure_trait_ref_and_return_type;
|
||||
use super::wf;
|
||||
use super::{
|
||||
ImplDerivedObligationCause, Normalized, Obligation, ObligationCause, ObligationCauseCode,
|
||||
Overflow, PolyTraitObligation, PredicateObligation, Selection, SelectionError, SelectionResult,
|
||||
ImplDerivedCause, Normalized, Obligation, ObligationCause, ObligationCauseCode, Overflow,
|
||||
PolyTraitObligation, PredicateObligation, Selection, SelectionError, SelectionResult,
|
||||
TraitQueryMode,
|
||||
};
|
||||
|
||||
|
@ -2771,7 +2771,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
cause.clone()
|
||||
} else {
|
||||
cause.clone().derived_cause(parent_trait_pred, |derived| {
|
||||
ObligationCauseCode::ImplDerived(Box::new(ImplDerivedObligationCause {
|
||||
ObligationCauseCode::ImplDerived(Box::new(ImplDerivedCause {
|
||||
derived,
|
||||
impl_or_alias_def_id: def_id,
|
||||
impl_def_predicate_index: Some(index),
|
||||
|
|
|
@ -382,7 +382,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
if let Some(parent_trait_pred) = predicate.to_opt_poly_trait_pred() {
|
||||
cause = cause.derived_cause(
|
||||
parent_trait_pred,
|
||||
traits::ObligationCauseCode::WellFormedDerivedObligation,
|
||||
traits::ObligationCauseCode::WellFormedDerived,
|
||||
);
|
||||
}
|
||||
extend_cause_with_original_assoc_item_obligation(tcx, item, &mut cause, predicate);
|
||||
|
@ -568,7 +568,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
let code = if span.is_dummy() {
|
||||
ObligationCauseCode::MiscItem(origin_def_id)
|
||||
} else {
|
||||
ObligationCauseCode::Where(origin_def_id, span)
|
||||
ObligationCauseCode::SpannedItem(origin_def_id, span)
|
||||
};
|
||||
let cause = self.cause(code);
|
||||
traits::Obligation::with_depth(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue