Remove DefId
from EarlyParamRegion
(type system)
This commit is contained in:
parent
b7b350cff7
commit
bd6344d829
5 changed files with 38 additions and 44 deletions
|
@ -538,11 +538,9 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
|
|||
// the cases that were stabilized with the `impl_trait_projection`
|
||||
// feature -- see <https://github.com/rust-lang/rust/pull/115659>.
|
||||
if let DefKind::LifetimeParam = tcx.def_kind(def_id)
|
||||
&& let ty::ReEarlyParam(ty::EarlyParamRegion { def_id, .. })
|
||||
| ty::ReLateParam(ty::LateParamRegion {
|
||||
bound_region: ty::BoundRegionKind::BrNamed(def_id, _),
|
||||
..
|
||||
}) = *tcx.map_opaque_lifetime_to_parent_lifetime(def_id.expect_local())
|
||||
&& let Some(def_id) = tcx
|
||||
.map_opaque_lifetime_to_parent_lifetime(def_id.expect_local())
|
||||
.opt_param_def_id(tcx, tcx.parent(opaque_def_id.to_def_id()))
|
||||
{
|
||||
shadowed_captures.insert(def_id);
|
||||
}
|
||||
|
@ -585,12 +583,9 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
|
|||
// Check if the lifetime param was captured but isn't named in the precise captures list.
|
||||
if variances[param.index as usize] == ty::Invariant {
|
||||
if let DefKind::OpaqueTy = tcx.def_kind(tcx.parent(param.def_id))
|
||||
&& let ty::ReEarlyParam(ty::EarlyParamRegion { def_id, .. })
|
||||
| ty::ReLateParam(ty::LateParamRegion {
|
||||
bound_region: ty::BoundRegionKind::BrNamed(def_id, _),
|
||||
..
|
||||
}) = *tcx
|
||||
&& let Some(def_id) = tcx
|
||||
.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local())
|
||||
.opt_param_def_id(tcx, tcx.parent(opaque_def_id.to_def_id()))
|
||||
{
|
||||
tcx.dcx().emit_err(errors::LifetimeNotCaptured {
|
||||
opaque_span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue