diff options
Diffstat (limited to 'compiler/rustc_borrowck/src')
5 files changed, 15 insertions, 15 deletions
| diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 2217c0e14b2..ffea15bdc33 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -138,7 +138,7 @@ impl BorrowExplanation { let mut ty = local_decl.ty; if local_decl.source_info.span.desugaring_kind() == Some(DesugaringKind::ForLoop) { if let ty::Adt(adt, substs) = local_decl.ty.kind() { - if tcx.is_diagnostic_item(sym::Option, adt.did) { + if tcx.is_diagnostic_item(sym::Option, adt.did()) { // in for loop desugaring, only look at the `Some(..)` inner type ty = substs.type_at(0); } @@ -148,7 +148,7 @@ impl BorrowExplanation { // If type is an ADT that implements Drop, then // simplify output by reporting just the ADT name. ty::Adt(adt, _substs) if adt.has_dtor(tcx) && !adt.is_box() => { - ("`Drop` code", format!("type `{}`", tcx.def_path_str(adt.did))) + ("`Drop` code", format!("type `{}`", tcx.def_path_str(adt.did()))) } // Otherwise, just report the whole type (and use diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 164ebfed0f7..c2b5c16517a 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -370,7 +370,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ty::Adt(def, _) => { let variant = if let Some(idx) = variant_index { assert!(def.is_enum()); - &def.variants[idx] + &def.variant(idx) } else { def.non_enum_variant() }; @@ -701,7 +701,7 @@ impl<'tcx> BorrowedContentSource<'tcx> { BorrowedContentSource::DerefMutableRef => "a mutable reference".to_string(), BorrowedContentSource::OverloadedDeref(ty) => ty .ty_adt_def() - .and_then(|adt| match tcx.get_diagnostic_name(adt.did)? { + .and_then(|adt| match tcx.get_diagnostic_name(adt.did())? { name @ (sym::Rc | sym::Arc) => Some(format!("an `{}`", name)), _ => None, }) @@ -731,7 +731,7 @@ impl<'tcx> BorrowedContentSource<'tcx> { } BorrowedContentSource::OverloadedDeref(ty) => ty .ty_adt_def() - .and_then(|adt| match tcx.get_diagnostic_name(adt.did)? { + .and_then(|adt| match tcx.get_diagnostic_name(adt.did())? { name @ (sym::Rc | sym::Arc) => Some(format!("an `{}`", name)), _ => None, }) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index f76ec031aa9..48a70abc0b6 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -388,7 +388,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { }; let ty = move_place.ty(self.body, self.infcx.tcx).ty; let def_id = match *ty.kind() { - ty::Adt(self_def, _) => self_def.did, + ty::Adt(self_def, _) => self_def.did(), ty::Foreign(def_id) | ty::FnDef(def_id, _) | ty::Closure(def_id, _) diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 38b16fedd3a..1df7e826343 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -345,8 +345,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { ty::Adt(adt, substs) => { let generic_arg = substs[param_index as usize]; let identity_substs = - InternalSubsts::identity_for_item(self.infcx.tcx, adt.did); - let base_ty = self.infcx.tcx.mk_adt(adt, identity_substs); + InternalSubsts::identity_for_item(self.infcx.tcx, adt.did()); + let base_ty = self.infcx.tcx.mk_adt(*adt, identity_substs); let base_generic_arg = identity_substs[param_index as usize]; let adt_desc = adt.descr(); @@ -410,7 +410,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { "returns a closure that contains a reference to a captured variable, which then \ escapes the closure body" } - ty::Adt(def, _) if self.infcx.tcx.is_diagnostic_item(sym::gen_future, def.did) => { + ty::Adt(def, _) if self.infcx.tcx.is_diagnostic_item(sym::gen_future, def.did()) => { "returns an `async` block that contains a reference to a captured variable, which then \ escapes the closure body" } diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 95018e51b0e..a7cf25d43d2 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -736,13 +736,13 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { } ProjectionElem::Downcast(maybe_name, index) => match base_ty.kind() { ty::Adt(adt_def, _substs) if adt_def.is_enum() => { - if index.as_usize() >= adt_def.variants.len() { + if index.as_usize() >= adt_def.variants().len() { PlaceTy::from_ty(span_mirbug_and_err!( self, place, "cast to variant #{:?} but enum only has {:?}", index, - adt_def.variants.len() + adt_def.variants().len() )) } else { PlaceTy { ty: base_ty, variant_index: Some(index) } @@ -816,7 +816,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { let (variant, substs) = match base_ty { PlaceTy { ty, variant_index: Some(variant_index) } => match *ty.kind() { - ty::Adt(adt_def, substs) => (&adt_def.variants[variant_index], substs), + ty::Adt(adt_def, substs) => (adt_def.variant(variant_index), substs), ty::Generator(def_id, substs, _) => { let mut variants = substs.as_generator().state_tys(def_id, tcx); let Some(mut variant) = variants.nth(variant_index.into()) else { @@ -835,7 +835,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { }, PlaceTy { ty, variant_index: None } => match *ty.kind() { ty::Adt(adt_def, substs) if !adt_def.is_enum() => { - (&adt_def.variants[VariantIdx::new(0)], substs) + (adt_def.variant(VariantIdx::new(0)), substs) } ty::Closure(_, substs) => { return match substs @@ -1449,7 +1449,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { ); } }; - if variant_index.as_usize() >= adt.variants.len() { + if variant_index.as_usize() >= adt.variants().len() { span_bug!( stmt.source_info.span, "bad set discriminant ({:?} = {:?}): value of of range", @@ -1928,7 +1928,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { match *ak { AggregateKind::Adt(adt_did, variant_index, substs, _, active_field_index) => { let def = tcx.adt_def(adt_did); - let variant = &def.variants[variant_index]; + let variant = &def.variant(variant_index); let adj_field_index = active_field_index.unwrap_or(field_index); if let Some(field) = variant.fields.get(adj_field_index) { Ok(self.normalize(field.ty(tcx, substs), location)) | 
