Rollup merge of #124381 - compiler-errors:derived-for-wf, r=lcnr

Renamed `DerivedObligation` to `WellFormedDeriveObligation`

It's used when computing `WellFormed` obligations, so let's give it a less ambiguous name.
This commit is contained in:
Michael Goulet
2024-04-25 20:07:41 -04:00
committed by GitHub
4 changed files with 11 additions and 6 deletions

View File

@@ -328,11 +328,16 @@ pub enum ObligationCauseCode<'tcx> {
/// `static` items must have `Sync` type.
SharedStatic,
/// Derived obligation (i.e. theoretical `where` clause) on a built-in
/// implementation like `Copy` or `Sized`.
BuiltinDerivedObligation(DerivedObligationCause<'tcx>),
/// Derived obligation (i.e. `where` clause) on an user-provided impl
/// or a trait alias.
ImplDerivedObligation(Box<ImplDerivedObligationCause<'tcx>>),
DerivedObligation(DerivedObligationCause<'tcx>),
/// Derived obligation for WF goals.
WellFormedDerivedObligation(DerivedObligationCause<'tcx>),
FunctionArgumentObligation {
/// The node of the relevant argument in the function call.
@@ -534,7 +539,7 @@ impl<'tcx> ObligationCauseCode<'tcx> {
match self {
FunctionArgumentObligation { parent_code, .. } => Some((parent_code, None)),
BuiltinDerivedObligation(derived)
| DerivedObligation(derived)
| WellFormedDerivedObligation(derived)
| ImplDerivedObligation(box ImplDerivedObligationCause { derived, .. }) => {
Some((&derived.parent_code, Some(derived.parent_trait_pred)))
}