Skip to content

Commit e642442

Browse files
authored
Rollup merge of rust-lang#131424 - workingjubilee:stem-the-tyde-of-glob-imports, r=jieyouxu
compiler: Stop reexporting enum-globs from `rustc_target::abi` Three enums had **all** their variants glob-exported into a distressingly large amount of the tree. Cease to do that, and also cease to glob import the contents of the module that contained them. Redirect relevant imports to their actual source, the `rustc_abi` crate. No functional changes.
2 parents f144469 + 43e198a commit e642442

File tree

25 files changed

+91
-47
lines changed

25 files changed

+91
-47
lines changed

Cargo.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,7 @@ dependencies = [
34163416
"measureme",
34173417
"object 0.36.4",
34183418
"rustc-demangle",
3419+
"rustc_abi",
34193420
"rustc_ast",
34203421
"rustc_attr",
34213422
"rustc_codegen_ssa",
@@ -3456,6 +3457,7 @@ dependencies = [
34563457
"object 0.36.4",
34573458
"pathdiff",
34583459
"regex",
3460+
"rustc_abi",
34593461
"rustc_arena",
34603462
"rustc_ast",
34613463
"rustc_attr",
@@ -3493,6 +3495,7 @@ name = "rustc_const_eval"
34933495
version = "0.0.0"
34943496
dependencies = [
34953497
"either",
3498+
"rustc_abi",
34963499
"rustc_apfloat",
34973500
"rustc_ast",
34983501
"rustc_attr",
@@ -3772,6 +3775,7 @@ name = "rustc_hir_typeck"
37723775
version = "0.0.0"
37733776
dependencies = [
37743777
"itertools",
3778+
"rustc_abi",
37753779
"rustc_ast",
37763780
"rustc_ast_ir",
37773781
"rustc_attr",
@@ -4027,6 +4031,7 @@ dependencies = [
40274031
"gsgdt",
40284032
"polonius-engine",
40294033
"rustc-rayon-core",
4034+
"rustc_abi",
40304035
"rustc_apfloat",
40314036
"rustc_arena",
40324037
"rustc_ast",
@@ -4522,6 +4527,7 @@ name = "rustc_ty_utils"
45224527
version = "0.0.0"
45234528
dependencies = [
45244529
"itertools",
4530+
"rustc_abi",
45254531
"rustc_ast_ir",
45264532
"rustc_data_structures",
45274533
"rustc_errors",

compiler/rustc_codegen_cranelift/src/discriminant.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
//! Adapted from <https://github.com/rust-lang/rust/blob/31c0645b9d2539f47eecb096142474b29dc542f7/compiler/rustc_codegen_ssa/src/mir/place.rs>
44
//! (<https://github.com/rust-lang/rust/pull/104535>)
55
6-
use rustc_target::abi::{Int, TagEncoding, Variants};
6+
use rustc_abi::Primitive::Int;
7+
use rustc_abi::{TagEncoding, Variants};
78

89
use crate::prelude::*;
910

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
extern crate jobserver;
1616
#[macro_use]
1717
extern crate rustc_middle;
18+
extern crate rustc_abi;
1819
extern crate rustc_ast;
1920
extern crate rustc_codegen_ssa;
2021
extern crate rustc_data_structures;

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use gccjit::{
77
BinaryOp, Block, ComparisonOp, Context, Function, LValue, Location, RValue, ToRValue, Type,
88
UnaryOp,
99
};
10+
use rustc_abi as abi;
11+
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
1012
use rustc_apfloat::{Float, Round, Status, ieee};
1113
use rustc_codegen_ssa::MemFlags;
1214
use rustc_codegen_ssa::common::{
@@ -28,7 +30,6 @@ use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
2830
use rustc_span::Span;
2931
use rustc_span::def_id::DefId;
3032
use rustc_target::abi::call::FnAbi;
31-
use rustc_target::abi::{self, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
3233
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
3334

3435
use crate::common::{SignType, TypeReflection, type_is_pointer};
@@ -998,12 +999,12 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
998999
) {
9991000
let vr = scalar.valid_range(bx);
10001001
match scalar.primitive() {
1001-
abi::Int(..) => {
1002+
abi::Primitive::Int(..) => {
10021003
if !scalar.is_always_valid(bx) {
10031004
bx.range_metadata(load, vr);
10041005
}
10051006
}
1006-
abi::Pointer(_) if vr.start < vr.end && !vr.contains(0) => {
1007+
abi::Primitive::Pointer(_) if vr.start < vr.end && !vr.contains(0) => {
10071008
bx.nonnull_metadata(load);
10081009
}
10091010
_ => {}

compiler/rustc_codegen_gcc/src/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
use gccjit::{LValue, RValue, ToRValue, Type};
2+
use rustc_abi as abi;
3+
use rustc_abi::HasDataLayout;
4+
use rustc_abi::Primitive::Pointer;
25
use rustc_codegen_ssa::traits::{
36
BaseTypeCodegenMethods, ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods,
47
};
58
use rustc_middle::mir::Mutability;
69
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
710
use rustc_middle::ty::layout::LayoutOf;
8-
use rustc_target::abi::{self, HasDataLayout, Pointer};
911

1012
use crate::consts::const_alloc_to_gcc;
1113
use crate::context::CodegenCx;

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern crate tempfile;
3232
extern crate tracing;
3333

3434
// The rustc crates we need
35+
extern crate rustc_abi;
3536
extern crate rustc_apfloat;
3637
extern crate rustc_ast;
3738
extern crate rustc_attr;

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
use std::fmt::Write;
22

33
use gccjit::{Struct, Type};
4+
use rustc_abi as abi;
5+
use rustc_abi::Primitive::*;
6+
use rustc_abi::{Abi, FieldsShape, Integer, PointeeInfo, Size, Variants};
47
use rustc_codegen_ssa::traits::{
58
BaseTypeCodegenMethods, DerivedTypeCodegenMethods, LayoutTypeCodegenMethods,
69
};
710
use rustc_middle::bug;
811
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
912
use rustc_middle::ty::print::with_no_trimmed_paths;
1013
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
14+
use rustc_target::abi::TyAbiInterface;
1115
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
12-
use rustc_target::abi::{
13-
self, Abi, FieldsShape, Float, Int, Integer, PointeeInfo, Pointer, Size, TyAbiInterface,
14-
Variants,
15-
};
1616

1717
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
1818
use crate::context::CodegenCx;

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ libc = "0.2"
1414
measureme = "11"
1515
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
1616
rustc-demangle = "0.1.21"
17+
rustc_abi = { path = "../rustc_abi" }
1718
rustc_ast = { path = "../rustc_ast" }
1819
rustc_attr = { path = "../rustc_attr" }
1920
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use std::cmp;
22

33
use libc::c_uint;
4+
use rustc_abi as abi;
5+
use rustc_abi::Primitive::Int;
6+
use rustc_abi::{HasDataLayout, Size};
47
use rustc_codegen_ssa::MemFlags;
58
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
69
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
@@ -11,7 +14,6 @@ pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA};
1114
use rustc_middle::{bug, ty};
1215
use rustc_session::config;
1316
pub(crate) use rustc_target::abi::call::*;
14-
use rustc_target::abi::{self, HasDataLayout, Int, Size};
1517
use rustc_target::spec::SanitizerSet;
1618
pub(crate) use rustc_target::spec::abi::Abi;
1719
use smallvec::SmallVec;

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::ops::Deref;
33
use std::{iter, ptr};
44

55
use libc::{c_char, c_uint};
6+
use rustc_abi as abi;
7+
use rustc_abi::{Align, Size, WrappingRange};
68
use rustc_codegen_ssa::MemFlags;
79
use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
810
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
@@ -20,7 +22,6 @@ use rustc_sanitizers::{cfi, kcfi};
2022
use rustc_session::config::OptLevel;
2123
use rustc_span::Span;
2224
use rustc_target::abi::call::FnAbi;
23-
use rustc_target::abi::{self, Align, Size, WrappingRange};
2425
use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target};
2526
use smallvec::SmallVec;
2627
use tracing::{debug, instrument};
@@ -505,12 +506,12 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
505506
}
506507

507508
match scalar.primitive() {
508-
abi::Int(..) => {
509+
abi::Primitive::Int(..) => {
509510
if !scalar.is_always_valid(bx) {
510511
bx.range_metadata(load, scalar.valid_range(bx));
511512
}
512513
}
513-
abi::Pointer(_) => {
514+
abi::Primitive::Pointer(_) => {
514515
if !scalar.valid_range(bx).contains(0) {
515516
bx.nonnull_metadata(load);
516517
}
@@ -521,7 +522,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
521522
}
522523
}
523524
}
524-
abi::Float(_) => {}
525+
abi::Primitive::Float(_) => {}
525526
}
526527
}
527528

0 commit comments

Comments
 (0)