Skip to content

Commit f62ed5e

Browse files
authored
Rollup merge of #132248 - workingjubilee:add-rustc-abi-to-transmute, r=compiler-errors
rustc_transmute: Directly use types from rustc_abi Using the reexport from rustc_target is not necessary here, so use rustc_abi directly.
2 parents 81d885b + 2720706 commit f62ed5e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -4496,14 +4496,14 @@ name = "rustc_transmute"
44964496
version = "0.0.0"
44974497
dependencies = [
44984498
"itertools",
4499+
"rustc_abi",
44994500
"rustc_ast_ir",
45004501
"rustc_data_structures",
45014502
"rustc_hir",
45024503
"rustc_infer",
45034504
"rustc_macros",
45044505
"rustc_middle",
45054506
"rustc_span",
4506-
"rustc_target",
45074507
"tracing",
45084508
]
45094509

compiler/rustc_transmute/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ edition = "2021"
55

66
[dependencies]
77
# tidy-alphabetical-start
8+
rustc_abi = { path = "../rustc_abi", optional = true }
89
rustc_ast_ir = { path = "../rustc_ast_ir", optional = true }
910
rustc_data_structures = { path = "../rustc_data_structures" }
1011
rustc_hir = { path = "../rustc_hir", optional = true }
1112
rustc_infer = { path = "../rustc_infer", optional = true }
1213
rustc_macros = { path = "../rustc_macros", optional = true }
1314
rustc_middle = { path = "../rustc_middle", optional = true }
1415
rustc_span = { path = "../rustc_span", optional = true }
15-
rustc_target = { path = "../rustc_target", optional = true }
1616
tracing = "0.1"
1717
# tidy-alphabetical-end
1818

1919
[features]
2020
rustc = [
21+
"dep:rustc_abi",
22+
"dep:rustc_ast_ir",
2123
"dep:rustc_hir",
2224
"dep:rustc_infer",
2325
"dep:rustc_macros",
2426
"dep:rustc_middle",
2527
"dep:rustc_span",
26-
"dep:rustc_target",
27-
"dep:rustc_ast_ir",
2828
]
2929

3030
[dev-dependencies]

compiler/rustc_transmute/src/layout/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ impl Ref for ! {
6262
pub mod rustc {
6363
use std::fmt::{self, Write};
6464

65+
use rustc_abi::Layout;
6566
use rustc_middle::mir::Mutability;
6667
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
6768
use rustc_middle::ty::{self, Ty};
68-
use rustc_target::abi::Layout;
6969

7070
/// A reference in the layout.
7171
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]

compiler/rustc_transmute/src/layout/tree.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ where
171171

172172
#[cfg(feature = "rustc")]
173173
pub(crate) mod rustc {
174+
use rustc_abi::{
175+
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
176+
};
174177
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError};
175178
use rustc_middle::ty::{self, AdtDef, AdtKind, List, ScalarInt, Ty, TyCtxt, TypeVisitableExt};
176179
use rustc_span::ErrorGuaranteed;
177-
use rustc_target::abi::{
178-
FieldIdx, FieldsShape, Layout, Size, TagEncoding, TyAndLayout, VariantIdx, Variants,
179-
};
180180

181181
use super::Tree;
182182
use crate::layout::rustc::{Def, Ref, layout_of};
@@ -206,7 +206,7 @@ pub(crate) mod rustc {
206206

207207
impl<'tcx> Tree<Def<'tcx>, Ref<'tcx>> {
208208
pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx>) -> Result<Self, Err> {
209-
use rustc_target::abi::HasDataLayout;
209+
use rustc_abi::HasDataLayout;
210210
let layout = layout_of(cx, ty)?;
211211

212212
if let Err(e) = ty.error_reported() {
@@ -446,7 +446,7 @@ pub(crate) mod rustc {
446446

447447
/// Constructs a `Tree` representing the value of a enum tag.
448448
fn from_tag(tag: ScalarInt, tcx: TyCtxt<'tcx>) -> Self {
449-
use rustc_target::abi::Endian;
449+
use rustc_abi::Endian;
450450
let size = tag.size();
451451
let bits = tag.to_bits(size);
452452
let bytes: [u8; 16];

0 commit comments

Comments
 (0)