Skip to content

Commit 7f3af72

Browse files
Use ty::OpaqueTy everywhere
1 parent 918ede6 commit 7f3af72

File tree

55 files changed

+156
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+156
-118
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
697697
.map_bound(|p| p.predicates),
698698
None,
699699
),
700-
ty::Opaque(did, substs) => {
701-
find_fn_kind_from_did(tcx.bound_explicit_item_bounds(*did), Some(*substs))
700+
ty::Opaque(ty::OpaqueTy { def_id, substs }) => {
701+
find_fn_kind_from_did(tcx.bound_explicit_item_bounds(*def_id), Some(*substs))
702702
}
703703
ty::Closure(_, substs) => match substs.as_closure().kind() {
704704
ty::ClosureKind::Fn => Some(hir::Mutability::Not),

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
504504
let ErrorConstraintInfo { outlived_fr, span, .. } = errci;
505505

506506
let mut output_ty = self.regioncx.universal_regions().unnormalized_output_ty;
507-
if let ty::Opaque(def_id, _) = *output_ty.kind() {
507+
if let ty::Opaque(ty::OpaqueTy { def_id, substs: _ }) = *output_ty.kind() {
508508
output_ty = self.infcx.tcx.type_of(def_id)
509509
};
510510

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
8383
ConstValue::from_machine_usize(adt.variants().len() as u64, &tcx)
8484
}
8585
ty::Projection(_)
86-
| ty::Opaque(_, _)
86+
| ty::Opaque(ty::OpaqueTy { def_id: _, substs: _ })
8787
| ty::Param(_)
8888
| ty::Placeholder(_)
8989
| ty::Infer(_) => throw_inval!(TooGeneric),

compiler/rustc_const_eval/src/transform/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
241241
};
242242

243243
let kind = match parent_ty.ty.kind() {
244-
&ty::Opaque(def_id, substs) => {
244+
&ty::Opaque(ty::OpaqueTy { def_id, substs }) => {
245245
self.tcx.bound_type_of(def_id).subst(self.tcx, substs).kind()
246246
}
247247
kind => kind,

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
5858
// Types with identity (print the module path).
5959
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did: def_id, .. }, _)), substs)
6060
| ty::FnDef(def_id, substs)
61-
| ty::Opaque(def_id, substs)
61+
| ty::Opaque(ty::OpaqueTy { def_id, substs })
6262
| ty::Projection(ty::ProjectionTy { item_def_id: def_id, substs })
6363
| ty::Closure(def_id, substs)
6464
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ fn opaque_type_cycle_error(tcx: TyCtxt<'_>, def_id: LocalDefId, span: Span) -> E
14401440
impl<'tcx> ty::visit::TypeVisitor<'tcx> for OpaqueTypeCollector {
14411441
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
14421442
match *t.kind() {
1443-
ty::Opaque(def, _) => {
1443+
ty::Opaque(ty::OpaqueTy { def_id: def, substs: _ }) => {
14441444
self.0.push(def);
14451445
ControlFlow::CONTINUE
14461446
}

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
666666

667667
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
668668
let scope = tcx.hir().get_defining_scope(hir_id);
669-
let mut locator = ConstraintLocator { def_id: def_id, tcx, found: None, typeck_types: vec![] };
669+
let mut locator = ConstraintLocator { def_id, tcx, found: None, typeck_types: vec![] };
670670

671671
debug!(?scope);
672672

@@ -803,7 +803,7 @@ fn find_opaque_ty_constraints_for_rpit(
803803
if let Some(concrete) = concrete {
804804
let scope = tcx.hir().local_def_id_to_hir_id(owner_def_id);
805805
debug!(?scope);
806-
let mut locator = ConstraintChecker { def_id: def_id, tcx, found: concrete };
806+
let mut locator = ConstraintChecker { def_id, tcx, found: concrete };
807807

808808
match tcx.hir().get(scope) {
809809
Node::Item(it) => intravisit::walk_item(&mut locator, it),

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
253253
self.add_constraints_from_invariant_substs(current, data.substs, variance);
254254
}
255255

256-
ty::Opaque(_, substs) => {
256+
ty::Opaque(ty::OpaqueTy { def_id: _, substs }) => {
257257
self.add_constraints_from_invariant_substs(current, substs, variance);
258258
}
259259

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
518518

519519
let substs = sig.output().walk().find_map(|arg| {
520520
if let ty::GenericArgKind::Type(ty) = arg.unpack()
521-
&& let ty::Opaque(def_id, substs) = *ty.kind()
521+
&& let ty::Opaque(ty::OpaqueTy { def_id, substs }) = *ty.kind()
522522
&& def_id == rpit_def_id
523523
{
524524
Some(substs)

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
119119
ty::Foreign(..) => Some(PointerKind::Thin),
120120
// We should really try to normalize here.
121121
ty::Projection(pi) => Some(PointerKind::OfProjection(pi)),
122-
ty::Opaque(def_id, substs) => Some(PointerKind::OfOpaque(def_id, substs)),
122+
ty::Opaque(ty::OpaqueTy { def_id, substs }) => {
123+
Some(PointerKind::OfOpaque(def_id, substs))
124+
}
123125
ty::Param(p) => Some(PointerKind::OfParam(p)),
124126
// Insufficient type information.
125127
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => None,

0 commit comments

Comments
 (0)