@@ -1155,6 +1155,11 @@ pub enum PredicateAtom<'tcx> {
11551155
11561156 /// Constants must be equal. The first component is the const that is expected.
11571157 ConstEquate ( & ' tcx Const < ' tcx > , & ' tcx Const < ' tcx > ) ,
1158+
1159+ /// Represents a type found in the environment that we can use for implied bounds.
1160+ ///
1161+ /// Only used for Chalk.
1162+ TypeWellFormedFromEnv ( Ty < ' tcx > ) ,
11581163}
11591164
11601165impl < ' tcx > PredicateAtom < ' tcx > {
@@ -1450,7 +1455,8 @@ impl<'tcx> Predicate<'tcx> {
14501455 | PredicateAtom :: ClosureKind ( ..)
14511456 | PredicateAtom :: TypeOutlives ( ..)
14521457 | PredicateAtom :: ConstEvaluatable ( ..)
1453- | PredicateAtom :: ConstEquate ( ..) => None ,
1458+ | PredicateAtom :: ConstEquate ( ..)
1459+ | PredicateAtom :: TypeWellFormedFromEnv ( ..) => None ,
14541460 }
14551461 }
14561462
@@ -1465,7 +1471,8 @@ impl<'tcx> Predicate<'tcx> {
14651471 | PredicateAtom :: ObjectSafe ( ..)
14661472 | PredicateAtom :: ClosureKind ( ..)
14671473 | PredicateAtom :: ConstEvaluatable ( ..)
1468- | PredicateAtom :: ConstEquate ( ..) => None ,
1474+ | PredicateAtom :: ConstEquate ( ..)
1475+ | PredicateAtom :: TypeWellFormedFromEnv ( ..) => None ,
14691476 }
14701477 }
14711478}
@@ -1738,11 +1745,6 @@ pub struct ParamEnv<'tcx> {
17381745 ///
17391746 /// Note: This is packed, use the reveal() method to access it.
17401747 packed : CopyTaggedPtr < & ' tcx List < Predicate < ' tcx > > , traits:: Reveal , true > ,
1741-
1742- /// If this `ParamEnv` comes from a call to `tcx.param_env(def_id)`,
1743- /// register that `def_id` (useful for transitioning to the chalk trait
1744- /// solver).
1745- pub def_id : Option < DefId > ,
17461748}
17471749
17481750unsafe impl rustc_data_structures:: tagged_ptr:: Tag for traits:: Reveal {
@@ -1767,7 +1769,6 @@ impl<'tcx> fmt::Debug for ParamEnv<'tcx> {
17671769 f. debug_struct ( "ParamEnv" )
17681770 . field ( "caller_bounds" , & self . caller_bounds ( ) )
17691771 . field ( "reveal" , & self . reveal ( ) )
1770- . field ( "def_id" , & self . def_id )
17711772 . finish ( )
17721773 }
17731774}
@@ -1776,23 +1777,16 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ParamEnv<'tcx> {
17761777 fn hash_stable ( & self , hcx : & mut StableHashingContext < ' a > , hasher : & mut StableHasher ) {
17771778 self . caller_bounds ( ) . hash_stable ( hcx, hasher) ;
17781779 self . reveal ( ) . hash_stable ( hcx, hasher) ;
1779- self . def_id . hash_stable ( hcx, hasher) ;
17801780 }
17811781}
17821782
17831783impl < ' tcx > TypeFoldable < ' tcx > for ParamEnv < ' tcx > {
17841784 fn super_fold_with < F : ty:: fold:: TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
1785- ParamEnv :: new (
1786- self . caller_bounds ( ) . fold_with ( folder) ,
1787- self . reveal ( ) . fold_with ( folder) ,
1788- self . def_id . fold_with ( folder) ,
1789- )
1785+ ParamEnv :: new ( self . caller_bounds ( ) . fold_with ( folder) , self . reveal ( ) . fold_with ( folder) )
17901786 }
17911787
17921788 fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
1793- self . caller_bounds ( ) . visit_with ( visitor)
1794- || self . reveal ( ) . visit_with ( visitor)
1795- || self . def_id . visit_with ( visitor)
1789+ self . caller_bounds ( ) . visit_with ( visitor) || self . reveal ( ) . visit_with ( visitor)
17961790 }
17971791}
17981792
@@ -1803,7 +1797,7 @@ impl<'tcx> ParamEnv<'tcx> {
18031797 /// type-checking.
18041798 #[ inline]
18051799 pub fn empty ( ) -> Self {
1806- Self :: new ( List :: empty ( ) , Reveal :: UserFacing , None )
1800+ Self :: new ( List :: empty ( ) , Reveal :: UserFacing )
18071801 }
18081802
18091803 #[ inline]
@@ -1825,17 +1819,13 @@ impl<'tcx> ParamEnv<'tcx> {
18251819 /// or invoke `param_env.with_reveal_all()`.
18261820 #[ inline]
18271821 pub fn reveal_all ( ) -> Self {
1828- Self :: new ( List :: empty ( ) , Reveal :: All , None )
1822+ Self :: new ( List :: empty ( ) , Reveal :: All )
18291823 }
18301824
18311825 /// Construct a trait environment with the given set of predicates.
18321826 #[ inline]
1833- pub fn new (
1834- caller_bounds : & ' tcx List < Predicate < ' tcx > > ,
1835- reveal : Reveal ,
1836- def_id : Option < DefId > ,
1837- ) -> Self {
1838- ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, reveal) , def_id }
1827+ pub fn new ( caller_bounds : & ' tcx List < Predicate < ' tcx > > , reveal : Reveal ) -> Self {
1828+ ty:: ParamEnv { packed : CopyTaggedPtr :: new ( caller_bounds, reveal) }
18391829 }
18401830
18411831 pub fn with_user_facing ( mut self ) -> Self {
@@ -1857,12 +1847,12 @@ impl<'tcx> ParamEnv<'tcx> {
18571847 return self ;
18581848 }
18591849
1860- ParamEnv :: new ( tcx. normalize_opaque_types ( self . caller_bounds ( ) ) , Reveal :: All , self . def_id )
1850+ ParamEnv :: new ( tcx. normalize_opaque_types ( self . caller_bounds ( ) ) , Reveal :: All )
18611851 }
18621852
18631853 /// Returns this same environment but with no caller bounds.
18641854 pub fn without_caller_bounds ( self ) -> Self {
1865- Self :: new ( List :: empty ( ) , self . reveal ( ) , self . def_id )
1855+ Self :: new ( List :: empty ( ) , self . reveal ( ) )
18661856 }
18671857
18681858 /// Creates a suitable environment in which to perform trait
0 commit comments