diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs index 55b47817f9a..a326e8583ea 100644 --- a/compiler/rustc_smir/src/rustc_internal/mod.rs +++ b/compiler/rustc_smir/src/rustc_internal/mod.rs @@ -170,7 +170,7 @@ impl<'tcx> Tables<'tcx> { stable_mir::mir::mono::StaticDef(self.create_def_id(did)) } - pub(crate) fn layout_id(&mut self, layout: rustc_target::abi::Layout<'tcx>) -> Layout { + pub(crate) fn layout_id(&mut self, layout: rustc_abi::Layout<'tcx>) -> Layout { self.layouts.create_or_fetch(layout) } } diff --git a/compiler/rustc_smir/src/rustc_smir/alloc.rs b/compiler/rustc_smir/src/rustc_smir/alloc.rs index 0d8740ae31f..5c09879f60e 100644 --- a/compiler/rustc_smir/src/rustc_smir/alloc.rs +++ b/compiler/rustc_smir/src/rustc_smir/alloc.rs @@ -1,3 +1,4 @@ +use rustc_abi::{Align, Size}; use rustc_middle::mir::ConstValue; use rustc_middle::mir::interpret::{AllocRange, Pointer, alloc_range}; use stable_mir::Error; @@ -7,7 +8,7 @@ use stable_mir::ty::{Allocation, ProvenanceMap}; use crate::rustc_smir::{Stable, Tables}; /// Creates new empty `Allocation` from given `Align`. -fn new_empty_allocation(align: rustc_target::abi::Align) -> Allocation { +fn new_empty_allocation(align: Align) -> Allocation { Allocation { bytes: Vec::new(), provenance: ProvenanceMap { ptrs: Vec::new() }, @@ -45,7 +46,7 @@ pub(crate) fn try_new_allocation<'tcx>( .align; let mut allocation = rustc_middle::mir::interpret::Allocation::uninit(size, align.abi); allocation - .write_scalar(&tables.tcx, alloc_range(rustc_target::abi::Size::ZERO, size), scalar) + .write_scalar(&tables.tcx, alloc_range(Size::ZERO, size), scalar) .map_err(|e| e.stable(tables))?; allocation.stable(tables) } @@ -59,7 +60,7 @@ pub(crate) fn try_new_allocation<'tcx>( } ConstValue::Slice { data, meta } => { let alloc_id = tables.tcx.reserve_and_set_memory_alloc(data); - let ptr = Pointer::new(alloc_id.into(), rustc_target::abi::Size::ZERO); + let ptr = Pointer::new(alloc_id.into(), Size::ZERO); let scalar_ptr = rustc_middle::mir::interpret::Scalar::from_pointer(ptr, &tables.tcx); let scalar_meta = rustc_middle::mir::interpret::Scalar::from_target_usize(meta, &tables.tcx); @@ -72,7 +73,7 @@ pub(crate) fn try_new_allocation<'tcx>( allocation .write_scalar( &tables.tcx, - alloc_range(rustc_target::abi::Size::ZERO, tables.tcx.data_layout.pointer_size), + alloc_range(Size::ZERO, tables.tcx.data_layout.pointer_size), scalar_ptr, ) .map_err(|e| e.stable(tables))?; @@ -112,10 +113,7 @@ pub(super) fn allocation_filter<'tcx>( .map(Some) .collect(); for (i, b) in bytes.iter_mut().enumerate() { - if !alloc - .init_mask() - .get(rustc_target::abi::Size::from_bytes(i + alloc_range.start.bytes_usize())) - { + if !alloc.init_mask().get(Size::from_bytes(i + alloc_range.start.bytes_usize())) { *b = None; } } diff --git a/compiler/rustc_smir/src/rustc_smir/convert/abi.rs b/compiler/rustc_smir/src/rustc_smir/convert/abi.rs index dbfcde56f6e..410bf0f40f4 100644 --- a/compiler/rustc_smir/src/rustc_smir/convert/abi.rs +++ b/compiler/rustc_smir/src/rustc_smir/convert/abi.rs @@ -1,9 +1,9 @@ -//! Conversion of internal Rust compiler `rustc_target::abi` and `rustc_abi` items to stable ones. +//! Conversion of internal Rust compiler `rustc_target` and `rustc_abi` items to stable ones. #![allow(rustc::usage_of_qualified_ty)] use rustc_middle::ty; -use rustc_target::abi::call::Conv; +use rustc_target::callconv::{self, Conv}; use stable_mir::abi::{ AddressSpace, ArgAbi, CallConvention, FieldsShape, FloatLength, FnAbi, IntegerLength, Layout, LayoutShape, PassMode, Primitive, Scalar, TagEncoding, TyAndLayout, ValueAbi, VariantsShape, @@ -15,7 +15,7 @@ use stable_mir::ty::{Align, IndexedVal, VariantIdx}; use crate::rustc_smir::{Stable, Tables}; -impl<'tcx> Stable<'tcx> for rustc_target::abi::VariantIdx { +impl<'tcx> Stable<'tcx> for rustc_abi::VariantIdx { type T = VariantIdx; fn stable(&self, _: &mut Tables<'_>) -> Self::T { VariantIdx::to_val(self.as_usize()) @@ -33,7 +33,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Endian { } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::TyAndLayout<'tcx, ty::Ty<'tcx>> { +impl<'tcx> Stable<'tcx> for rustc_abi::TyAndLayout<'tcx, ty::Ty<'tcx>> { type T = TyAndLayout; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -41,7 +41,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::TyAndLayout<'tcx, ty::Ty<'tcx>> { } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::Layout<'tcx> { +impl<'tcx> Stable<'tcx> for rustc_abi::Layout<'tcx> { type T = Layout; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -49,9 +49,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::Layout<'tcx> { } } -impl<'tcx> Stable<'tcx> - for rustc_abi::LayoutData -{ +impl<'tcx> Stable<'tcx> for rustc_abi::LayoutData { type T = LayoutShape; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -65,7 +63,7 @@ impl<'tcx> Stable<'tcx> } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::call::FnAbi<'tcx, ty::Ty<'tcx>> { +impl<'tcx> Stable<'tcx> for callconv::FnAbi<'tcx, ty::Ty<'tcx>> { type T = FnAbi; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -81,7 +79,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::FnAbi<'tcx, ty::Ty<'tcx>> { } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::call::ArgAbi<'tcx, ty::Ty<'tcx>> { +impl<'tcx> Stable<'tcx> for callconv::ArgAbi<'tcx, ty::Ty<'tcx>> { type T = ArgAbi; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -93,7 +91,7 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::ArgAbi<'tcx, ty::Ty<'tcx>> } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::call::Conv { +impl<'tcx> Stable<'tcx> for callconv::Conv { type T = CallConvention; fn stable(&self, _tables: &mut Tables<'_>) -> Self::T { @@ -122,31 +120,29 @@ impl<'tcx> Stable<'tcx> for rustc_target::abi::call::Conv { } } -impl<'tcx> Stable<'tcx> for rustc_target::abi::call::PassMode { +impl<'tcx> Stable<'tcx> for callconv::PassMode { type T = PassMode; fn stable(&self, _tables: &mut Tables<'_>) -> Self::T { match self { - rustc_target::abi::call::PassMode::Ignore => PassMode::Ignore, - rustc_target::abi::call::PassMode::Direct(attr) => PassMode::Direct(opaque(attr)), - rustc_target::abi::call::PassMode::Pair(first, second) => { + callconv::PassMode::Ignore => PassMode::Ignore, + callconv::PassMode::Direct(attr) => PassMode::Direct(opaque(attr)), + callconv::PassMode::Pair(first, second) => { PassMode::Pair(opaque(first), opaque(second)) } - rustc_target::abi::call::PassMode::Cast { pad_i32, cast } => { + callconv::PassMode::Cast { pad_i32, cast } => { PassMode::Cast { pad_i32: *pad_i32, cast: opaque(cast) } } - rustc_target::abi::call::PassMode::Indirect { attrs, meta_attrs, on_stack } => { - PassMode::Indirect { - attrs: opaque(attrs), - meta_attrs: opaque(meta_attrs), - on_stack: *on_stack, - } - } + callconv::PassMode::Indirect { attrs, meta_attrs, on_stack } => PassMode::Indirect { + attrs: opaque(attrs), + meta_attrs: opaque(meta_attrs), + on_stack: *on_stack, + }, } } } -impl<'tcx> Stable<'tcx> for rustc_abi::FieldsShape { +impl<'tcx> Stable<'tcx> for rustc_abi::FieldsShape { type T = FieldsShape; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -163,9 +159,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::FieldsShape } } -impl<'tcx> Stable<'tcx> - for rustc_abi::Variants -{ +impl<'tcx> Stable<'tcx> for rustc_abi::Variants { type T = VariantsShape; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { @@ -185,7 +179,7 @@ impl<'tcx> Stable<'tcx> } } -impl<'tcx> Stable<'tcx> for rustc_abi::TagEncoding { +impl<'tcx> Stable<'tcx> for rustc_abi::TagEncoding { type T = TagEncoding; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { diff --git a/compiler/rustc_smir/src/rustc_smir/convert/mir.rs b/compiler/rustc_smir/src/rustc_smir/convert/mir.rs index dbae4b7e719..820d8a6be25 100644 --- a/compiler/rustc_smir/src/rustc_smir/convert/mir.rs +++ b/compiler/rustc_smir/src/rustc_smir/convert/mir.rs @@ -691,11 +691,7 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation { type T = stable_mir::ty::Allocation; fn stable(&self, tables: &mut Tables<'_>) -> Self::T { - alloc::allocation_filter( - self, - alloc_range(rustc_target::abi::Size::ZERO, self.size()), - tables, - ) + alloc::allocation_filter(self, alloc_range(rustc_abi::Size::ZERO, self.size()), tables) } } diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index 9b27b94fb5a..9032156b257 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -36,7 +36,7 @@ pub struct Tables<'tcx> { pub(crate) instances: IndexMap, InstanceDef>, pub(crate) ty_consts: IndexMap, TyConstId>, pub(crate) mir_consts: IndexMap, MirConstId>, - pub(crate) layouts: IndexMap, Layout>, + pub(crate) layouts: IndexMap, Layout>, } impl<'tcx> Tables<'tcx> {