1
Fork 0

rustc_transmute: Directly use types from rustc_abi

This commit is contained in:
Jubilee Young 2024-10-27 17:21:23 -07:00
parent 5f5c243ca0
commit 27207069d8
4 changed files with 10 additions and 10 deletions

View file

@ -62,10 +62,10 @@ impl Ref for ! {
pub mod rustc {
use std::fmt::{self, Write};
use rustc_abi::Layout;
use rustc_middle::mir::Mutability;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
use rustc_middle::ty::{self, Ty};
use rustc_target::abi::Layout;
/// A reference in the layout.
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]

View file

@ -171,12 +171,12 @@ where
#[cfg(feature = "rustc")]
pub(crate) mod rustc {
use rustc_abi::{
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
};
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
use rustc_middle::ty::{self, AdtDef, AdtKind, List, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
use rustc_span::ErrorGuaranteed;
use rustc_target::abi::{
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
};
use super::Tree;
use crate::layout::rustc::{Def, Ref, layout_of};
@ -206,7 +206,7 @@ pub(crate) mod rustc {
impl<'tcx> Tree<Def<'tcx>, Ref<'tcx>> {
pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx>) -> Result<Self, Err> {
use rustc_target::abi::HasDataLayout;
use rustc_abi::HasDataLayout;
let layout = layout_of(cx, ty)?;
if let Err(e) = ty.error_reported() {
@ -446,7 +446,7 @@ pub(crate) mod rustc {
/// Constructs a `Tree` representing the value of a enum tag.
fn from_tag(tag: ScalarInt, tcx: TyCtxt<'tcx>) -> Self {
use rustc_target::abi::Endian;
use rustc_abi::Endian;
let size = tag.size();
let bits = tag.to_bits(size);
let bytes: [u8; 16];