Use real opaque type instead of just saying impl Trait
This commit is contained in:
parent
daaae25022
commit
d3492ca852
27 changed files with 52 additions and 50 deletions
|
@ -237,12 +237,14 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
|
|||
span: Span,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
hidden_region: ty::Region<'tcx>,
|
||||
opaque_ty: ty::OpaqueTypeKey<'tcx>,
|
||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||
let opaque_ty = tcx.mk_opaque(opaque_ty.def_id.to_def_id(), opaque_ty.substs);
|
||||
let mut err = struct_span_err!(
|
||||
tcx.sess,
|
||||
span,
|
||||
E0700,
|
||||
"hidden type for `impl Trait` captures lifetime that does not appear in bounds",
|
||||
"hidden type for `{opaque_ty}` captures lifetime that does not appear in bounds",
|
||||
);
|
||||
|
||||
// Explain the region we are capturing.
|
||||
|
|
|
@ -974,14 +974,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
#[instrument(skip(self), level = "debug")]
|
||||
pub fn member_constraint(
|
||||
&self,
|
||||
opaque_type_def_id: LocalDefId,
|
||||
key: ty::OpaqueTypeKey<'tcx>,
|
||||
definition_span: Span,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
region: ty::Region<'tcx>,
|
||||
in_regions: &Lrc<Vec<ty::Region<'tcx>>>,
|
||||
) {
|
||||
self.inner.borrow_mut().unwrap_region_constraints().member_constraint(
|
||||
opaque_type_def_id,
|
||||
key,
|
||||
definition_span,
|
||||
hidden_ty,
|
||||
region,
|
||||
|
|
|
@ -394,15 +394,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
);
|
||||
|
||||
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {
|
||||
op: |r| {
|
||||
self.member_constraint(
|
||||
opaque_type_key.def_id,
|
||||
span,
|
||||
concrete_ty,
|
||||
r,
|
||||
&choice_regions,
|
||||
)
|
||||
},
|
||||
op: |r| self.member_constraint(opaque_type_key, span, concrete_ty, r, &choice_regions),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::undo_log::UndoLogs;
|
||||
use rustc_data_structures::unify as ut;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_middle::infer::unify_key::{RegionVidKey, UnifiedRegion};
|
||||
use rustc_middle::ty::ReStatic;
|
||||
|
@ -533,7 +532,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
|
||||
pub fn member_constraint(
|
||||
&mut self,
|
||||
opaque_type_def_id: LocalDefId,
|
||||
key: ty::OpaqueTypeKey<'tcx>,
|
||||
definition_span: Span,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
member_region: ty::Region<'tcx>,
|
||||
|
@ -546,7 +545,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
}
|
||||
|
||||
self.data.member_constraints.push(MemberConstraint {
|
||||
opaque_type_def_id,
|
||||
key,
|
||||
definition_span,
|
||||
hidden_ty,
|
||||
member_region,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue