Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abca7c1

Browse files
committedOct 9, 2024
Auto merge of #131428 - workingjubilee:rollup-1qjc2db, r=workingjubilee
Rollup of 4 pull requests Successful merges: - #129424 (Stabilize `Pin::as_deref_mut()`) - #131417 (Fix methods alignment on mobile) - #131424 (compiler: Stop reexporting enum-globs from `rustc_target::abi`) - #131426 (Fix quotation marks around debug line in `src/ci/run.sh`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4203c68 + 887b73c commit abca7c1

File tree

30 files changed

+113
-52
lines changed

30 files changed

+113
-52
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

‎compiler/rustc_codegen_llvm/src/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//! Code that is useful in various codegen modules.
22
33
use libc::{c_char, c_uint};
4+
use rustc_abi as abi;
5+
use rustc_abi::Primitive::Pointer;
6+
use rustc_abi::{AddressSpace, HasDataLayout};
47
use rustc_ast::Mutability;
58
use rustc_codegen_ssa::traits::*;
69
use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher};
@@ -9,7 +12,6 @@ use rustc_middle::bug;
912
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
1013
use rustc_middle::ty::TyCtxt;
1114
use rustc_session::cstore::DllImport;
12-
use rustc_target::abi::{self, AddressSpace, HasDataLayout, Pointer};
1315
use tracing::debug;
1416

1517
use crate::consts::const_alloc_to_llvm;

‎compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::fmt::Write;
22

3+
use rustc_abi::Primitive::{Float, Int, Pointer};
4+
use rustc_abi::{Abi, Align, FieldsShape, Scalar, Size, Variants};
35
use rustc_codegen_ssa::traits::*;
46
use rustc_middle::bug;
57
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
68
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
79
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
8-
use rustc_target::abi::{Abi, Align, FieldsShape, Float, Int, Pointer, Scalar, Size, Variants};
910
use tracing::debug;
1011

1112
use crate::common::*;

‎compiler/rustc_codegen_ssa/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ itertools = "0.12"
1414
jobserver = "0.1.28"
1515
pathdiff = "0.2.0"
1616
regex = "1.4"
17+
rustc_abi = { path = "../rustc_abi" }
1718
rustc_arena = { path = "../rustc_arena" }
1819
rustc_ast = { path = "../rustc_ast" }
1920
rustc_attr = { path = "../rustc_attr" }

‎compiler/rustc_codegen_ssa/src/mir/operand.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ use std::fmt;
33

44
use arrayvec::ArrayVec;
55
use either::Either;
6+
use rustc_abi as abi;
7+
use rustc_abi::{Abi, Align, Size};
68
use rustc_middle::bug;
79
use rustc_middle::mir::interpret::{Pointer, Scalar, alloc_range};
810
use rustc_middle::mir::{self, ConstValue};
911
use rustc_middle::ty::Ty;
1012
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
11-
use rustc_target::abi::{self, Abi, Align, Size};
1213
use tracing::debug;
1314

1415
use super::place::{PlaceRef, PlaceValue};
@@ -207,7 +208,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
207208
match alloc.0.read_scalar(
208209
bx,
209210
alloc_range(start, size),
210-
/*read_provenance*/ matches!(s.primitive(), abi::Pointer(_)),
211+
/*read_provenance*/ matches!(s.primitive(), abi::Primitive::Pointer(_)),
211212
) {
212213
Ok(val) => bx.scalar_to_backend(val, s, ty),
213214
Err(_) => bx.const_poison(ty),

‎compiler/rustc_codegen_ssa/src/mir/place.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
use rustc_abi::Primitive::{Int, Pointer};
2+
use rustc_abi::{Align, FieldsShape, Size, TagEncoding, Variants};
13
use rustc_middle::mir::tcx::PlaceTy;
24
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
35
use rustc_middle::ty::{self, Ty};
46
use rustc_middle::{bug, mir};
5-
use rustc_target::abi::{
6-
Align, FieldsShape, Int, Pointer, Size, TagEncoding, VariantIdx, Variants,
7-
};
7+
use rustc_target::abi::VariantIdx;
88
use tracing::{debug, instrument};
99

1010
use super::operand::OperandValue;

‎compiler/rustc_const_eval/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
# tidy-alphabetical-start
88
either = "1"
9+
rustc_abi = { path = "../rustc_abi" }
910
rustc_apfloat = "0.2.0"
1011
rustc_ast = { path = "../rustc_ast" }
1112
rustc_attr = { path = "../rustc_attr" }

‎compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
use std::assert_matches::assert_matches;
55

66
use either::{Either, Left, Right};
7+
use rustc_abi as abi;
8+
use rustc_abi::{Abi, HasDataLayout, Size};
79
use rustc_hir::def::Namespace;
810
use rustc_middle::mir::interpret::ScalarSizeMismatch;
911
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutOf, TyAndLayout};
1012
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
1113
use rustc_middle::ty::{ConstInt, ScalarInt, Ty, TyCtxt};
1214
use rustc_middle::{bug, mir, span_bug, ty};
13-
use rustc_target::abi::{self, Abi, HasDataLayout, Size};
1415
use tracing::trace;
1516

1617
use super::{
@@ -117,7 +118,7 @@ impl<Prov: Provenance> Immediate<Prov> {
117118
match (self, abi) {
118119
(Immediate::Scalar(scalar), Abi::Scalar(s)) => {
119120
assert_eq!(scalar.size(), s.size(cx), "{msg}: scalar value has wrong size");
120-
if !matches!(s.primitive(), abi::Pointer(..)) {
121+
if !matches!(s.primitive(), abi::Primitive::Pointer(..)) {
121122
// This is not a pointer, it should not carry provenance.
122123
assert!(
123124
matches!(scalar, Scalar::Int(..)),
@@ -131,7 +132,7 @@ impl<Prov: Provenance> Immediate<Prov> {
131132
a.size(cx),
132133
"{msg}: first component of scalar pair has wrong size"
133134
);
134-
if !matches!(a.primitive(), abi::Pointer(..)) {
135+
if !matches!(a.primitive(), abi::Primitive::Pointer(..)) {
135136
assert!(
136137
matches!(a_val, Scalar::Int(..)),
137138
"{msg}: first component of scalar pair should be an integer, but has provenance"
@@ -142,7 +143,7 @@ impl<Prov: Provenance> Immediate<Prov> {
142143
b.size(cx),
143144
"{msg}: second component of scalar pair has wrong size"
144145
);
145-
if !matches!(b.primitive(), abi::Pointer(..)) {
146+
if !matches!(b.primitive(), abi::Primitive::Pointer(..)) {
146147
assert!(
147148
matches!(b_val, Scalar::Int(..)),
148149
"{msg}: second component of scalar pair should be an integer, but has provenance"
@@ -572,7 +573,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
572573
assert_eq!(size, mplace.layout.size, "abi::Scalar size does not match layout size");
573574
let scalar = alloc.read_scalar(
574575
alloc_range(Size::ZERO, size),
575-
/*read_provenance*/ matches!(s, abi::Pointer(_)),
576+
/*read_provenance*/ matches!(s, abi::Primitive::Pointer(_)),
576577
)?;
577578
Some(ImmTy::from_scalar(scalar, mplace.layout))
578579
}
@@ -588,11 +589,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
588589
assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields
589590
let a_val = alloc.read_scalar(
590591
alloc_range(Size::ZERO, a_size),
591-
/*read_provenance*/ matches!(a, abi::Pointer(_)),
592+
/*read_provenance*/ matches!(a, abi::Primitive::Pointer(_)),
592593
)?;
593594
let b_val = alloc.read_scalar(
594595
alloc_range(b_offset, b_size),
595-
/*read_provenance*/ matches!(b, abi::Pointer(_)),
596+
/*read_provenance*/ matches!(b, abi::Primitive::Pointer(_)),
596597
)?;
597598
Some(ImmTy::from_immediate(Immediate::ScalarPair(a_val, b_val), mplace.layout))
598599
}

‎compiler/rustc_hir_typeck/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
# tidy-alphabetical-start
88
itertools = "0.12"
9+
rustc_abi = { path = "../rustc_abi" }
910
rustc_ast = { path = "../rustc_ast" }
1011
rustc_ast_ir = { path = "../rustc_ast_ir" }
1112
rustc_attr = { path = "../rustc_attr" }

‎compiler/rustc_hir_typeck/src/intrinsicck.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use hir::HirId;
2+
use rustc_abi::Primitive::Pointer;
23
use rustc_errors::codes::*;
34
use rustc_errors::struct_span_code_err;
45
use rustc_hir as hir;
56
use rustc_index::Idx;
67
use rustc_middle::bug;
78
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
89
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
9-
use rustc_target::abi::{Pointer, VariantIdx};
10+
use rustc_target::abi::VariantIdx;
1011
use tracing::trace;
1112

1213
use super::FnCtxt;

‎compiler/rustc_middle/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ field-offset = "0.3.5"
1212
gsgdt = "0.1.2"
1313
polonius-engine = "0.13.0"
1414
rustc-rayon-core = { version = "0.5.0", optional = true }
15+
rustc_abi = { path = "../rustc_abi" }
1516
rustc_apfloat = "0.2.0"
1617
rustc_arena = { path = "../rustc_arena" }
1718
rustc_ast = { path = "../rustc_ast" }

‎compiler/rustc_middle/src/ty/layout.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ use std::num::NonZero;
22
use std::ops::Bound;
33
use std::{cmp, fmt};
44

5+
use rustc_abi::Primitive::{self, Float, Int, Pointer};
6+
use rustc_abi::{
7+
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutS,
8+
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
9+
};
510
use rustc_error_messages::DiagMessage;
611
use rustc_errors::{
712
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
813
};
9-
use rustc_hir as hir;
1014
use rustc_hir::LangItem;
1115
use rustc_hir::def_id::DefId;
1216
use rustc_index::IndexVec;
@@ -15,10 +19,11 @@ use rustc_session::config::OptLevel;
1519
use rustc_span::symbol::{Symbol, sym};
1620
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1721
use rustc_target::abi::call::FnAbi;
18-
use rustc_target::abi::*;
22+
use rustc_target::abi::{FieldIdx, TyAbiInterface, VariantIdx, call};
1923
use rustc_target::spec::abi::Abi as SpecAbi;
2024
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, PanicStrategy, Target, WasmCAbi};
2125
use tracing::debug;
26+
use {rustc_abi as abi, rustc_hir as hir};
2227

2328
use crate::error::UnsupportedFnAbi;
2429
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -27,9 +32,10 @@ use crate::ty::normalize_erasing_regions::NormalizationError;
2732
use crate::ty::{self, CoroutineArgsExt, Ty, TyCtxt, TypeVisitableExt};
2833

2934
#[extension(pub trait IntegerExt)]
30-
impl Integer {
35+
impl abi::Integer {
3136
#[inline]
3237
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx> {
38+
use abi::Integer::{I8, I16, I32, I64, I128};
3339
match (*self, signed) {
3440
(I8, false) => tcx.types.u8,
3541
(I16, false) => tcx.types.u16,
@@ -44,7 +50,8 @@ impl Integer {
4450
}
4551
}
4652

47-
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: ty::IntTy) -> Integer {
53+
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: ty::IntTy) -> abi::Integer {
54+
use abi::Integer::{I8, I16, I32, I64, I128};
4855
match ity {
4956
ty::IntTy::I8 => I8,
5057
ty::IntTy::I16 => I16,
@@ -54,7 +61,8 @@ impl Integer {
5461
ty::IntTy::Isize => cx.data_layout().ptr_sized_integer(),
5562
}
5663
}
57-
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: ty::UintTy) -> Integer {
64+
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: ty::UintTy) -> abi::Integer {
65+
use abi::Integer::{I8, I16, I32, I64, I128};
5866
match ity {
5967
ty::UintTy::U8 => I8,
6068
ty::UintTy::U16 => I16,
@@ -102,7 +110,7 @@ impl Integer {
102110
tcx.data_layout().c_enum_min_size
103111
} else {
104112
// repr(Rust) enums try to be as small as possible
105-
I8
113+
Integer::I8
106114
};
107115

108116
// If there are no negative values, we can use the unsigned fit.
@@ -115,9 +123,10 @@ impl Integer {
115123
}
116124

117125
#[extension(pub trait FloatExt)]
118-
impl Float {
126+
impl abi::Float {
119127
#[inline]
120128
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
129+
use abi::Float::*;
121130
match *self {
122131
F16 => tcx.types.f16,
123132
F32 => tcx.types.f32,
@@ -127,6 +136,7 @@ impl Float {
127136
}
128137

129138
fn from_float_ty(fty: ty::FloatTy) -> Self {
139+
use abi::Float::*;
130140
match fty {
131141
ty::FloatTy::F16 => F16,
132142
ty::FloatTy::F32 => F32,

‎compiler/rustc_target/src/abi/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use std::fmt;
22
use std::ops::Deref;
33

4-
pub use Float::*;
5-
pub use Integer::*;
6-
pub use Primitive::*;
4+
use Float::*;
5+
use Primitive::*;
76
use rustc_data_structures::intern::Interned;
87
use rustc_macros::HashStable_Generic;
98

‎compiler/rustc_ty_utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
# tidy-alphabetical-start
88
itertools = "0.12"
9+
rustc_abi = { path = "../rustc_abi" }
910
rustc_ast_ir = { path = "../rustc_ast_ir" }
1011
rustc_data_structures = { path = "../rustc_data_structures" }
1112
rustc_errors = { path = "../rustc_errors" }

‎compiler/rustc_ty_utils/src/abi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use std::iter;
22

3+
use rustc_abi::Float::*;
4+
use rustc_abi::Primitive::{Float, Pointer};
5+
use rustc_abi::{Abi, AddressSpace, PointerKind, Scalar, Size};
36
use rustc_hir as hir;
47
use rustc_hir::lang_items::LangItem;
58
use rustc_middle::bug;
@@ -14,7 +17,6 @@ use rustc_target::abi::call::{
1417
ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, Conv, FnAbi, PassMode, Reg, RegKind,
1518
RiscvInterruptKind,
1619
};
17-
use rustc_target::abi::*;
1820
use rustc_target::spec::abi::Abi as SpecAbi;
1921
use tracing::debug;
2022

‎compiler/rustc_ty_utils/src/layout.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ use std::fmt::Debug;
22
use std::iter;
33

44
use hir::def_id::DefId;
5-
use rustc_hir as hir;
5+
use rustc_abi::Integer::{I8, I32};
6+
use rustc_abi::Primitive::{self, Float, Int, Pointer};
7+
use rustc_abi::{
8+
Abi, AbiAndPrefAlign, AddressSpace, Align, FieldsShape, HasDataLayout, LayoutCalculatorError,
9+
LayoutS, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, Variants, WrappingRange,
10+
};
611
use rustc_index::bit_set::BitSet;
712
use rustc_index::{IndexSlice, IndexVec};
813
use rustc_middle::bug;
@@ -18,8 +23,9 @@ use rustc_middle::ty::{
1823
use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo};
1924
use rustc_span::sym;
2025
use rustc_span::symbol::Symbol;
21-
use rustc_target::abi::*;
26+
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, Layout, VariantIdx};
2227
use tracing::{debug, instrument, trace};
28+
use {rustc_abi as abi, rustc_hir as hir};
2329

2430
use crate::errors::{
2531
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
@@ -202,9 +208,9 @@ fn layout_of_uncached<'tcx>(
202208
value: Int(I32, false),
203209
valid_range: WrappingRange { start: 0, end: 0x10FFFF },
204210
})),
205-
ty::Int(ity) => scalar(Int(Integer::from_int_ty(dl, ity), true)),
206-
ty::Uint(ity) => scalar(Int(Integer::from_uint_ty(dl, ity), false)),
207-
ty::Float(fty) => scalar(Float(Float::from_float_ty(fty))),
211+
ty::Int(ity) => scalar(Int(abi::Integer::from_int_ty(dl, ity), true)),
212+
ty::Uint(ity) => scalar(Int(abi::Integer::from_uint_ty(dl, ity), false)),
213+
ty::Float(fty) => scalar(Float(abi::Float::from_float_ty(fty))),
208214
ty::FnPtr(..) => {
209215
let mut ptr = scalar_unit(Pointer(dl.instruction_address_space));
210216
ptr.valid_range_mut().start = 1;
@@ -563,7 +569,7 @@ fn layout_of_uncached<'tcx>(
563569
}
564570

565571
let get_discriminant_type =
566-
|min, max| Integer::repr_discr(tcx, ty, &def.repr(), min, max);
572+
|min, max| abi::Integer::repr_discr(tcx, ty, &def.repr(), min, max);
567573

568574
let discriminants_iter = || {
569575
def.is_enum()
@@ -816,7 +822,7 @@ fn coroutine_layout<'tcx>(
816822

817823
// `info.variant_fields` already accounts for the reserved variants, so no need to add them.
818824
let max_discr = (info.variant_fields.len() - 1) as u128;
819-
let discr_int = Integer::fit_unsigned(max_discr);
825+
let discr_int = abi::Integer::fit_unsigned(max_discr);
820826
let tag = Scalar::Initialized {
821827
value: Primitive::Int(discr_int, /* signed = */ false),
822828
valid_range: WrappingRange { start: 0, end: max_discr },

‎library/core/src/pin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ impl<Ptr: DerefMut> Pin<Ptr> {
14221422
/// move in the future, and this method does not enable the pointee to move. "Malicious"
14231423
/// implementations of `Ptr::DerefMut` are likewise ruled out by the contract of
14241424
/// `Pin::new_unchecked`.
1425-
#[unstable(feature = "pin_deref_mut", issue = "86918")]
1425+
#[stable(feature = "pin_deref_mut", since = "CURRENT_RUSTC_VERSION")]
14261426
#[must_use = "`self` will be dropped if the result is not used"]
14271427
#[inline(always)]
14281428
pub fn as_deref_mut(self: Pin<&mut Pin<Ptr>>) -> Pin<&mut Ptr::Target> {

‎src/ci/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fi
5555
# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined,
5656
# switch to in-tree rustc.
5757
if [ "$FORCE_CI_RUSTC" == "" ]; then
58-
echo "debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured."
58+
echo 'debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.'
5959
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
6060
fi
6161

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ in src-script.js and main.js
24352435
}
24362436

24372437
/* Position of the "[-]" element. */
2438-
details.toggle:not(.top-doc) > summary {
2438+
details.toggle:not(.top-doc) > summary, .impl-items > section {
24392439
margin-left: 10px;
24402440
}
24412441
.impl-items > details.toggle > summary:not(.hideme)::before,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This test is to ensure that methods are correctly aligned on the left side.
2+
3+
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
4+
5+
// First we ensure that we have methods with and without documentation.
6+
assert: ".impl-items > details.method-toggle > summary > section.method"
7+
assert: ".impl-items > section.method"
8+
9+
// Checking on desktop.
10+
set-window-size: (900, 600)
11+
store-position: (".impl-items section.method", {"x": x})
12+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)
13+
14+
// Checking on mobile.
15+
set-window-size: (600, 600)
16+
store-position: (".impl-items section.method", {"x": x})
17+
assert-position: (".impl-items section.method", {"x": |x|}, ALL)

‎tests/rustdoc-gui/notable-trait.goml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ call-function: ("check-notable-tooltip-position", {
8585
// Checking on mobile now.
8686
set-window-size: (650, 600)
8787
call-function: ("check-notable-tooltip-position-complete", {
88-
"x": 15,
89-
"i_x": 293,
88+
"x": 25,
89+
"i_x": 303,
9090
"popover_x": 0,
9191
})
9292

0 commit comments

Comments
 (0)
Please sign in to comment.