@@ -165,7 +165,7 @@ impl<'tcx> ObligationCause<'tcx> {
165
165
pub fn derived_cause (
166
166
mut self ,
167
167
parent_trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
168
- variant : impl FnOnce ( DerivedObligationCause < ' tcx > ) -> ObligationCauseCode < ' tcx > ,
168
+ variant : impl FnOnce ( DerivedCause < ' tcx > ) -> ObligationCauseCode < ' tcx > ,
169
169
) -> ObligationCause < ' tcx > {
170
170
/*!
171
171
* Creates a cause for obligations that are derived from
@@ -180,8 +180,7 @@ impl<'tcx> ObligationCause<'tcx> {
180
180
// NOTE(flaper87): As of now, it keeps track of the whole error
181
181
// chain. Ideally, we should have a way to configure this either
182
182
// by using -Z verbose-internals or just a CLI argument.
183
- self . code =
184
- variant ( DerivedObligationCause { parent_trait_pred, parent_code : self . code } ) . into ( ) ;
183
+ self . code = variant ( DerivedCause { parent_trait_pred, parent_code : self . code } ) . into ( ) ;
185
184
self
186
185
}
187
186
@@ -254,16 +253,16 @@ pub enum ObligationCauseCode<'tcx> {
254
253
255
254
/// Like `MiscItem`, but carries the span of the
256
255
/// predicate when it can be identified.
257
- Where ( DefId , Span ) ,
256
+ SpannedItem ( DefId , Span ) ,
258
257
259
- /// Like `ItemObligation `, but carries the `HirId` of the
258
+ /// Like `MiscItem `, but carries the `HirId` of the
260
259
/// expression that caused the obligation, and the `usize`
261
260
/// indicates exactly which predicate it is in the list of
262
261
/// instantiated predicates.
263
262
MiscItemInExpr ( DefId , HirId , usize ) ,
264
263
265
- /// Combines `ExprItemObligation ` and `BindingObligation `.
266
- WhereInExpr ( DefId , Span , HirId , usize ) ,
264
+ /// Combines `SpannedItem ` and `MiscItemInExpr `.
265
+ SpannedItemInExpr ( DefId , Span , HirId , usize ) ,
267
266
268
267
/// A type like `&'a T` is WF only if `T: 'a`.
269
268
ReferenceOutlivesReferent ( Ty < ' tcx > ) ,
@@ -327,16 +326,18 @@ pub enum ObligationCauseCode<'tcx> {
327
326
328
327
/// Derived obligation (i.e. theoretical `where` clause) on a built-in
329
328
/// implementation like `Copy` or `Sized`.
330
- BuiltinDerived ( DerivedObligationCause < ' tcx > ) ,
329
+ BuiltinDerived ( DerivedCause < ' tcx > ) ,
331
330
332
331
/// Derived obligation (i.e. `where` clause) on an user-provided impl
333
332
/// or a trait alias.
334
- ImplDerived ( Box < ImplDerivedObligationCause < ' tcx > > ) ,
333
+ ImplDerived ( Box < ImplDerivedCause < ' tcx > > ) ,
335
334
336
335
/// Derived obligation for WF goals.
337
- WellFormedDerived ( DerivedObligationCause < ' tcx > ) ,
336
+ WellFormedDerived ( DerivedCause < ' tcx > ) ,
338
337
339
- FunctionArgumentObligation {
338
+ /// Derived obligation refined to point at a specific argument in
339
+ /// a call or method expression.
340
+ FunctionArg {
340
341
/// The node of the relevant argument in the function call.
341
342
arg_hir_id : HirId ,
342
343
/// The node of the function call.
@@ -347,7 +348,7 @@ pub enum ObligationCauseCode<'tcx> {
347
348
348
349
/// Error derived when checking an impl item is compatible with
349
350
/// its corresponding trait item's definition
350
- CompareImplItemObligation {
351
+ CompareImplItem {
351
352
impl_item_def_id : LocalDefId ,
352
353
trait_item_def_id : DefId ,
353
354
kind : ty:: AssocKind ,
@@ -495,8 +496,8 @@ pub enum WellFormedLoc {
495
496
496
497
#[ derive( Clone , Debug , PartialEq , Eq , HashStable , TyEncodable , TyDecodable ) ]
497
498
#[ derive( TypeVisitable , TypeFoldable ) ]
498
- pub struct ImplDerivedObligationCause < ' tcx > {
499
- pub derived : DerivedObligationCause < ' tcx > ,
499
+ pub struct ImplDerivedCause < ' tcx > {
500
+ pub derived : DerivedCause < ' tcx > ,
500
501
/// The `DefId` of the `impl` that gave rise to the `derived` obligation.
501
502
/// If the `derived` obligation arose from a trait alias, which conceptually has a synthetic impl,
502
503
/// then this will be the `DefId` of that trait alias. Care should therefore be taken to handle
@@ -537,9 +538,9 @@ impl<'tcx> ObligationCauseCode<'tcx> {
537
538
ObligationCauseCode :: FunctionArg { parent_code, .. } => Some ( ( parent_code, None ) ) ,
538
539
ObligationCauseCode :: BuiltinDerived ( derived)
539
540
| ObligationCauseCode :: WellFormedDerived ( derived)
540
- | ObligationCauseCode :: ImplDerived ( box ImplDerivedObligationCause {
541
- derived, ..
542
- } ) => Some ( ( & derived . parent_code , Some ( derived . parent_trait_pred ) ) ) ,
541
+ | ObligationCauseCode :: ImplDerived ( box ImplDerivedCause { derived , .. } ) => {
542
+ Some ( ( & derived. parent_code , Some ( derived . parent_trait_pred ) ) )
543
+ }
543
544
_ => None ,
544
545
}
545
546
}
@@ -592,7 +593,7 @@ pub struct IfExpressionCause<'tcx> {
592
593
593
594
#[ derive( Clone , Debug , PartialEq , Eq , HashStable , TyEncodable , TyDecodable ) ]
594
595
#[ derive( TypeVisitable , TypeFoldable ) ]
595
- pub struct DerivedObligationCause < ' tcx > {
596
+ pub struct DerivedCause < ' tcx > {
596
597
/// The trait predicate of the parent obligation that led to the
597
598
/// current obligation. Note that only trait obligations lead to
598
599
/// derived obligations, so we just store the trait predicate here
0 commit comments