authorbors <bors@rust-lang.org> 2025-02-08 12:57:59 UTC
committerbors <bors@rust-lang.org> 2025-02-08 12:57:59 UTC
log8ad2c9724d983cfb116baab0bb800edd17f31644
treea54e1d4011f5fdc76090a179cbc965b3c7801dc5
parentd2f335d58e6c346f94910d0f49baf185028b44be
parenta5b9e8ce837db7312026426c290b2db10248752b

Auto merge of #136728 - matthiaskrgr:rollup-x2qh9yt, r=matthiaskrgr

Rollup of 6 pull requests Successful merges: - #136640 (Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit) - #136648 (Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks`) - #136651 (Label mismatched parameters at the def site for foreign functions) - #136691 (Remove Linkage::Private and Linkage::Appending) - #136692 (add module level doc for bootstrap:utils:exec) - #136700 (i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4) r? `@ghost` `@rustbot` modify labels: rollup

25 files changed, 70 insertions(+), 51 deletions(-)

compiler/rustc_codegen_gcc/src/base.rs-4
......@@ -49,9 +49,7 @@ pub fn global_linkage_to_gcc(linkage: Linkage) -> GlobalKind {
4949 Linkage::LinkOnceODR => unimplemented!(),
5050 Linkage::WeakAny => unimplemented!(),
5151 Linkage::WeakODR => unimplemented!(),
52 Linkage::Appending => unimplemented!(),
5352 Linkage::Internal => GlobalKind::Internal,
54 Linkage::Private => GlobalKind::Internal,
5553 Linkage::ExternalWeak => GlobalKind::Imported, // TODO(antoyo): should be weak linkage.
5654 Linkage::Common => unimplemented!(),
5755 }
......@@ -66,9 +64,7 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
6664 Linkage::LinkOnceODR => unimplemented!(),
6765 Linkage::WeakAny => FunctionType::Exported, // FIXME(antoyo): should be similar to linkonce.
6866 Linkage::WeakODR => unimplemented!(),
69 Linkage::Appending => unimplemented!(),
7067 Linkage::Internal => FunctionType::Internal,
71 Linkage::Private => FunctionType::Internal,
7268 Linkage::ExternalWeak => unimplemented!(),
7369 Linkage::Common => unimplemented!(),
7470 }
compiler/rustc_codegen_gcc/src/mono_item.rs+1-4
......@@ -61,10 +61,7 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
6161 // compiler-rt, then we want to implicitly compile everything with hidden
6262 // visibility as we're going to link this object all over the place but
6363 // don't want the symbols to get exported.
64 if linkage != Linkage::Internal
65 && linkage != Linkage::Private
66 && self.tcx.is_compiler_builtins(LOCAL_CRATE)
67 {
64 if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
6865 #[cfg(feature = "master")]
6966 decl.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
7067 } else {
compiler/rustc_codegen_llvm/src/base.rs-2
......@@ -157,9 +157,7 @@ pub(crate) fn linkage_to_llvm(linkage: Linkage) -> llvm::Linkage {
157157 Linkage::LinkOnceODR => llvm::Linkage::LinkOnceODRLinkage,
158158 Linkage::WeakAny => llvm::Linkage::WeakAnyLinkage,
159159 Linkage::WeakODR => llvm::Linkage::WeakODRLinkage,
160 Linkage::Appending => llvm::Linkage::AppendingLinkage,
161160 Linkage::Internal => llvm::Linkage::InternalLinkage,
162 Linkage::Private => llvm::Linkage::PrivateLinkage,
163161 Linkage::ExternalWeak => llvm::Linkage::ExternalWeakLinkage,
164162 Linkage::Common => llvm::Linkage::CommonLinkage,
165163 }
compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs+4-7
......@@ -319,19 +319,16 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
319319 // This is actually a function pointer, so wrap it in pointer DI.
320320 let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
321321 let (size, align) = match fn_ty.kind() {
322 ty::FnDef(..) => (0, 1),
323 ty::FnPtr(..) => (
324 cx.tcx.data_layout.pointer_size.bits(),
325 cx.tcx.data_layout.pointer_align.abi.bits() as u32,
326 ),
322 ty::FnDef(..) => (Size::ZERO, Align::ONE),
323 ty::FnPtr(..) => (cx.tcx.data_layout.pointer_size, cx.tcx.data_layout.pointer_align.abi),
327324 _ => unreachable!(),
328325 };
329326 let di_node = unsafe {
330327 llvm::LLVMRustDIBuilderCreatePointerType(
331328 DIB(cx),
332329 fn_di_node,
333 size,
334 align,
330 size.bits(),
331 align.bits() as u32,
335332 0, // Ignore DWARF address space.
336333 name.as_c_char_ptr(),
337334 name.len(),
compiler/rustc_codegen_llvm/src/debuginfo/mod.rs+1-1
......@@ -633,7 +633,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
633633 true,
634634 DIFlags::FlagZero,
635635 argument_index,
636 align.bytes() as u32,
636 align.bits() as u32,
637637 )
638638 }
639639 }
compiler/rustc_codegen_llvm/src/mono_item.rs+1-4
......@@ -71,10 +71,7 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
7171 // compiler-rt, then we want to implicitly compile everything with hidden
7272 // visibility as we're going to link this object all over the place but
7373 // don't want the symbols to get exported.
74 if linkage != Linkage::Internal
75 && linkage != Linkage::Private
76 && self.tcx.is_compiler_builtins(LOCAL_CRATE)
77 {
74 if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
7875 llvm::set_visibility(lldecl, llvm::Visibility::Hidden);
7976 } else {
8077 llvm::set_visibility(lldecl, base::visibility_to_llvm(visibility));
compiler/rustc_codegen_ssa/src/codegen_attrs.rs-2
......@@ -41,7 +41,6 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
4141 // ghost, dllimport, dllexport and linkonce_odr_autohide are not supported
4242 // and don't have to be, LLVM treats them as no-ops.
4343 match name {
44 "appending" => Appending,
4544 "available_externally" => AvailableExternally,
4645 "common" => Common,
4746 "extern_weak" => ExternalWeak,
......@@ -49,7 +48,6 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
4948 "internal" => Internal,
5049 "linkonce" => LinkOnceAny,
5150 "linkonce_odr" => LinkOnceODR,
52 "private" => Private,
5351 "weak" => WeakAny,
5452 "weak_odr" => WeakODR,
5553 _ => tcx.dcx().span_fatal(tcx.def_span(def_id), "invalid linkage specified"),
compiler/rustc_codegen_ssa/src/mir/naked_asm.rs+1-2
......@@ -187,10 +187,9 @@ fn prefix_and_suffix<'tcx>(
187187 }
188188 }
189189 }
190 Linkage::Internal | Linkage::Private => {
190 Linkage::Internal => {
191191 // write nothing
192192 }
193 Linkage::Appending => emit_fatal("Only global variables can have appending linkage!"),
194193 Linkage::Common => emit_fatal("Functions may not have common linkage"),
195194 Linkage::AvailableExternally => {
196195 // this would make the function equal an extern definition
compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs+9-3
......@@ -2641,8 +2641,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26412641 }
26422642
26432643 /// Returns the parameters of a function, with their generic parameters if those are the full
2644 /// type of that parameter. Returns `None` if the function has no generics or the body is
2645 /// unavailable (eg is an instrinsic).
2644 /// type of that parameter.
2645 ///
2646 /// Returns `None` if the body is not a named function (e.g. a closure).
26462647 fn get_hir_param_info(
26472648 &self,
26482649 def_id: DefId,
......@@ -2667,6 +2668,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26672668 kind: hir::ItemKind::Fn { sig, generics, body, .. },
26682669 ..
26692670 }) => (sig, generics, Some(body), None),
2671 hir::Node::ForeignItem(&hir::ForeignItem {
2672 kind: hir::ForeignItemKind::Fn(sig, params, generics),
2673 ..
2674 }) => (sig, generics, None, Some(params)),
26702675 _ => return None,
26712676 };
26722677
......@@ -2700,7 +2705,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
27002705 ))
27012706 }
27022707 (None, Some(params)) => {
2703 let params = params.get(is_method as usize..)?;
2708 let params =
2709 params.get(is_method as usize..params.len() - sig.decl.c_variadic as usize)?;
27042710 debug_assert_eq!(params.len(), fn_inputs.len());
27052711 Some((
27062712 fn_inputs.zip(params.iter().map(|param| FnParam::Name(param))).collect(),
compiler/rustc_middle/src/middle/codegen_fn_attrs.rs+1-1
......@@ -178,7 +178,7 @@ impl CodegenFnAttrs {
178178 || match self.linkage {
179179 // These are private, so make sure we don't try to consider
180180 // them external.
181 None | Some(Linkage::Internal | Linkage::Private) => false,
181 None | Some(Linkage::Internal) => false,
182182 Some(_) => true,
183183 }
184184 }
compiler/rustc_middle/src/mir/mono.rs-2
......@@ -327,9 +327,7 @@ pub enum Linkage {
327327 LinkOnceODR,
328328 WeakAny,
329329 WeakODR,
330 Appending,
331330 Internal,
332 Private,
333331 ExternalWeak,
334332 Common,
335333}
compiler/rustc_monomorphize/src/partitioning.rs-2
......@@ -1238,9 +1238,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitio
12381238 Linkage::LinkOnceODR => "OnceODR",
12391239 Linkage::WeakAny => "WeakAny",
12401240 Linkage::WeakODR => "WeakODR",
1241 Linkage::Appending => "Appending",
12421241 Linkage::Internal => "Internal",
1243 Linkage::Private => "Private",
12441242 Linkage::ExternalWeak => "ExternalWeak",
12451243 Linkage::Common => "Common",
12461244 };
compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs+1-1
......@@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::hurd_gnu::opts();
5 base.cpu = "pentiumpro".into();
5 base.cpu = "pentium4".into();
66 base.max_atomic_width = Some(64);
77 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
88 base.stack_probes = StackProbeType::Inline;
src/bootstrap/src/utils/exec.rs+5
......@@ -1,3 +1,8 @@
1//! Command Execution Module
2//!
3//! This module provides a structured way to execute and manage commands efficiently,
4//! ensuring controlled failure handling and output management.
5
16use std::ffi::OsStr;
27use std::fmt::{Debug, Formatter};
38use std::path::Path;
src/doc/rustc/src/platform-support.md+1-1
......@@ -312,7 +312,7 @@ target | std | host | notes
312312[`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86 (original Pentium) [^x86_32-floats-x87]
313313[`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI]
314314`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI]
315[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (PentiumPro) [^x86_32-floats-x87]
315[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (Pentium 4) [^x86_32-floats-x87]
316316[`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 (Pentium 4) [^x86_32-floats-return-ABI]
317317[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD (Pentium 4) [^x86_32-floats-return-ABI]
318318[`i686-unknown-redox`](platform-support/redox.md) | ✓ | | i686 Redox OS (PentiumPro) [^x86_32-floats-x87]
tests/codegen/debug-fndef-size.rs+5-3
......@@ -1,4 +1,6 @@
1// Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo.
1// Verify that `i32::cmp` FnDef type is declared with a size of 0 and an
2// alignment of 8 bits (1 byte) in LLVM debuginfo.
3
24//@ compile-flags: -O -g -Cno-prepopulate-passes
35//@ ignore-msvc the types are mangled differently
46
......@@ -14,5 +16,5 @@ pub fn main() {
1416
1517// CHECK: %compare.dbg.spill = alloca [0 x i8], align 1
1618// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression()
17// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}})
18// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1)
19// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 8, dwarfAddressSpace: {{.*}})
20// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 8)
tests/run-make/libs-through-symlinks/rmake.rs+1
......@@ -21,6 +21,7 @@
2121//! <https://github.com/rust-lang/rust/pull/13903>.
2222
2323//@ ignore-cross-compile
24//@ needs-symlink
2425
2526use run_make_support::{bare_rustc, cwd, path, rfs, rust_lib_name};
2627
tests/ui/argument-suggestions/extern-fn-arg-names.stderr+1-1
......@@ -14,7 +14,7 @@ note: function defined here
1414 --> $DIR/extern-fn-arg-names.rs:2:8
1515 |
1616LL | fn dstfn(src: i32, dst: err);
17 | ^^^^^
17 | ^^^^^ ---
1818help: provide the argument
1919 |
2020LL | dstfn(1, /* dst */);
tests/ui/c-variadic/variadic-ffi-1.stderr+2-2
......@@ -14,7 +14,7 @@ note: function defined here
1414 --> $DIR/variadic-ffi-1.rs:15:8
1515 |
1616LL | fn foo(f: isize, x: u8, ...);
17 | ^^^
17 | ^^^ - -
1818help: provide the arguments
1919 |
2020LL | foo(/* isize */, /* u8 */);
......@@ -30,7 +30,7 @@ note: function defined here
3030 --> $DIR/variadic-ffi-1.rs:15:8
3131 |
3232LL | fn foo(f: isize, x: u8, ...);
33 | ^^^
33 | ^^^ -
3434help: provide the argument
3535 |
3636LL | foo(1, /* u8 */);
tests/ui/error-codes/E0060.stderr+1-1
......@@ -8,7 +8,7 @@ note: function defined here
88 --> $DIR/E0060.rs:2:8
99 |
1010LL | fn printf(_: *const u8, ...) -> u32;
11 | ^^^^^^
11 | ^^^^^^ -
1212help: provide the argument
1313 |
1414LL | unsafe { printf(/* *const u8 */); }
tests/ui/fn/param-mismatch-foreign.rs created+11
......@@ -0,0 +1,11 @@
1extern "C" {
2 fn foo(x: i32, y: u32, z: i32);
3 //~^ NOTE function defined here
4}
5
6fn main() {
7 foo(1i32, 2i32);
8 //~^ ERROR this function takes 3 arguments but 2 arguments were supplied
9 //~| NOTE argument #2 of type `u32` is missing
10 //~| HELP provide the argument
11}
tests/ui/fn/param-mismatch-foreign.stderr created+19
......@@ -0,0 +1,19 @@
1error[E0061]: this function takes 3 arguments but 2 arguments were supplied
2 --> $DIR/param-mismatch-foreign.rs:7:5
3 |
4LL | foo(1i32, 2i32);
5 | ^^^ ---- argument #2 of type `u32` is missing
6 |
7note: function defined here
8 --> $DIR/param-mismatch-foreign.rs:2:8
9 |
10LL | fn foo(x: i32, y: u32, z: i32);
11 | ^^^ -
12help: provide the argument
13 |
14LL | foo(1i32, /* u32 */, 2i32);
15 | ~~~~~~~~~~~~~~~~~~~~~~~
16
17error: aborting due to 1 previous error
18
19For more information about this error, try `rustc --explain E0061`.
tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs-3
......@@ -18,9 +18,6 @@ pub static TEST4: bool = true;
1818#[linkage = "linkonce_odr"]
1919pub static TEST5: bool = true;
2020
21#[linkage = "private"]
22pub static TEST6: bool = true;
23
2421#[linkage = "weak"]
2522pub static TEST7: bool = true;
2623
tests/ui/mismatched_types/issue-26480.stderr+1-1
......@@ -13,7 +13,7 @@ note: function defined here
1313 --> $DIR/issue-26480.rs:2:8
1414 |
1515LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
16 | ^^^^^
16 | ^^^^^ -----
1717 = note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
1818help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
1919 |
tests/ui/suggestions/suggest-null-ptr.stderr+4-4
......@@ -12,7 +12,7 @@ note: function defined here
1212 --> $DIR/suggest-null-ptr.rs:7:8
1313 |
1414LL | fn foo(ptr: *const u8);
15 | ^^^
15 | ^^^ ---
1616help: if you meant to create a null pointer, use `std::ptr::null()`
1717 |
1818LL | foo(std::ptr::null());
......@@ -32,7 +32,7 @@ note: function defined here
3232 --> $DIR/suggest-null-ptr.rs:9:8
3333 |
3434LL | fn foo_mut(ptr: *mut u8);
35 | ^^^^^^^
35 | ^^^^^^^ ---
3636help: if you meant to create a null pointer, use `std::ptr::null_mut()`
3737 |
3838LL | foo_mut(std::ptr::null_mut());
......@@ -52,7 +52,7 @@ note: function defined here
5252 --> $DIR/suggest-null-ptr.rs:11:8
5353 |
5454LL | fn usize(ptr: *const usize);
55 | ^^^^^
55 | ^^^^^ ---
5656help: if you meant to create a null pointer, use `std::ptr::null()`
5757 |
5858LL | usize(std::ptr::null());
......@@ -72,7 +72,7 @@ note: function defined here
7272 --> $DIR/suggest-null-ptr.rs:13:8
7373 |
7474LL | fn usize_mut(ptr: *mut usize);
75 | ^^^^^^^^^
75 | ^^^^^^^^^ ---
7676help: if you meant to create a null pointer, use `std::ptr::null_mut()`
7777 |
7878LL | usize_mut(std::ptr::null_mut());