@@ -646,97 +646,53 @@ pub enum ImplSource<'tcx, N> {
646646 /// ImplSource identifying a particular impl.
647647 UserDefined ( ImplSourceUserDefinedData < ' tcx , N > ) ,
648648
649- /// ImplSource for auto trait implementations.
650- /// This carries the information and nested obligations with regards
651- /// to an auto implementation for a trait `Trait`. The nested obligations
652- /// ensure the trait implementation holds for all the constituent types.
653- AutoImpl ( ImplSourceAutoImplData < N > ) ,
654-
655649 /// Successful resolution to an obligation provided by the caller
656650 /// for some type parameter. The `Vec<N>` represents the
657651 /// obligations incurred from normalizing the where-clause (if
658652 /// any).
659653 Param ( Vec < N > , ty:: BoundConstness ) ,
660654
661655 /// Virtual calls through an object.
662- Object ( ImplSourceObjectData < ' tcx , N > ) ,
656+ Object ( ImplSourceObjectData < N > ) ,
663657
664658 /// Successful resolution for a builtin trait.
665- Builtin ( ImplSourceBuiltinData < N > ) ,
659+ Builtin ( Vec < N > ) ,
666660
667661 /// ImplSource for trait upcasting coercion
668- TraitUpcasting ( ImplSourceTraitUpcastingData < ' tcx , N > ) ,
669-
670- /// ImplSource automatically generated for a closure. The `DefId` is the ID
671- /// of the closure expression. This is an `ImplSource::UserDefined` in spirit, but the
672- /// impl is generated by the compiler and does not appear in the source.
673- Closure ( ImplSourceClosureData < ' tcx , N > ) ,
674-
675- /// Same as above, but for a function pointer type with the given signature.
676- FnPointer ( ImplSourceFnPointerData < ' tcx , N > ) ,
677-
678- /// ImplSource automatically generated for a generator.
679- Generator ( ImplSourceGeneratorData < ' tcx , N > ) ,
680-
681- /// ImplSource automatically generated for a generator backing an async future.
682- Future ( ImplSourceFutureData < ' tcx , N > ) ,
662+ TraitUpcasting ( ImplSourceTraitUpcastingData < N > ) ,
683663
684664 /// ImplSource for a trait alias.
685665 TraitAlias ( ImplSourceTraitAliasData < ' tcx , N > ) ,
686-
687- /// ImplSource for a `const Drop` implementation.
688- ConstDestruct ( ImplSourceConstDestructData < N > ) ,
689666}
690667
691668impl < ' tcx , N > ImplSource < ' tcx , N > {
692669 pub fn nested_obligations ( self ) -> Vec < N > {
693670 match self {
694671 ImplSource :: UserDefined ( i) => i. nested ,
695- ImplSource :: Param ( n, _) => n,
696- ImplSource :: Builtin ( i) => i. nested ,
697- ImplSource :: AutoImpl ( d) => d. nested ,
698- ImplSource :: Closure ( c) => c. nested ,
699- ImplSource :: Generator ( c) => c. nested ,
700- ImplSource :: Future ( c) => c. nested ,
672+ ImplSource :: Param ( n, _) | ImplSource :: Builtin ( n) => n,
701673 ImplSource :: Object ( d) => d. nested ,
702- ImplSource :: FnPointer ( d) => d. nested ,
703674 ImplSource :: TraitAlias ( d) => d. nested ,
704675 ImplSource :: TraitUpcasting ( d) => d. nested ,
705- ImplSource :: ConstDestruct ( i) => i. nested ,
706676 }
707677 }
708678
709679 pub fn borrow_nested_obligations ( & self ) -> & [ N ] {
710680 match self {
711681 ImplSource :: UserDefined ( i) => & i. nested ,
712- ImplSource :: Param ( n, _) => n,
713- ImplSource :: Builtin ( i) => & i. nested ,
714- ImplSource :: AutoImpl ( d) => & d. nested ,
715- ImplSource :: Closure ( c) => & c. nested ,
716- ImplSource :: Generator ( c) => & c. nested ,
717- ImplSource :: Future ( c) => & c. nested ,
682+ ImplSource :: Param ( n, _) | ImplSource :: Builtin ( n) => & n,
718683 ImplSource :: Object ( d) => & d. nested ,
719- ImplSource :: FnPointer ( d) => & d. nested ,
720684 ImplSource :: TraitAlias ( d) => & d. nested ,
721685 ImplSource :: TraitUpcasting ( d) => & d. nested ,
722- ImplSource :: ConstDestruct ( i) => & i. nested ,
723686 }
724687 }
725688
726689 pub fn borrow_nested_obligations_mut ( & mut self ) -> & mut [ N ] {
727690 match self {
728691 ImplSource :: UserDefined ( i) => & mut i. nested ,
729- ImplSource :: Param ( n, _) => n,
730- ImplSource :: Builtin ( i) => & mut i. nested ,
731- ImplSource :: AutoImpl ( d) => & mut d. nested ,
732- ImplSource :: Closure ( c) => & mut c. nested ,
733- ImplSource :: Generator ( c) => & mut c. nested ,
734- ImplSource :: Future ( c) => & mut c. nested ,
692+ ImplSource :: Param ( n, _) | ImplSource :: Builtin ( n) => n,
735693 ImplSource :: Object ( d) => & mut d. nested ,
736- ImplSource :: FnPointer ( d) => & mut d. nested ,
737694 ImplSource :: TraitAlias ( d) => & mut d. nested ,
738695 ImplSource :: TraitUpcasting ( d) => & mut d. nested ,
739- ImplSource :: ConstDestruct ( i) => & mut i. nested ,
740696 }
741697 }
742698
@@ -751,54 +707,23 @@ impl<'tcx, N> ImplSource<'tcx, N> {
751707 nested : i. nested . into_iter ( ) . map ( f) . collect ( ) ,
752708 } ) ,
753709 ImplSource :: Param ( n, ct) => ImplSource :: Param ( n. into_iter ( ) . map ( f) . collect ( ) , ct) ,
754- ImplSource :: Builtin ( i) => ImplSource :: Builtin ( ImplSourceBuiltinData {
755- nested : i. nested . into_iter ( ) . map ( f) . collect ( ) ,
756- } ) ,
710+ ImplSource :: Builtin ( n) => ImplSource :: Builtin ( n. into_iter ( ) . map ( f) . collect ( ) ) ,
757711 ImplSource :: Object ( o) => ImplSource :: Object ( ImplSourceObjectData {
758- upcast_trait_ref : o. upcast_trait_ref ,
712+ upcast_trait_def_id : o. upcast_trait_def_id ,
759713 vtable_base : o. vtable_base ,
760714 nested : o. nested . into_iter ( ) . map ( f) . collect ( ) ,
761715 } ) ,
762- ImplSource :: AutoImpl ( d) => ImplSource :: AutoImpl ( ImplSourceAutoImplData {
763- trait_def_id : d. trait_def_id ,
764- nested : d. nested . into_iter ( ) . map ( f) . collect ( ) ,
765- } ) ,
766- ImplSource :: Closure ( c) => ImplSource :: Closure ( ImplSourceClosureData {
767- closure_def_id : c. closure_def_id ,
768- substs : c. substs ,
769- nested : c. nested . into_iter ( ) . map ( f) . collect ( ) ,
770- } ) ,
771- ImplSource :: Generator ( c) => ImplSource :: Generator ( ImplSourceGeneratorData {
772- generator_def_id : c. generator_def_id ,
773- substs : c. substs ,
774- nested : c. nested . into_iter ( ) . map ( f) . collect ( ) ,
775- } ) ,
776- ImplSource :: Future ( c) => ImplSource :: Future ( ImplSourceFutureData {
777- generator_def_id : c. generator_def_id ,
778- substs : c. substs ,
779- nested : c. nested . into_iter ( ) . map ( f) . collect ( ) ,
780- } ) ,
781- ImplSource :: FnPointer ( p) => ImplSource :: FnPointer ( ImplSourceFnPointerData {
782- fn_ty : p. fn_ty ,
783- nested : p. nested . into_iter ( ) . map ( f) . collect ( ) ,
784- } ) ,
785716 ImplSource :: TraitAlias ( d) => ImplSource :: TraitAlias ( ImplSourceTraitAliasData {
786717 alias_def_id : d. alias_def_id ,
787718 substs : d. substs ,
788719 nested : d. nested . into_iter ( ) . map ( f) . collect ( ) ,
789720 } ) ,
790721 ImplSource :: TraitUpcasting ( d) => {
791722 ImplSource :: TraitUpcasting ( ImplSourceTraitUpcastingData {
792- upcast_trait_ref : d. upcast_trait_ref ,
793723 vtable_vptr_slot : d. vtable_vptr_slot ,
794724 nested : d. nested . into_iter ( ) . map ( f) . collect ( ) ,
795725 } )
796726 }
797- ImplSource :: ConstDestruct ( i) => {
798- ImplSource :: ConstDestruct ( ImplSourceConstDestructData {
799- nested : i. nested . into_iter ( ) . map ( f) . collect ( ) ,
800- } )
801- }
802727 }
803728 }
804729}
@@ -823,47 +748,7 @@ pub struct ImplSourceUserDefinedData<'tcx, N> {
823748
824749#[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
825750#[ derive( TypeFoldable , TypeVisitable ) ]
826- pub struct ImplSourceGeneratorData < ' tcx , N > {
827- pub generator_def_id : DefId ,
828- pub substs : SubstsRef < ' tcx > ,
829- /// Nested obligations. This can be non-empty if the generator
830- /// signature contains associated types.
831- pub nested : Vec < N > ,
832- }
833-
834- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
835- #[ derive( TypeFoldable , TypeVisitable ) ]
836- pub struct ImplSourceFutureData < ' tcx , N > {
837- pub generator_def_id : DefId ,
838- pub substs : SubstsRef < ' tcx > ,
839- /// Nested obligations. This can be non-empty if the generator
840- /// signature contains associated types.
841- pub nested : Vec < N > ,
842- }
843-
844- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
845- #[ derive( TypeFoldable , TypeVisitable ) ]
846- pub struct ImplSourceClosureData < ' tcx , N > {
847- pub closure_def_id : DefId ,
848- pub substs : SubstsRef < ' tcx > ,
849- /// Nested obligations. This can be non-empty if the closure
850- /// signature contains associated types.
851- pub nested : Vec < N > ,
852- }
853-
854- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
855- #[ derive( TypeFoldable , TypeVisitable ) ]
856- pub struct ImplSourceAutoImplData < N > {
857- pub trait_def_id : DefId ,
858- pub nested : Vec < N > ,
859- }
860-
861- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
862- #[ derive( TypeFoldable , TypeVisitable ) ]
863- pub struct ImplSourceTraitUpcastingData < ' tcx , N > {
864- /// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
865- pub upcast_trait_ref : ty:: PolyTraitRef < ' tcx > ,
866-
751+ pub struct ImplSourceTraitUpcastingData < N > {
867752 /// The vtable is formed by concatenating together the method lists of
868753 /// the base object trait and all supertraits, pointers to supertrait vtable will
869754 /// be provided when necessary; this is the position of `upcast_trait_ref`'s vtable
@@ -873,17 +758,11 @@ pub struct ImplSourceTraitUpcastingData<'tcx, N> {
873758 pub nested : Vec < N > ,
874759}
875760
876- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
877- #[ derive( TypeFoldable , TypeVisitable ) ]
878- pub struct ImplSourceBuiltinData < N > {
879- pub nested : Vec < N > ,
880- }
881-
882761#[ derive( PartialEq , Eq , Clone , TyEncodable , TyDecodable , HashStable , Lift ) ]
883762#[ derive( TypeFoldable , TypeVisitable ) ]
884- pub struct ImplSourceObjectData < ' tcx , N > {
763+ pub struct ImplSourceObjectData < N > {
885764 /// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
886- pub upcast_trait_ref : ty :: PolyTraitRef < ' tcx > ,
765+ pub upcast_trait_def_id : DefId ,
887766
888767 /// The vtable is formed by concatenating together the method lists of
889768 /// the base object trait and all supertraits, pointers to supertrait vtable will
@@ -894,19 +773,6 @@ pub struct ImplSourceObjectData<'tcx, N> {
894773 pub nested : Vec < N > ,
895774}
896775
897- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
898- #[ derive( TypeFoldable , TypeVisitable ) ]
899- pub struct ImplSourceFnPointerData < ' tcx , N > {
900- pub fn_ty : Ty < ' tcx > ,
901- pub nested : Vec < N > ,
902- }
903-
904- #[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
905- #[ derive( TypeFoldable , TypeVisitable ) ]
906- pub struct ImplSourceConstDestructData < N > {
907- pub nested : Vec < N > ,
908- }
909-
910776#[ derive( Clone , PartialEq , Eq , TyEncodable , TyDecodable , HashStable , Lift ) ]
911777#[ derive( TypeFoldable , TypeVisitable ) ]
912778pub struct ImplSourceTraitAliasData < ' tcx , N > {
0 commit comments