@@ -112,6 +112,34 @@ are revalidated again in [`Checker::revalidate_conditional_constness`].
112
112
[ `wfcheck::check_impl` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/wfcheck/fn.check_impl.html
113
113
[ `Checker::revalidate_conditional_constness` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/check_consts/check/struct.Checker.html#method.revalidate_conditional_constness
114
114
115
+ ## ` explicit_implied_const_bounds ` on associated types and traits
116
+
117
+ Bounds on associated types, opaque types, and supertraits such as
118
+ ``` rust
119
+ trait Foo : ~const PartialEq {
120
+ type X : ~const PartialEq ;
121
+ }
122
+
123
+ fn foo () -> impl ~const PartialEq {
124
+ // ^ unimplemented syntax
125
+ }
126
+ ```
127
+
128
+ Have their bounds represented differently. Unlike ` const_conditions ` which need
129
+ to be proved for callers, and can be assumed inside the definition (e.g. trait
130
+ bounds on functions), these bounds need to be proved at definition (at the impl,
131
+ or when returning the opaque) but can be assumed for callers. The non-const
132
+ equivalent of these bounds are called [ ` explicit_item_bounds ` ] .
133
+
134
+ These bounds are checked in [ ` compare_impl_item::check_type_bounds ` ] for HIR
135
+ typeck, [ ` evaluate_host_effect_from_item_bounds ` ] in the old solver and
136
+ [ ` consider_additional_alias_assumptions ` ] in the new solver.
137
+
138
+ [ `explicit_item_bounds` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.explicit_item_bounds
139
+ [ `compare_impl_item::check_type_bounds` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.check_type_bounds.html
140
+ [ `evaluate_host_effect_from_item_bounds` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/effects/fn.evaluate_host_effect_from_item_bounds.html
141
+ [ `consider_additional_alias_assumptions` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/assembly/trait.GoalKind.html#tymethod.consider_additional_alias_assumptions
142
+
115
143
## Proving ` HostEffectPredicate ` s
116
144
117
145
` HostEffectPredicate ` s are implemented both in the [ old solver] and the [ new
@@ -120,7 +148,8 @@ these conditions are met:
120
148
121
149
* The predicate can be assumed from caller bounds;
122
150
* The type has a ` const ` ` impl ` for the trait, * and* that const conditions on
123
- the impl holds; or
151
+ the impl holds, * and* that the ` explicit_implied_const_bounds ` on the trait
152
+ holds; or
124
153
* The type has a built-in implementation for the trait in const contexts. For
125
154
example, ` Fn ` may be implemented by function items if their const conditions
126
155
are satisfied, or ` Destruct ` is implemented in const contexts if the type can
0 commit comments