Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 18d5c6f

Browse files
committed
Auto merge of rust-lang#121836 - workingjubilee:rollup-vrtx5t9, r=workingjubilee
Rollup of 8 pull requests Successful merges: - rust-lang#117156 (Convert `Unix{Datagram,Stream}::{set_}passcred()` to per-OS traits) - rust-lang#119199 (Add arm64ec-pc-windows-msvc target) - rust-lang#120468 (Add a new `wasm32-wasip1` target to rustc) - rust-lang#121416 (Improve error messages for generics with default parameters) - rust-lang#121475 (Add tidy check for .stderr/.stdout files for non-existent test revisions) - rust-lang#121736 (Remove `Mutex::unlock` Function) - rust-lang#121784 (Make the success arms of `if lhs || rhs` meet up in a separate block) - rust-lang#121818 (CFI: Remove unused `typeid_for_fnsig`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6cbf092 + 9017458 commit 18d5c6f

File tree

81 files changed

+956
-1058
lines changed

Some content is hidden

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

81 files changed

+956
-1058
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ version = "0.1.0"
447447

448448
[[package]]
449449
name = "cc"
450-
version = "1.0.79"
450+
version = "1.0.88"
451451
source = "registry+https://github.com/rust-lang/crates.io-index"
452-
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
452+
checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc"
453453

454454
[[package]]
455455
name = "cfg-if"

compiler/rustc_codegen_llvm/src/back/archive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn llvm_machine_type(cpu: &str) -> LLVMMachineType {
5555
"x86_64" => LLVMMachineType::AMD64,
5656
"x86" => LLVMMachineType::I386,
5757
"aarch64" => LLVMMachineType::ARM64,
58+
"arm64ec" => LLVMMachineType::ARM64EC,
5859
"arm" => LLVMMachineType::ARM,
5960
_ => panic!("unsupported cpu type {cpu}"),
6061
}

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub enum LLVMMachineType {
5656
AMD64 = 0x8664,
5757
I386 = 0x14c,
5858
ARM64 = 0xaa64,
59+
ARM64EC = 0xa641,
5960
ARM = 0x01c0,
6061
}
6162

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ impl<'a> IntoIterator for LLVMFeature<'a> {
204204
// which might lead to failures if the oldest tested / supported LLVM version
205205
// doesn't yet support the relevant intrinsics
206206
pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> {
207-
let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch };
207+
let arch = if sess.target.arch == "x86_64" {
208+
"x86"
209+
} else if sess.target.arch == "arm64ec" {
210+
"aarch64"
211+
} else {
212+
&*sess.target.arch
213+
};
208214
match (arch, s) {
209215
("x86", "sse4.2") => {
210216
LLVMFeature::with_dependency("sse4.2", TargetFeatureFoldStrength::EnableOnly("crc32"))

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
266266
// Generic x86
267267
"x86" => emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), true),
268268
// Windows AArch64
269-
"aarch64" if target.is_like_windows => {
269+
"aarch64" | "arm64ec" if target.is_like_windows => {
270270
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false)
271271
}
272272
// macOS / iOS AArch64

compiler/rustc_codegen_ssa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
# tidy-alphabetical-start
88
ar_archive_writer = "0.1.5"
99
bitflags = "2.4.1"
10-
cc = "1.0.69"
10+
cc = "1.0.88"
1111
itertools = "0.11"
1212
jobserver = "0.1.28"
1313
pathdiff = "0.2.0"

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::path::Path;
88
use object::write::{self, StandardSegment, Symbol, SymbolSection};
99
use object::{
1010
elf, pe, xcoff, Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection,
11-
ObjectSymbol, SectionFlags, SectionKind, SymbolFlags, SymbolKind, SymbolScope,
11+
ObjectSymbol, SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope,
1212
};
1313

1414
use rustc_data_structures::memmap::Mmap;
@@ -182,37 +182,40 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
182182
Endian::Little => Endianness::Little,
183183
Endian::Big => Endianness::Big,
184184
};
185-
let architecture = match &sess.target.arch[..] {
186-
"arm" => Architecture::Arm,
187-
"aarch64" => {
185+
let (architecture, sub_architecture) = match &sess.target.arch[..] {
186+
"arm" => (Architecture::Arm, None),
187+
"aarch64" => (
188188
if sess.target.pointer_width == 32 {
189189
Architecture::Aarch64_Ilp32
190190
} else {
191191
Architecture::Aarch64
192-
}
193-
}
194-
"x86" => Architecture::I386,
195-
"s390x" => Architecture::S390x,
196-
"mips" | "mips32r6" => Architecture::Mips,
197-
"mips64" | "mips64r6" => Architecture::Mips64,
198-
"x86_64" => {
192+
},
193+
None,
194+
),
195+
"x86" => (Architecture::I386, None),
196+
"s390x" => (Architecture::S390x, None),
197+
"mips" | "mips32r6" => (Architecture::Mips, None),
198+
"mips64" | "mips64r6" => (Architecture::Mips64, None),
199+
"x86_64" => (
199200
if sess.target.pointer_width == 32 {
200201
Architecture::X86_64_X32
201202
} else {
202203
Architecture::X86_64
203-
}
204-
}
205-
"powerpc" => Architecture::PowerPc,
206-
"powerpc64" => Architecture::PowerPc64,
207-
"riscv32" => Architecture::Riscv32,
208-
"riscv64" => Architecture::Riscv64,
209-
"sparc64" => Architecture::Sparc64,
210-
"avr" => Architecture::Avr,
211-
"msp430" => Architecture::Msp430,
212-
"hexagon" => Architecture::Hexagon,
213-
"bpf" => Architecture::Bpf,
214-
"loongarch64" => Architecture::LoongArch64,
215-
"csky" => Architecture::Csky,
204+
},
205+
None,
206+
),
207+
"powerpc" => (Architecture::PowerPc, None),
208+
"powerpc64" => (Architecture::PowerPc64, None),
209+
"riscv32" => (Architecture::Riscv32, None),
210+
"riscv64" => (Architecture::Riscv64, None),
211+
"sparc64" => (Architecture::Sparc64, None),
212+
"avr" => (Architecture::Avr, None),
213+
"msp430" => (Architecture::Msp430, None),
214+
"hexagon" => (Architecture::Hexagon, None),
215+
"bpf" => (Architecture::Bpf, None),
216+
"loongarch64" => (Architecture::LoongArch64, None),
217+
"csky" => (Architecture::Csky, None),
218+
"arm64ec" => (Architecture::Aarch64, Some(SubArchitecture::Arm64EC)),
216219
// Unsupported architecture.
217220
_ => return None,
218221
};
@@ -227,6 +230,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
227230
};
228231

229232
let mut file = write::Object::new(binary_format, architecture, endianness);
233+
file.set_sub_architecture(sub_architecture);
230234
if sess.target.is_like_osx {
231235
if macho_is_arm64e(&sess.target) {
232236
file.set_macho_cpu_subtype(object::macho::CPU_SUBTYPE_ARM64E);

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,10 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
563563
return undecorated;
564564
}
565565

566-
let x86 = match &target.arch[..] {
567-
"x86" => true,
568-
"x86_64" => false,
566+
let prefix = match &target.arch[..] {
567+
"x86" => Some('_'),
568+
"x86_64" => None,
569+
"arm64ec" => Some('#'),
569570
// Only x86/64 use symbol decorations.
570571
_ => return undecorated,
571572
};
@@ -602,8 +603,8 @@ pub fn linking_symbol_name_for_instance_in_crate<'tcx>(
602603
Conv::X86Stdcall => ("_", "@"),
603604
Conv::X86VectorCall => ("", "@@"),
604605
_ => {
605-
if x86 {
606-
undecorated.insert(0, '_');
606+
if let Some(prefix) = prefix {
607+
undecorated.insert(0, prefix);
607608
}
608609
return undecorated;
609610
}

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,11 @@ impl CrateInfo {
907907
lang_items::required(tcx, l).then_some(name)
908908
})
909909
.collect();
910-
let prefix = if target.is_like_windows && target.arch == "x86" { "_" } else { "" };
910+
let prefix = match (target.is_like_windows, target.arch.as_ref()) {
911+
(true, "x86") => "_",
912+
(true, "arm64ec") => "#",
913+
_ => "",
914+
};
911915

912916
// This loop only adds new items to values of the hash map, so the order in which we
913917
// iterate over the values is not important.

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,10 +1247,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
12471247
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
12481248
let did1 = def1.did();
12491249
let did2 = def2.did();
1250-
let sub_no_defaults_1 =
1251-
self.tcx.generics_of(did1).own_args_no_defaults(self.tcx, sub1);
1252-
let sub_no_defaults_2 =
1253-
self.tcx.generics_of(did2).own_args_no_defaults(self.tcx, sub2);
1250+
1251+
let generics1 = self.tcx.generics_of(did1);
1252+
let generics2 = self.tcx.generics_of(did2);
1253+
1254+
let non_default_after_default = generics1
1255+
.check_concrete_type_after_default(self.tcx, sub1)
1256+
|| generics2.check_concrete_type_after_default(self.tcx, sub2);
1257+
let sub_no_defaults_1 = if non_default_after_default {
1258+
generics1.own_args(sub1)
1259+
} else {
1260+
generics1.own_args_no_defaults(self.tcx, sub1)
1261+
};
1262+
let sub_no_defaults_2 = if non_default_after_default {
1263+
generics2.own_args(sub2)
1264+
} else {
1265+
generics2.own_args_no_defaults(self.tcx, sub2)
1266+
};
12541267
let mut values = (DiagStyledString::new(), DiagStyledString::new());
12551268
let path1 = self.tcx.def_path_str(did1);
12561269
let path2 = self.tcx.def_path_str(did2);

0 commit comments

Comments
 (0)