1
Fork 0

Store the DefId of the currently typechecked item in InferCtxt

This allows opaque type inference to check for defining uses without having to pass down that def id via function arguments to every method that could possibly cause an opaque type to be compared with a concrete type
This commit is contained in:
Oli Scherer 2021-07-29 15:59:59 +00:00
parent 20371b94f6
commit b2c1919a3d
7 changed files with 34 additions and 32 deletions

View file

@ -105,7 +105,7 @@ fn mir_borrowck<'tcx>(
let (input_body, promoted) = tcx.mir_promoted(def);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def.did.to_def_id()));
let opt_closure_req = tcx.infer_ctxt().enter(|infcx| {
let opt_closure_req = tcx.infer_ctxt().with_opaque_type_inference(def.did).enter(|infcx| {
let input_body: &Body<'_> = &input_body.borrow();
let promoted: &IndexVec<_, _> = &promoted.borrow();
do_mir_borrowck(&infcx, input_body, promoted)

View file

@ -1305,7 +1305,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// (Note that the key of the map is both the def-id of `Foo` along with
// any generic parameters.)
let output_ty = obligations.add(infcx.instantiate_opaque_types(
mir_def_id,
dummy_body_id,
param_env,
anon_ty,