Make DefiningAnchor::Bind only store the opaque types that may be constrained, instead of the current infcx root item.
This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
This commit is contained in:
@@ -12,8 +12,8 @@ pub mod util;
|
||||
use crate::infer::canonical::Canonical;
|
||||
use crate::mir::ConstraintCategory;
|
||||
use crate::ty::abstract_const::NotConstEvaluatable;
|
||||
use crate::ty::GenericArgsRef;
|
||||
use crate::ty::{self, AdtKind, Ty};
|
||||
use crate::ty::{GenericArgsRef, TyCtxt};
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Applicability, Diag, EmissionGuarantee};
|
||||
@@ -1001,10 +1001,10 @@ 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)]
|
||||
pub enum DefiningAnchor {
|
||||
/// Define opaques which are in-scope of the `LocalDefId`. Also, eagerly
|
||||
/// replace opaque types in `replace_opaque_types_with_inference_vars`.
|
||||
Bind(LocalDefId),
|
||||
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`.
|
||||
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
|
||||
@@ -1018,3 +1018,9 @@ pub enum DefiningAnchor {
|
||||
/// otherwise reveal opaques (such as [`Reveal::All`] reveal mode).
|
||||
Error,
|
||||
}
|
||||
|
||||
impl<'tcx> DefiningAnchor<'tcx> {
|
||||
pub fn bind(tcx: TyCtxt<'tcx>, item: LocalDefId) -> Self {
|
||||
Self::Bind(tcx.opaque_types_defined_by(item))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user