1
Fork 0

Name tweaks

This commit is contained in:
Michael Goulet 2024-05-09 21:18:48 -04:00
parent 9108294a6c
commit 6f77bfe8b6
22 changed files with 87 additions and 75 deletions

View file

@ -883,8 +883,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
err.help("...or use `match` instead of `let...else`");
}
_ => {
if let ObligationCauseCode::SpannedItem(_, span)
| ObligationCauseCode::SpannedItemInExpr(_, span, ..) =
if let ObligationCauseCode::SpannedWhereClause(_, span)
| ObligationCauseCode::SpannedWhereClauseInExpr(_, span, ..) =
cause.code().peel_derives()
&& let TypeError::RegionsPlaceholderMismatch = terr
{

View file

@ -38,8 +38,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let ObligationCauseCode::MatchImpl(parent, impl_def_id) = code else {
return None;
};
let (ObligationCauseCode::SpannedItem(_, binding_span)
| ObligationCauseCode::SpannedItemInExpr(_, binding_span, ..)) = *parent.code()
let (ObligationCauseCode::SpannedWhereClause(_, binding_span)
| ObligationCauseCode::SpannedWhereClauseInExpr(_, binding_span, ..)) = *parent.code()
else {
return None;
};

View file

@ -240,8 +240,8 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
let span = cause.span();
let (leading_ellipsis, satisfy_span, where_span, dup_span, def_id) =
if let ObligationCauseCode::MiscItem(def_id)
| ObligationCauseCode::MiscItemInExpr(def_id, ..) = *cause.code()
if let ObligationCauseCode::WhereClause(def_id)
| ObligationCauseCode::WhereClauseInExpr(def_id, ..) = *cause.code()
{
(
true,

View file

@ -214,8 +214,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
_ => cause.code(),
}
&& let (
&ObligationCauseCode::MiscItem(item_def_id)
| &ObligationCauseCode::MiscItemInExpr(item_def_id, ..),
&ObligationCauseCode::WhereClause(item_def_id)
| &ObligationCauseCode::WhereClauseInExpr(item_def_id, ..),
None,
) = (code, override_error_code)
{

View file

@ -357,13 +357,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
infer::Subtype(box ref trace)
if matches!(
&trace.cause.code().peel_derives(),
ObligationCauseCode::SpannedItem(..)
| ObligationCauseCode::SpannedItemInExpr(..)
ObligationCauseCode::SpannedWhereClause(..)
| ObligationCauseCode::SpannedWhereClauseInExpr(..)
) =>
{
// Hack to get around the borrow checker because trace.cause has an `Rc`.
if let ObligationCauseCode::SpannedItem(_, span)
| ObligationCauseCode::SpannedItemInExpr(_, span, ..) =
if let ObligationCauseCode::SpannedWhereClause(_, span)
| ObligationCauseCode::SpannedWhereClauseInExpr(_, span, ..) =
&trace.cause.code().peel_derives()
{
let span = *span;
@ -371,7 +371,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
.with_span_note(span, "the lifetime requirement is introduced here")
} else {
unreachable!(
"control flow ensures we have a `BindingObligation` or `SpannedItemInExpr` here..."
"control flow ensures we have a `BindingObligation` or `SpannedWhereClauseInExpr` here..."
)
}
}

View file

@ -103,8 +103,8 @@ impl<'tcx> InferCtxt<'tcx> {
cause.span,
sup_type,
match cause.code().peel_derives() {
ObligationCauseCode::SpannedItem(_, span)
| ObligationCauseCode::SpannedItemInExpr(_, span, ..) => Some(*span),
ObligationCauseCode::SpannedWhereClause(_, span)
| ObligationCauseCode::SpannedWhereClauseInExpr(_, span, ..) => Some(*span),
_ => None,
},
)