@@ -956,13 +956,26 @@ pub enum CodegenObligationError {
956
956
FulfillmentError ,
957
957
}
958
958
959
+ /// Defines the treatment of opaque types in a given inference context.
960
+ ///
961
+ /// This affects both what opaques are allowed to be defined, but also whether
962
+ /// opaques are replaced with inference vars eagerly in the old solver (e.g.
963
+ /// in projection, and in the signature during function type-checking).
959
964
#[ derive( Debug , PartialEq , Eq , Clone , Copy , Hash , HashStable , TypeFoldable , TypeVisitable ) ]
960
965
pub enum DefiningAnchor {
961
- /// `DefId` of the item.
966
+ /// Define opaques which are in-scope of the `LocalDefId`. Also, eagerly
967
+ /// replace opaque types in `replace_opaque_types_with_inference_vars`.
962
968
Bind ( LocalDefId ) ,
963
- /// When opaque types are not resolved, we `Bubble` up, meaning
964
- /// return the opaque/hidden type pair from query, for caller of query to handle it.
969
+ /// In contexts where we don't currently know what opaques are allowed to be
970
+ /// defined, such as (old solver) canonical queries, we will simply allow
971
+ /// opaques to be defined, but "bubble" them up in the canonical response or
972
+ /// otherwise treat them to be handled later.
973
+ ///
974
+ /// We do not eagerly replace opaque types in `replace_opaque_types_with_inference_vars`,
975
+ /// which may affect what predicates pass and fail in the old trait solver.
965
976
Bubble ,
966
- /// Used to catch type mismatch errors when handling opaque types.
977
+ /// Do not allow any opaques to be defined. This is used to catch type mismatch
978
+ /// errors when handling opaque types, and also should be used when we would
979
+ /// otherwise reveal opaques (such as [`Reveal::All`] reveal mode).
967
980
Error ,
968
981
}
0 commit comments