Revert "Do not allow typeck children items to constrain outer RPITs"
This reverts commit e8d9f38141
.
This commit is contained in:
parent
82ad5c95b6
commit
90939e6bce
1 changed files with 0 additions and 29 deletions
|
@ -21,7 +21,6 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi
|
||||||
use rustc_infer::infer::{
|
use rustc_infer::infer::{
|
||||||
InferCtxt, InferOk, LateBoundRegion, LateBoundRegionConversionTime, NllRegionVariableOrigin,
|
InferCtxt, InferOk, LateBoundRegion, LateBoundRegionConversionTime, NllRegionVariableOrigin,
|
||||||
};
|
};
|
||||||
use rustc_infer::traits::ObligationCause;
|
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
|
||||||
use rustc_middle::mir::AssertKind;
|
use rustc_middle::mir::AssertKind;
|
||||||
|
@ -225,34 +224,6 @@ pub(crate) fn type_check<'mir, 'tcx>(
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
|
let mut hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
|
||||||
// Check that RPITs are only constrained in their outermost
|
|
||||||
// function, otherwise report a mismatched types error.
|
|
||||||
if let hir::Node::Item(hir::Item {
|
|
||||||
kind:
|
|
||||||
hir::ItemKind::OpaqueTy(hir::OpaqueTy {
|
|
||||||
origin:
|
|
||||||
hir::OpaqueTyOrigin::AsyncFn(parent)
|
|
||||||
| hir::OpaqueTyOrigin::FnReturn(parent),
|
|
||||||
..
|
|
||||||
}),
|
|
||||||
..
|
|
||||||
}) = infcx.tcx.hir().get_by_def_id(opaque_type_key.def_id.expect_local()) &&
|
|
||||||
parent.to_def_id() != body.source.def_id()
|
|
||||||
{
|
|
||||||
infcx
|
|
||||||
.report_mismatched_types(
|
|
||||||
&ObligationCause::misc(
|
|
||||||
hidden_type.span,
|
|
||||||
infcx.tcx.hir().local_def_id_to_hir_id(
|
|
||||||
body.source.def_id().expect_local(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
infcx.tcx.mk_opaque(opaque_type_key.def_id, opaque_type_key.substs),
|
|
||||||
hidden_type.ty,
|
|
||||||
ty::error::TypeError::Mismatch,
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
}
|
|
||||||
trace!(
|
trace!(
|
||||||
"finalized opaque type {:?} to {:#?}",
|
"finalized opaque type {:?} to {:#?}",
|
||||||
opaque_type_key,
|
opaque_type_key,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue