Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6f77bfe

Browse files
Name tweaks
1 parent 9108294 commit 6f77bfe

File tree

22 files changed

+87
-75
lines changed

22 files changed

+87
-75
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20592059
// We currently do not store the `DefId` in the `ConstraintCategory`
20602060
// for performances reasons. The error reporting code used by NLL only
20612061
// uses the span, so this doesn't cause any problems at the moment.
2062-
Some(ObligationCauseCode::SpannedItem(CRATE_DEF_ID.to_def_id(), predicate_span))
2062+
Some(ObligationCauseCode::SpannedWhereClause(
2063+
CRATE_DEF_ID.to_def_id(),
2064+
predicate_span,
2065+
))
20632066
} else {
20642067
None
20652068
}

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
738738
let cause = ObligationCause::new(
739739
terminator.source_info.span,
740740
self.body.source.def_id().expect_local(),
741-
ObligationCauseCode::MiscItem(callee),
741+
ObligationCauseCode::WhereClause(callee),
742742
);
743743
let normalized_predicates = ocx.normalize(&cause, param_env, predicates);
744744
ocx.register_obligations(traits::predicates_for_generics(

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx> {
819819
ObligationCause::new(
820820
self.span,
821821
self.body_id,
822-
ObligationCauseCode::SpannedItem(proj.def_id, pred_span),
822+
ObligationCauseCode::SpannedWhereClause(proj.def_id, pred_span),
823823
),
824824
self.param_env,
825825
pred,
@@ -2012,9 +2012,9 @@ pub(super) fn check_type_bounds<'tcx>(
20122012
);
20132013
let mk_cause = |span: Span| {
20142014
let code = if span.is_dummy() {
2015-
ObligationCauseCode::MiscItem(trait_ty.def_id)
2015+
ObligationCauseCode::WhereClause(trait_ty.def_id)
20162016
} else {
2017-
ObligationCauseCode::SpannedItem(trait_ty.def_id, span)
2017+
ObligationCauseCode::SpannedWhereClause(trait_ty.def_id, span)
20182018
};
20192019
ObligationCause::new(impl_ty_span, impl_ty_def_id, code)
20202020
};
@@ -2251,7 +2251,8 @@ fn try_report_async_mismatch<'tcx>(
22512251
};
22522252

22532253
for error in errors {
2254-
if let ObligationCauseCode::SpannedItem(def_id, _) = *error.root_obligation.cause.code()
2254+
if let ObligationCauseCode::SpannedWhereClause(def_id, _) =
2255+
*error.root_obligation.cause.code()
22552256
&& def_id == async_future_def_id
22562257
&& let Some(proj) = error.root_obligation.predicate.to_opt_poly_projection_pred()
22572258
&& let Some(proj) = proj.no_bound_vars()

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
15501550
let cause = traits::ObligationCause::new(
15511551
sp,
15521552
wfcx.body_def_id,
1553-
ObligationCauseCode::MiscItem(def_id.to_def_id()),
1553+
ObligationCauseCode::WhereClause(def_id.to_def_id()),
15541554
);
15551555
traits::Obligation::new(tcx, cause, wfcx.param_env, pred)
15561556
});

compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn get_impl_args(
212212
traits::ObligationCause::new(
213213
impl1_span,
214214
impl1_def_id,
215-
traits::ObligationCauseCode::SpannedItem(impl2_node.def_id(), span),
215+
traits::ObligationCauseCode::SpannedWhereClause(impl2_node.def_id(), span),
216216
)
217217
},
218218
);

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,9 +1413,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14131413
) {
14141414
self.add_required_obligations_with_code(span, def_id, args, |idx, span| {
14151415
if span.is_dummy() {
1416-
ObligationCauseCode::MiscItemInExpr(def_id, hir_id, idx)
1416+
ObligationCauseCode::WhereClauseInExpr(def_id, hir_id, idx)
14171417
} else {
1418-
ObligationCauseCode::SpannedItemInExpr(def_id, span, hir_id, idx)
1418+
ObligationCauseCode::SpannedWhereClauseInExpr(def_id, span, hir_id, idx)
14191419
}
14201420
})
14211421
}

compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1414
&self,
1515
error: &mut traits::FulfillmentError<'tcx>,
1616
) -> bool {
17-
let (ObligationCauseCode::MiscItemInExpr(def_id, hir_id, idx)
18-
| ObligationCauseCode::SpannedItemInExpr(def_id, _, hir_id, idx)) =
17+
let (ObligationCauseCode::WhereClauseInExpr(def_id, hir_id, idx)
18+
| ObligationCauseCode::SpannedWhereClauseInExpr(def_id, _, hir_id, idx)) =
1919
*error.obligation.cause.code().peel_derives()
2020
else {
2121
return false;
@@ -512,7 +512,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
512512
expr: &'tcx hir::Expr<'tcx>,
513513
) -> Result<&'tcx hir::Expr<'tcx>, &'tcx hir::Expr<'tcx>> {
514514
match obligation_cause_code {
515-
traits::ObligationCauseCode::SpannedItemInExpr(_, _, _, _) => {
515+
traits::ObligationCauseCode::SpannedWhereClauseInExpr(_, _, _, _) => {
516516
// This is the "root"; we assume that the `expr` is already pointing here.
517517
// Therefore, we return `Ok` so that this `expr` can be refined further.
518518
Ok(expr)

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20132013
for (span, code) in errors_causecode {
20142014
self.dcx().try_steal_modify_and_emit_err(span, StashKey::MaybeForgetReturn, |err| {
20152015
if let Some(fn_sig) = self.body_fn_sig()
2016-
&& let ObligationCauseCode::SpannedItemInExpr(_, _, binding_hir_id, ..) = code
2016+
&& let ObligationCauseCode::SpannedWhereClauseInExpr(_, _, binding_hir_id, ..) =
2017+
code
20172018
&& !fn_sig.output().is_unit()
20182019
{
20192020
let mut block_num = 0;
@@ -2102,7 +2103,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21022103
//
21032104
// This is because due to normalization, we often register duplicate
21042105
// obligations with misc obligations that are basically impossible to
2105-
// line back up with a useful SpannedItemInExpr.
2106+
// line back up with a useful SpannedWhereClauseInExpr.
21062107
for error in not_adjusted {
21072108
for (span, predicate, cause) in &remap_cause {
21082109
if *predicate == error.obligation.predicate

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,14 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
565565
for obligation in traits::predicates_for_generics(
566566
|idx, span| {
567567
let code = if span.is_dummy() {
568-
ObligationCauseCode::MiscItemInExpr(def_id, self.call_expr.hir_id, idx)
568+
ObligationCauseCode::WhereClauseInExpr(def_id, self.call_expr.hir_id, idx)
569569
} else {
570-
ObligationCauseCode::SpannedItemInExpr(def_id, span, self.call_expr.hir_id, idx)
570+
ObligationCauseCode::SpannedWhereClauseInExpr(
571+
def_id,
572+
span,
573+
self.call_expr.hir_id,
574+
idx,
575+
)
571576
};
572577
traits::ObligationCause::new(self.span, self.body_id, code)
573578
},

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,13 +1402,13 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14021402
ocx.register_obligations(traits::predicates_for_generics(
14031403
|idx, span| {
14041404
let code = if span.is_dummy() {
1405-
ObligationCauseCode::MiscItemInExpr(
1405+
ObligationCauseCode::WhereClauseInExpr(
14061406
impl_def_id,
14071407
self.scope_expr_id,
14081408
idx,
14091409
)
14101410
} else {
1411-
ObligationCauseCode::SpannedItemInExpr(
1411+
ObligationCauseCode::SpannedWhereClauseInExpr(
14121412
impl_def_id,
14131413
span,
14141414
self.scope_expr_id,

0 commit comments

Comments
 (0)