@@ -28,7 +28,6 @@ pub use self::select::{EvaluationCache, EvaluationResult, OverflowError, Selecti
28
28
29
29
pub type CanonicalChalkEnvironmentAndGoal < ' tcx > = Canonical < ' tcx , ChalkEnvironmentAndGoal < ' tcx > > ;
30
30
31
- pub use self :: ImplSource :: * ;
32
31
pub use self :: ObligationCauseCode :: * ;
33
32
34
33
pub use self :: chalk:: { ChalkEnvironmentAndGoal , RustInterner as ChalkRustInterner } ;
@@ -418,10 +417,10 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
418
417
///
419
418
/// // Case B: ImplSource must be provided by caller. This applies when
420
419
/// // type is a type parameter.
421
- /// param.clone(); // ImplSourceParam
420
+ /// param.clone(); // ImplSource::Param
422
421
///
423
422
/// // Case C: A mix of cases A and B.
424
- /// mixed.clone(); // ImplSource(Impl_1, [ImplSourceParam ])
423
+ /// mixed.clone(); // ImplSource(Impl_1, [ImplSource::Param ])
425
424
/// }
426
425
/// ```
427
426
///
@@ -431,72 +430,72 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
431
430
#[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , TypeFoldable , Lift ) ]
432
431
pub enum ImplSource < ' tcx , N > {
433
432
/// ImplSource identifying a particular impl.
434
- ImplSourceUserDefined ( ImplSourceUserDefinedData < ' tcx , N > ) ,
433
+ UserDefined ( ImplSourceUserDefinedData < ' tcx , N > ) ,
435
434
436
435
/// ImplSource for auto trait implementations.
437
436
/// This carries the information and nested obligations with regards
438
437
/// to an auto implementation for a trait `Trait`. The nested obligations
439
438
/// ensure the trait implementation holds for all the constituent types.
440
- ImplSourceAutoImpl ( ImplSourceAutoImplData < N > ) ,
439
+ AutoImpl ( ImplSourceAutoImplData < N > ) ,
441
440
442
441
/// Successful resolution to an obligation provided by the caller
443
442
/// for some type parameter. The `Vec<N>` represents the
444
443
/// obligations incurred from normalizing the where-clause (if
445
444
/// any).
446
- ImplSourceParam ( Vec < N > ) ,
445
+ Param ( Vec < N > ) ,
447
446
448
447
/// Virtual calls through an object.
449
- ImplSourceObject ( ImplSourceObjectData < ' tcx , N > ) ,
448
+ Object ( ImplSourceObjectData < ' tcx , N > ) ,
450
449
451
450
/// Successful resolution for a builtin trait.
452
- ImplSourceBuiltin ( ImplSourceBuiltinData < N > ) ,
451
+ Builtin ( ImplSourceBuiltinData < N > ) ,
453
452
454
453
/// ImplSource automatically generated for a closure. The `DefId` is the ID
455
- /// of the closure expression. This is a `ImplSourceUserDefined ` in spirit, but the
454
+ /// of the closure expression. This is a `ImplSource::UserDefined ` in spirit, but the
456
455
/// impl is generated by the compiler and does not appear in the source.
457
- ImplSourceClosure ( ImplSourceClosureData < ' tcx , N > ) ,
456
+ Closure ( ImplSourceClosureData < ' tcx , N > ) ,
458
457
459
458
/// Same as above, but for a function pointer type with the given signature.
460
- ImplSourceFnPointer ( ImplSourceFnPointerData < ' tcx , N > ) ,
459
+ FnPointer ( ImplSourceFnPointerData < ' tcx , N > ) ,
461
460
462
461
/// ImplSource for a builtin `DeterminantKind` trait implementation.
463
- ImplSourceDiscriminantKind ( ImplSourceDiscriminantKindData ) ,
462
+ DiscriminantKind ( ImplSourceDiscriminantKindData ) ,
464
463
465
464
/// ImplSource automatically generated for a generator.
466
- ImplSourceGenerator ( ImplSourceGeneratorData < ' tcx , N > ) ,
465
+ Generator ( ImplSourceGeneratorData < ' tcx , N > ) ,
467
466
468
467
/// ImplSource for a trait alias.
469
- ImplSourceTraitAlias ( ImplSourceTraitAliasData < ' tcx , N > ) ,
468
+ TraitAlias ( ImplSourceTraitAliasData < ' tcx , N > ) ,
470
469
}
471
470
472
471
impl < ' tcx , N > ImplSource < ' tcx , N > {
473
472
pub fn nested_obligations ( self ) -> Vec < N > {
474
473
match self {
475
- ImplSourceUserDefined ( i) => i. nested ,
476
- ImplSourceParam ( n) => n,
477
- ImplSourceBuiltin ( i) => i. nested ,
478
- ImplSourceAutoImpl ( d) => d. nested ,
479
- ImplSourceClosure ( c) => c. nested ,
480
- ImplSourceGenerator ( c) => c. nested ,
481
- ImplSourceObject ( d) => d. nested ,
482
- ImplSourceFnPointer ( d) => d. nested ,
483
- ImplSourceDiscriminantKind ( ImplSourceDiscriminantKindData ) => Vec :: new ( ) ,
484
- ImplSourceTraitAlias ( d) => d. nested ,
474
+ ImplSource :: UserDefined ( i) => i. nested ,
475
+ ImplSource :: Param ( n) => n,
476
+ ImplSource :: Builtin ( i) => i. nested ,
477
+ ImplSource :: AutoImpl ( d) => d. nested ,
478
+ ImplSource :: Closure ( c) => c. nested ,
479
+ ImplSource :: Generator ( c) => c. nested ,
480
+ ImplSource :: Object ( d) => d. nested ,
481
+ ImplSource :: FnPointer ( d) => d. nested ,
482
+ ImplSource :: DiscriminantKind ( ImplSourceDiscriminantKindData ) => Vec :: new ( ) ,
483
+ ImplSource :: TraitAlias ( d) => d. nested ,
485
484
}
486
485
}
487
486
488
487
pub fn borrow_nested_obligations ( & self ) -> & [ N ] {
489
488
match & self {
490
- ImplSourceUserDefined ( i) => & i. nested [ ..] ,
491
- ImplSourceParam ( n) => & n[ ..] ,
492
- ImplSourceBuiltin ( i) => & i. nested [ ..] ,
493
- ImplSourceAutoImpl ( d) => & d. nested [ ..] ,
494
- ImplSourceClosure ( c) => & c. nested [ ..] ,
495
- ImplSourceGenerator ( c) => & c. nested [ ..] ,
496
- ImplSourceObject ( d) => & d. nested [ ..] ,
497
- ImplSourceFnPointer ( d) => & d. nested [ ..] ,
498
- ImplSourceDiscriminantKind ( ImplSourceDiscriminantKindData ) => & [ ] ,
499
- ImplSourceTraitAlias ( d) => & d. nested [ ..] ,
489
+ ImplSource :: UserDefined ( i) => & i. nested [ ..] ,
490
+ ImplSource :: Param ( n) => & n[ ..] ,
491
+ ImplSource :: Builtin ( i) => & i. nested [ ..] ,
492
+ ImplSource :: AutoImpl ( d) => & d. nested [ ..] ,
493
+ ImplSource :: Closure ( c) => & c. nested [ ..] ,
494
+ ImplSource :: Generator ( c) => & c. nested [ ..] ,
495
+ ImplSource :: Object ( d) => & d. nested [ ..] ,
496
+ ImplSource :: FnPointer ( d) => & d. nested [ ..] ,
497
+ ImplSource :: DiscriminantKind ( ImplSourceDiscriminantKindData ) => & [ ] ,
498
+ ImplSource :: TraitAlias ( d) => & d. nested [ ..] ,
500
499
}
501
500
}
502
501
@@ -505,42 +504,42 @@ impl<'tcx, N> ImplSource<'tcx, N> {
505
504
F : FnMut ( N ) -> M ,
506
505
{
507
506
match self {
508
- ImplSourceUserDefined ( i) => ImplSourceUserDefined ( ImplSourceUserDefinedData {
507
+ ImplSource :: UserDefined ( i) => ImplSource :: UserDefined ( ImplSourceUserDefinedData {
509
508
impl_def_id : i. impl_def_id ,
510
509
substs : i. substs ,
511
510
nested : i. nested . into_iter ( ) . map ( f) . collect ( ) ,
512
511
} ) ,
513
- ImplSourceParam ( n) => ImplSourceParam ( n. into_iter ( ) . map ( f) . collect ( ) ) ,
514
- ImplSourceBuiltin ( i) => ImplSourceBuiltin ( ImplSourceBuiltinData {
512
+ ImplSource :: Param ( n) => ImplSource :: Param ( n. into_iter ( ) . map ( f) . collect ( ) ) ,
513
+ ImplSource :: Builtin ( i) => ImplSource :: Builtin ( ImplSourceBuiltinData {
515
514
nested : i. nested . into_iter ( ) . map ( f) . collect ( ) ,
516
515
} ) ,
517
- ImplSourceObject ( o) => ImplSourceObject ( ImplSourceObjectData {
516
+ ImplSource :: Object ( o) => ImplSource :: Object ( ImplSourceObjectData {
518
517
upcast_trait_ref : o. upcast_trait_ref ,
519
518
vtable_base : o. vtable_base ,
520
519
nested : o. nested . into_iter ( ) . map ( f) . collect ( ) ,
521
520
} ) ,
522
- ImplSourceAutoImpl ( d) => ImplSourceAutoImpl ( ImplSourceAutoImplData {
521
+ ImplSource :: AutoImpl ( d) => ImplSource :: AutoImpl ( ImplSourceAutoImplData {
523
522
trait_def_id : d. trait_def_id ,
524
523
nested : d. nested . into_iter ( ) . map ( f) . collect ( ) ,
525
524
} ) ,
526
- ImplSourceClosure ( c) => ImplSourceClosure ( ImplSourceClosureData {
525
+ ImplSource :: Closure ( c) => ImplSource :: Closure ( ImplSourceClosureData {
527
526
closure_def_id : c. closure_def_id ,
528
527
substs : c. substs ,
529
528
nested : c. nested . into_iter ( ) . map ( f) . collect ( ) ,
530
529
} ) ,
531
- ImplSourceGenerator ( c) => ImplSourceGenerator ( ImplSourceGeneratorData {
530
+ ImplSource :: Generator ( c) => ImplSource :: Generator ( ImplSourceGeneratorData {
532
531
generator_def_id : c. generator_def_id ,
533
532
substs : c. substs ,
534
533
nested : c. nested . into_iter ( ) . map ( f) . collect ( ) ,
535
534
} ) ,
536
- ImplSourceFnPointer ( p) => ImplSourceFnPointer ( ImplSourceFnPointerData {
535
+ ImplSource :: FnPointer ( p) => ImplSource :: FnPointer ( ImplSourceFnPointerData {
537
536
fn_ty : p. fn_ty ,
538
537
nested : p. nested . into_iter ( ) . map ( f) . collect ( ) ,
539
538
} ) ,
540
- ImplSourceDiscriminantKind ( ImplSourceDiscriminantKindData ) => {
541
- ImplSourceDiscriminantKind ( ImplSourceDiscriminantKindData )
539
+ ImplSource :: DiscriminantKind ( ImplSourceDiscriminantKindData ) => {
540
+ ImplSource :: DiscriminantKind ( ImplSourceDiscriminantKindData )
542
541
}
543
- ImplSourceTraitAlias ( d) => ImplSourceTraitAlias ( ImplSourceTraitAliasData {
542
+ ImplSource :: TraitAlias ( d) => ImplSource :: TraitAlias ( ImplSourceTraitAliasData {
544
543
alias_def_id : d. alias_def_id ,
545
544
substs : d. substs ,
546
545
nested : d. nested . into_iter ( ) . map ( f) . collect ( ) ,
0 commit comments