Pass list of defineable opaque types into canonical queries

This commit is contained in:
Oli Scherer
2024-03-06 10:21:27 +00:00
parent ea44ce059b
commit 19bd91d128
30 changed files with 101 additions and 139 deletions

View File

@@ -1004,6 +1004,7 @@ pub enum CodegenObligationError {
/// opaques are replaced with inference vars eagerly in the old solver (e.g.
/// in projection, and in the signature during function type-checking).
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, HashStable, TypeFoldable, TypeVisitable)]
#[derive(TyEncodable, TyDecodable)]
pub enum DefiningAnchor<'tcx> {
/// Define opaques which are in-scope of the current item being analyzed.
/// Also, eagerly replace these opaque types in `replace_opaque_types_with_inference_vars`.
@@ -1012,14 +1013,12 @@ pub enum DefiningAnchor<'tcx> {
/// errors when handling opaque types, and also should be used when we would
/// otherwise reveal opaques (such as [`Reveal::All`] reveal mode).
Bind(&'tcx ty::List<LocalDefId>),
/// In contexts where we don't currently know what opaques are allowed to be
/// defined, such as (old solver) canonical queries, we will simply allow
/// opaques to be defined, but "bubble" them up in the canonical response or
/// otherwise treat them to be handled later.
///
/// We do not eagerly replace opaque types in `replace_opaque_types_with_inference_vars`,
/// which may affect what predicates pass and fail in the old trait solver.
Bubble,
}
impl Default for DefiningAnchor<'_> {
fn default() -> Self {
Self::Bind(ty::List::empty())
}
}
impl<'tcx> DefiningAnchor<'tcx> {