Skip to content

Commit aee342b

Browse files
committed
Auto merge of #142186 - matthiaskrgr:rollup-cmdt6va, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #141001 (Make NonZero<char> possible) - #141700 (Atomic intrinsics : use const generic ordering, part 2) - #141993 (Use the in-tree `compiler-builtins` for the sysroot) - #142008 (const-eval error: always say in which item the error occurred) - #142053 (Add new Tier-3 targets: `loongarch32-unknown-none*`) - #142132 (`tests/ui`: A New Order [6/N]) - #142179 (store `target.min_global_align` as an `Align`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8072811 + a292c65 commit aee342b

File tree

276 files changed

+2377
-3140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+2377
-3140
lines changed

Cargo.lock

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ version = "0.4.2"
162162
source = "registry+https://github.com/rust-lang/crates.io-index"
163163
checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4"
164164
dependencies = [
165-
"object",
165+
"object 0.36.7",
166166
]
167167

168168
[[package]]
@@ -235,7 +235,7 @@ dependencies = [
235235
"cfg-if",
236236
"libc",
237237
"miniz_oxide",
238-
"object",
238+
"object 0.36.7",
239239
"rustc-demangle",
240240
"windows-targets 0.52.6",
241241
]
@@ -2509,7 +2509,19 @@ dependencies = [
25092509
"indexmap",
25102510
"memchr",
25112511
"ruzstd",
2512-
"wasmparser 0.222.1",
2512+
]
2513+
2514+
[[package]]
2515+
name = "object"
2516+
version = "0.37.0"
2517+
source = "registry+https://github.com/rust-lang/crates.io-index"
2518+
checksum = "6273adb7096cf9ab4335f258e627d8230e69d40d45567d678f552dcec6245215"
2519+
dependencies = [
2520+
"crc32fast",
2521+
"hashbrown",
2522+
"indexmap",
2523+
"memchr",
2524+
"wasmparser 0.232.0",
25132525
]
25142526

25152527
[[package]]
@@ -3109,7 +3121,7 @@ dependencies = [
31093121
"build_helper",
31103122
"gimli",
31113123
"libc",
3112-
"object",
3124+
"object 0.36.7",
31133125
"regex",
31143126
"serde_json",
31153127
"similar",
@@ -3118,11 +3130,12 @@ dependencies = [
31183130

31193131
[[package]]
31203132
name = "rustc-build-sysroot"
3121-
version = "0.5.7"
3133+
version = "0.5.8"
31223134
source = "registry+https://github.com/rust-lang/crates.io-index"
3123-
checksum = "10edc2e4393515193bd766e2f6c050b0536a68e56f2b6d56c07ababfdc114ff0"
3135+
checksum = "16d115ad7e26e0d1337f64ae6598f758194696afc2e9f34c8a6f24582529c3dc"
31243136
dependencies = [
31253137
"anyhow",
3138+
"regex",
31263139
"rustc_version",
31273140
"tempfile",
31283141
"walkdir",
@@ -3422,7 +3435,7 @@ dependencies = [
34223435
"itertools",
34233436
"libc",
34243437
"measureme",
3425-
"object",
3438+
"object 0.37.0",
34263439
"rustc-demangle",
34273440
"rustc_abi",
34283441
"rustc_ast",
@@ -3463,7 +3476,7 @@ dependencies = [
34633476
"either",
34643477
"itertools",
34653478
"libc",
3466-
"object",
3479+
"object 0.37.0",
34673480
"pathdiff",
34683481
"regex",
34693482
"rustc_abi",
@@ -4495,7 +4508,7 @@ name = "rustc_target"
44954508
version = "0.0.0"
44964509
dependencies = [
44974510
"bitflags",
4498-
"object",
4511+
"object 0.37.0",
44994512
"rustc_abi",
45004513
"rustc_data_structures",
45014514
"rustc_fs_util",
@@ -5247,7 +5260,7 @@ checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
52475260
dependencies = [
52485261
"gimli",
52495262
"hashbrown",
5250-
"object",
5263+
"object 0.36.7",
52515264
"tracing",
52525265
]
52535266

@@ -5908,15 +5921,6 @@ dependencies = [
59085921
"indexmap",
59095922
]
59105923

5911-
[[package]]
5912-
name = "wasmparser"
5913-
version = "0.222.1"
5914-
source = "registry+https://github.com/rust-lang/crates.io-index"
5915-
checksum = "fa210fd1788e6b37a1d1930f3389c48e1d6ebd1a013d34fa4b7f9e3e3bf03146"
5916-
dependencies = [
5917-
"bitflags",
5918-
]
5919-
59205924
[[package]]
59215925
name = "wasmparser"
59225926
version = "0.229.0"
@@ -5941,6 +5945,15 @@ dependencies = [
59415945
"semver",
59425946
]
59435947

5948+
[[package]]
5949+
name = "wasmparser"
5950+
version = "0.232.0"
5951+
source = "registry+https://github.com/rust-lang/crates.io-index"
5952+
checksum = "917739b33bb1eb0e9a49bcd2637a351931be4578d0cc4d37b908d7a797784fbb"
5953+
dependencies = [
5954+
"bitflags",
5955+
]
5956+
59445957
[[package]]
59455958
name = "wast"
59465959
version = "230.0.0"

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
875875
let ptr = ptr.load_scalar(fx);
876876

877877
let ty = generic_args.type_at(0);
878-
let _ord = generic_args.const_at(1).to_value(); // FIXME: forward this to cranelift once they support that
879878
match ty.kind() {
880879
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
881880
// FIXME implement 128bit atomics
@@ -906,7 +905,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
906905
let val = CValue::by_val(val, fx.layout_of(ty));
907906
ret.write_cvalue(fx, val);
908907
}
909-
_ if intrinsic.as_str().starts_with("atomic_store") => {
908+
sym::atomic_store => {
910909
intrinsic_args!(fx, args => (ptr, val); intrinsic);
911910
let ptr = ptr.load_scalar(fx);
912911

@@ -939,7 +938,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
939938

940939
fx.bcx.ins().atomic_store(MemFlags::trusted(), val, ptr);
941940
}
942-
_ if intrinsic.as_str().starts_with("atomic_xchg") => {
941+
sym::atomic_xchg => {
943942
intrinsic_args!(fx, args => (ptr, new); intrinsic);
944943
let ptr = ptr.load_scalar(fx);
945944

@@ -960,8 +959,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
960959
let old = CValue::by_val(old, layout);
961960
ret.write_cvalue(fx, old);
962961
}
963-
_ if intrinsic.as_str().starts_with("atomic_cxchg") => {
964-
// both atomic_cxchg_* and atomic_cxchgweak_*
962+
sym::atomic_cxchg | sym::atomic_cxchgweak => {
965963
intrinsic_args!(fx, args => (ptr, test_old, new); intrinsic);
966964
let ptr = ptr.load_scalar(fx);
967965

@@ -984,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
984982
ret.write_cvalue(fx, ret_val)
985983
}
986984

987-
_ if intrinsic.as_str().starts_with("atomic_xadd") => {
985+
sym::atomic_xadd => {
988986
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
989987
let ptr = ptr.load_scalar(fx);
990988

@@ -1006,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10061004
let old = CValue::by_val(old, layout);
10071005
ret.write_cvalue(fx, old);
10081006
}
1009-
_ if intrinsic.as_str().starts_with("atomic_xsub") => {
1007+
sym::atomic_xsub => {
10101008
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
10111009
let ptr = ptr.load_scalar(fx);
10121010

@@ -1028,7 +1026,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10281026
let old = CValue::by_val(old, layout);
10291027
ret.write_cvalue(fx, old);
10301028
}
1031-
_ if intrinsic.as_str().starts_with("atomic_and") => {
1029+
sym::atomic_and => {
10321030
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10331031
let ptr = ptr.load_scalar(fx);
10341032

@@ -1049,7 +1047,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10491047
let old = CValue::by_val(old, layout);
10501048
ret.write_cvalue(fx, old);
10511049
}
1052-
_ if intrinsic.as_str().starts_with("atomic_or") => {
1050+
sym::atomic_or => {
10531051
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10541052
let ptr = ptr.load_scalar(fx);
10551053

@@ -1070,7 +1068,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10701068
let old = CValue::by_val(old, layout);
10711069
ret.write_cvalue(fx, old);
10721070
}
1073-
_ if intrinsic.as_str().starts_with("atomic_xor") => {
1071+
sym::atomic_xor => {
10741072
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10751073
let ptr = ptr.load_scalar(fx);
10761074

@@ -1091,7 +1089,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10911089
let old = CValue::by_val(old, layout);
10921090
ret.write_cvalue(fx, old);
10931091
}
1094-
_ if intrinsic.as_str().starts_with("atomic_nand") => {
1092+
sym::atomic_nand => {
10951093
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10961094
let ptr = ptr.load_scalar(fx);
10971095

@@ -1112,7 +1110,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11121110
let old = CValue::by_val(old, layout);
11131111
ret.write_cvalue(fx, old);
11141112
}
1115-
_ if intrinsic.as_str().starts_with("atomic_max") => {
1113+
sym::atomic_max => {
11161114
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11171115
let ptr = ptr.load_scalar(fx);
11181116

@@ -1133,7 +1131,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11331131
let old = CValue::by_val(old, layout);
11341132
ret.write_cvalue(fx, old);
11351133
}
1136-
_ if intrinsic.as_str().starts_with("atomic_umax") => {
1134+
sym::atomic_umax => {
11371135
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11381136
let ptr = ptr.load_scalar(fx);
11391137

@@ -1154,7 +1152,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11541152
let old = CValue::by_val(old, layout);
11551153
ret.write_cvalue(fx, old);
11561154
}
1157-
_ if intrinsic.as_str().starts_with("atomic_min") => {
1155+
sym::atomic_min => {
11581156
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11591157
let ptr = ptr.load_scalar(fx);
11601158

@@ -1175,7 +1173,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11751173
let old = CValue::by_val(old, layout);
11761174
ret.write_cvalue(fx, old);
11771175
}
1178-
_ if intrinsic.as_str().starts_with("atomic_umin") => {
1176+
sym::atomic_umin => {
11791177
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11801178
let ptr = ptr.load_scalar(fx);
11811179

compiler/rustc_codegen_gcc/build_system/build_sysroot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
compiler_builtins = "0.1"
109
alloc = { path = "./sysroot_src/library/alloc" }
1110
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1211
test = { path = "./sysroot_src/library/test" }
@@ -16,6 +15,7 @@ proc_macro = { path = "./sysroot_src/library/proc_macro" }
1615
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
1716
rustc-std-workspace-alloc = { path = "./sysroot_src/library/rustc-std-workspace-alloc" }
1817
rustc-std-workspace-std = { path = "./sysroot_src/library/rustc-std-workspace-std" }
18+
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
1919

2020
# For compiler-builtins we always use a high number of codegen units.
2121
# The goal here is to place every single intrinsic into its own object

compiler/rustc_codegen_gcc/example/alloc_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// add fast paths for low alignment values.
99
#[cfg(any(target_arch = "x86",
1010
target_arch = "arm",
11+
target_arch = "loongarch32",
1112
target_arch = "m68k",
1213
target_arch = "mips",
1314
target_arch = "mips32r6",

compiler/rustc_codegen_gcc/messages.ftl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ codegen_gcc_unknown_ctarget_feature_prefix =
22
unknown feature specified for `-Ctarget-feature`: `{$feature}`
33
.note = features must begin with a `+` to enable or `-` to disable it
44
5-
codegen_gcc_invalid_minimum_alignment =
6-
invalid minimum global alignment: {$err}
7-
85
codegen_gcc_forbidden_ctarget_feature =
96
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`: {$reason}
107

compiler/rustc_codegen_gcc/src/consts.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use rustc_span::def_id::DefId;
1818

1919
use crate::base;
2020
use crate::context::CodegenCx;
21-
use crate::errors::InvalidMinimumAlignment;
2221
use crate::type_of::LayoutGccExt;
2322

2423
fn set_global_alignment<'gcc, 'tcx>(
@@ -29,13 +28,8 @@ fn set_global_alignment<'gcc, 'tcx>(
2928
// The target may require greater alignment for globals than the type does.
3029
// Note: GCC and Clang also allow `__attribute__((aligned))` on variables,
3130
// which can force it to be smaller. Rust doesn't support this yet.
32-
if let Some(min) = cx.sess().target.min_global_align {
33-
match Align::from_bits(min) {
34-
Ok(min) => align = align.max(min),
35-
Err(err) => {
36-
cx.sess().dcx().emit_err(InvalidMinimumAlignment { err: err.to_string() });
37-
}
38-
}
31+
if let Some(min_global) = cx.sess().target.min_global_align {
32+
align = Ord::max(align, min_global);
3933
}
4034
gv.set_alignment(align.bytes() as i32);
4135
}

compiler/rustc_codegen_gcc/src/errors.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ pub(crate) struct UnwindingInlineAsm {
4747
pub span: Span,
4848
}
4949

50-
#[derive(Diagnostic)]
51-
#[diag(codegen_gcc_invalid_minimum_alignment)]
52-
pub(crate) struct InvalidMinimumAlignment {
53-
pub err: String,
54-
}
55-
5650
#[derive(Diagnostic)]
5751
#[diag(codegen_gcc_copy_bitcode)]
5852
pub(crate) struct CopyBitcode {

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gimli = "0.31"
1515
itertools = "0.12"
1616
libc = "0.2"
1717
measureme = "12.0.1"
18-
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
18+
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
1919
rustc-demangle = "0.1.21"
2020
rustc_abi = { path = "../rustc_abi" }
2121
rustc_ast = { path = "../rustc_ast" }

compiler/rustc_codegen_llvm/messages.ftl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ codegen_llvm_from_llvm_diag = {$message}
1919
2020
codegen_llvm_from_llvm_optimization_diag = {$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}
2121
22-
codegen_llvm_invalid_minimum_alignment_not_power_of_two =
23-
invalid minimum global alignment: {$align} is not power of 2
24-
25-
codegen_llvm_invalid_minimum_alignment_too_large =
26-
invalid minimum global alignment: {$align} is too large
27-
2822
codegen_llvm_load_bitcode = failed to load bitcode of module "{$name}"
2923
codegen_llvm_load_bitcode_with_llvm_err = failed to load bitcode of module "{$name}": {$llvm_err}
3024

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
251251
InlineAsmArch::Nvptx64 => {}
252252
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
253253
InlineAsmArch::Hexagon => {}
254-
InlineAsmArch::LoongArch64 => {
254+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
255255
constraints.extend_from_slice(&[
256256
"~{$fcc0}".to_string(),
257257
"~{$fcc1}".to_string(),

0 commit comments

Comments
 (0)