Remove DefiningAnchor::Bubble
from opaque wf check
This commit is contained in:
parent
64368d0279
commit
743e6d1601
7 changed files with 37 additions and 48 deletions
|
@ -1,5 +1,6 @@
|
|||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::OpaqueTyOrigin;
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
|
@ -308,20 +309,19 @@ fn check_opaque_type_well_formed<'tcx>(
|
|||
return Ok(definition_ty);
|
||||
};
|
||||
let param_env = tcx.param_env(def_id);
|
||||
// HACK This bubble is required for this tests to pass:
|
||||
// nested-return-type2-tait2.rs
|
||||
// nested-return-type2-tait3.rs
|
||||
|
||||
let mut parent_def_id = def_id;
|
||||
while tcx.def_kind(parent_def_id) == DefKind::OpaqueTy {
|
||||
parent_def_id = tcx.local_parent(parent_def_id);
|
||||
}
|
||||
|
||||
// FIXME(-Ztrait-solver=next): We probably should use `DefiningAnchor::Error`
|
||||
// and prepopulate this `InferCtxt` with known opaque values, rather than
|
||||
// using the `Bind` anchor here. For now it's fine.
|
||||
let infcx = tcx
|
||||
.infer_ctxt()
|
||||
.with_next_trait_solver(next_trait_solver)
|
||||
.with_opaque_type_inference(if next_trait_solver {
|
||||
DefiningAnchor::Bind(def_id)
|
||||
} else {
|
||||
DefiningAnchor::Bubble
|
||||
})
|
||||
.with_opaque_type_inference(DefiningAnchor::Bind(parent_def_id))
|
||||
.build();
|
||||
let ocx = ObligationCtxt::new(&infcx);
|
||||
let identity_args = GenericArgs::identity_for_item(tcx, def_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue