@@ -51,7 +51,7 @@ impl<'tcx> Bounds<'tcx> {
51
51
bound_trait_ref : ty:: PolyTraitRef < ' tcx > ,
52
52
span : Span ,
53
53
polarity : ty:: PredicatePolarity ,
54
- constness : ty:: BoundConstness ,
54
+ constness : Option < ty:: BoundConstness > ,
55
55
predicate_filter : PredicateFilter ,
56
56
) {
57
57
let clause = (
@@ -88,19 +88,20 @@ impl<'tcx> Bounds<'tcx> {
88
88
// associated type of `<T as Tr>` and make sure that the effect is compatible.
89
89
let compat_val = match ( tcx. def_kind ( defining_def_id) , constness) {
90
90
// FIXME(effects): revisit the correctness of this
91
- ( _, ty:: BoundConstness :: Const ) => tcx. consts . false_ ,
91
+ ( _, Some ( ty:: BoundConstness :: Const ) ) => tcx. consts . false_ ,
92
92
// body owners that can have trait bounds
93
- ( DefKind :: Const | DefKind :: Fn | DefKind :: AssocFn , ty:: BoundConstness :: ConstIfConst ) => {
94
- tcx. expected_host_effect_param_for_body ( defining_def_id)
95
- }
93
+ (
94
+ DefKind :: Const | DefKind :: Fn | DefKind :: AssocFn ,
95
+ Some ( ty:: BoundConstness :: ConstIfConst ) ,
96
+ ) => tcx. expected_host_effect_param_for_body ( defining_def_id) ,
96
97
97
- ( _, ty :: BoundConstness :: NotConst ) => {
98
+ ( _, None ) => {
98
99
if !tcx. is_const_trait ( bound_trait_ref. def_id ( ) ) {
99
100
return ;
100
101
}
101
102
tcx. consts . true_
102
103
}
103
- ( DefKind :: Trait , ty:: BoundConstness :: ConstIfConst ) => {
104
+ ( DefKind :: Trait , Some ( ty:: BoundConstness :: ConstIfConst ) ) => {
104
105
// we are in a trait, where `bound_trait_ref` could be:
105
106
// (1) a super trait `trait Foo: ~const Bar`.
106
107
// - This generates `<Self as Foo>::Effects: TyCompat<<Self as Bar>::Effects>`
@@ -138,7 +139,7 @@ impl<'tcx> Bounds<'tcx> {
138
139
return ;
139
140
}
140
141
141
- ( DefKind :: Impl { of_trait : true } , ty:: BoundConstness :: ConstIfConst ) => {
142
+ ( DefKind :: Impl { of_trait : true } , Some ( ty:: BoundConstness :: ConstIfConst ) ) => {
142
143
// this is a where clause on an impl header.
143
144
// push `<T as Tr>::Effects` into the set for the `Min` bound.
144
145
let Some ( assoc) = tcx. associated_type_for_effects ( bound_trait_ref. def_id ( ) ) else {
@@ -172,12 +173,12 @@ impl<'tcx> Bounds<'tcx> {
172
173
//
173
174
// FIXME(effects) this is equality for now, which wouldn't be helpful for a non-const implementor
174
175
// that uses a `Bar` that implements `Trait` with `Maybe` effects.
175
- ( DefKind :: AssocTy , ty:: BoundConstness :: ConstIfConst ) => {
176
+ ( DefKind :: AssocTy , Some ( ty:: BoundConstness :: ConstIfConst ) ) => {
176
177
// FIXME(effects): implement this
177
178
return ;
178
179
}
179
180
// probably illegal in this position.
180
- ( _, ty:: BoundConstness :: ConstIfConst ) => {
181
+ ( _, Some ( ty:: BoundConstness :: ConstIfConst ) ) => {
181
182
tcx. dcx ( ) . span_delayed_bug ( span, "invalid `~const` encountered" ) ;
182
183
return ;
183
184
}
0 commit comments