rust icon indicating copy to clipboard operation
rust copied to clipboard

add `extern "custom"` functions

Open folkertdev opened this issue 8 months ago • 24 comments

tracking issue: #140829 previous discussion: https://github.com/rust-lang/rust/issues/140566

In short, an extern "custom" function is a function with a custom ABI, that rust does not know about. Therefore, such functions can only be defined with #[unsafe(naked)] and naked_asm!, or via an extern "C" { /* ... */ } block. These functions cannot be called using normal rust syntax: calling them can only be done from inline assembly.

The motivation is low-level scenarios where a custom calling convention is used. Currently, we often pick extern "C", but that is a lie because the function does not actually respect the C calling convention.

At the moment "custom" seems to be the name with the most support. That name is not final, but we need to pick something to actually implement this.

r? @traviscross cc @tgross35

folkertdev avatar May 07 '25 20:05 folkertdev

These commits modify compiler targets. (See the Target Tier Policy.)

rustbot avatar May 07 '25 20:05 rustbot

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 19.0s done
#18 DONE 32.0s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
   Compiling rustc_codegen_cranelift v0.1.0 (/checkout/compiler/rustc_codegen_cranelift)
error[E0004]: non-exhaustive patterns: `Conv::Custom` not covered
   --> compiler/rustc_codegen_cranelift/src/abi/mod.rs:45:11
    |
45  |     match c {
    |           ^ pattern `Conv::Custom` not covered
    |
note: `Conv` defined here
   --> /checkout/compiler/rustc_target/src/callconv/mod.rs:532:1
    |
532 | pub enum Conv {

rust-log-analyzer avatar May 07 '25 20:05 rust-log-analyzer

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

rustbot avatar May 07 '25 20:05 rustbot

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 20.4s done
#18 DONE 32.9s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [ui] tests/ui/abi/custom.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/abi/custom.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/abi/custom/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------

thread 'rustc' panicked at compiler/rustc_codegen_llvm/src/abi.rs:680:17:
functions with the "custom" calling convention cannot be called
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_codegen_llvm::llvm::ffi::CallConv>::from_conv
   3: <rustc_codegen_llvm::context::GenericCx<rustc_codegen_llvm::context::FullCx>>::declare_fn
   4: rustc_codegen_llvm::callee::get_fn
   5: <rustc_codegen_llvm::context::GenericCx<rustc_codegen_llvm::context::FullCx> as rustc_codegen_ssa::traits::asm::AsmCodegenMethods>::mangled_name
   6: rustc_codegen_ssa::mir::naked_asm::codegen_naked_asm::<rustc_codegen_llvm::context::GenericCx<rustc_codegen_llvm::context::FullCx>>
   7: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::<rustc_codegen_llvm::builder::GenericBuilder<rustc_codegen_llvm::context::FullCx>>
   8: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
   9: rustc_codegen_llvm::base::compile_codegen_unit
  10: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  11: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  12: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  13: <rustc_interface::queries::Linker>::codegen_and_build_linker
  14: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  15: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  16: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  17: <alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &'a std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena<'a>>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}), Output = core::option::Option<rustc_interface::queries::Linker>>> as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once
  18: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  19: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.88.0-nightly (8e15a7329 2025-05-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
end of query stack
------------------------------------------

---
To only update this specific test, also pass `--test-args print-calling-conventions.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/print-calling-conventions.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/print-calling-conventions" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--print" "calling-conventions"
--- stdout -------------------------------
C
C-cmse-nonsecure-call
C-cmse-nonsecure-entry
C-unwind

rust-log-analyzer avatar May 07 '25 21:05 rust-log-analyzer

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 19.9s done
#18 DONE 32.7s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
To only update this specific test, also pass `--test-args print-calling-conventions.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/print-calling-conventions.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/print-calling-conventions" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--print" "calling-conventions"
--- stdout -------------------------------
C
C-cmse-nonsecure-call
C-cmse-nonsecure-entry
C-unwind

rust-log-analyzer avatar May 07 '25 22:05 rust-log-analyzer

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 19.9s done
#18 DONE 26.6s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
[RUSTC-TIMING] proc_macro test:false 4.879
[RUSTC-TIMING] test test:false 8.135
    Finished `release` profile [optimized] target(s) in 1m 10s
##[endgroup]
[TIMING] core::build_steps::compile::Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: true }, crates: [], force_recompile: false, extra_rust_args: ["-Csymbol-mangling-version=v0", "-Cpanic=abort"], is_for_mir_opt_tests: false } -- 70.112
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
 Downloading crates ...
  Downloaded boml v0.3.1
   Compiling boml v0.3.1
[RUSTC-TIMING] boml test:false 0.701
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
[RUSTC-TIMING] y test:false 2.655
    Finished `release` profile [optimized] target(s) in 3.83s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-backend gcc --gcc-path /checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
`--gcc-path` was provided, ignoring config file. Using `/checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib` as path for libgccjit
[BUILD] mini_core
[RUSTC-TIMING] mini_core test:false 0.176
[BUILD] example
[AOT] mini_core_hello_world
[RUSTC-TIMING] mini_core_hello_world test:false 0.162
---
---- extern_abi::tests::guarantee_lexicographic_ordering stdout ----

thread 'extern_abi::tests::guarantee_lexicographic_ordering' panicked at compiler/rustc_abi/src/extern_abi/tests.rs:30:5:
assertion `left == right` failed
  left: [C { unwind: false }, CCmseNonSecureCall, CCmseNonSecureEntry, C { unwind: true }, Rust, Aapcs { unwind: false }, Aapcs { unwind: true }, AvrInterrupt, AvrNonBlockingInterrupt, Cdecl { unwind: false }, Cdecl { unwind: true }, EfiApi, Fastcall { unwind: false }, Fastcall { unwind: true }, GpuKernel, Msp430Interrupt, PtxKernel, RiscvInterruptM, RiscvInterruptS, RustCall, RustCold, Stdcall { unwind: false }, Stdcall { unwind: true }, System { unwind: false }, System { unwind: true }, SysV64 { unwind: false }, SysV64 { unwind: true }, Thiscall { unwind: false }, Thiscall { unwind: true }, Unadjusted, Vectorcall { unwind: false }, Vectorcall { unwind: true }, Win64 { unwind: false }, Win64 { unwind: true }, X86Interrupt, Custom]
 right: [C { unwind: false }, CCmseNonSecureCall, CCmseNonSecureEntry, C { unwind: true }, Rust, Aapcs { unwind: false }, Aapcs { unwind: true }, AvrInterrupt, AvrNonBlockingInterrupt, Cdecl { unwind: false }, Cdecl { unwind: true }, Custom, EfiApi, Fastcall { unwind: false }, Fastcall { unwind: true }, GpuKernel, Msp430Interrupt, PtxKernel, RiscvInterruptM, RiscvInterruptS, RustCall, RustCold, Stdcall { unwind: false }, Stdcall { unwind: true }, System { unwind: false }, System { unwind: true }, SysV64 { unwind: false }, SysV64 { unwind: true }, Thiscall { unwind: false }, Thiscall { unwind: true }, Unadjusted, Vectorcall { unwind: false }, Vectorcall { unwind: true }, Win64 { unwind: false }, Win64 { unwind: true }, X86Interrupt]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    extern_abi::tests::guarantee_lexicographic_ordering

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 318.07µs

error: test failed, to rerun pass `-p rustc_abi --lib`
Build completed unsuccessfully in 0:29:26
  local time: Thu May  8 16:18:00 UTC 2025
  network time: Thu, 08 May 2025 16:18:01 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 08 '25 16:05 rust-log-analyzer

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#19 exporting to docker image format
#19 sending tarball 19.8s done
#19 DONE 25.9s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
[RUSTC-TIMING] proc_macro test:false 4.967
[RUSTC-TIMING] test test:false 8.269
    Finished `release` profile [optimized] target(s) in 1m 10s
##[endgroup]
[TIMING] core::build_steps::compile::Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: true }, crates: [], force_recompile: false, extra_rust_args: ["-Csymbol-mangling-version=v0", "-Cpanic=abort"], is_for_mir_opt_tests: false } -- 70.586
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
 Downloading crates ...
  Downloaded boml v0.3.1
   Compiling boml v0.3.1
[RUSTC-TIMING] boml test:false 0.710
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
[RUSTC-TIMING] y test:false 2.670
    Finished `release` profile [optimized] target(s) in 3.79s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-backend gcc --gcc-path /checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
`--gcc-path` was provided, ignoring config file. Using `/checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib` as path for libgccjit
[BUILD] mini_core
[RUSTC-TIMING] mini_core test:false 0.178
[BUILD] example
[AOT] mini_core_hello_world
[RUSTC-TIMING] mini_core_hello_world test:false 0.162
---
---- extern_abi::tests::guarantee_lexicographic_ordering stdout ----

thread 'extern_abi::tests::guarantee_lexicographic_ordering' panicked at compiler/rustc_abi/src/extern_abi/tests.rs:30:5:
assertion `left == right` failed
  left: [C { unwind: false }, CCmseNonSecureCall, CCmseNonSecureEntry, C { unwind: true }, Rust, Aapcs { unwind: false }, Aapcs { unwind: true }, AvrInterrupt, AvrNonBlockingInterrupt, Cdecl { unwind: false }, Cdecl { unwind: true }, EfiApi, Fastcall { unwind: false }, Fastcall { unwind: true }, GpuKernel, Msp430Interrupt, PtxKernel, RiscvInterruptM, RiscvInterruptS, RustCall, RustCold, Stdcall { unwind: false }, Stdcall { unwind: true }, System { unwind: false }, System { unwind: true }, SysV64 { unwind: false }, SysV64 { unwind: true }, Thiscall { unwind: false }, Thiscall { unwind: true }, Unadjusted, Vectorcall { unwind: false }, Vectorcall { unwind: true }, Win64 { unwind: false }, Win64 { unwind: true }, X86Interrupt, Custom]
 right: [C { unwind: false }, CCmseNonSecureCall, CCmseNonSecureEntry, C { unwind: true }, Rust, Aapcs { unwind: false }, Aapcs { unwind: true }, AvrInterrupt, AvrNonBlockingInterrupt, Cdecl { unwind: false }, Cdecl { unwind: true }, Custom, EfiApi, Fastcall { unwind: false }, Fastcall { unwind: true }, GpuKernel, Msp430Interrupt, PtxKernel, RiscvInterruptM, RiscvInterruptS, RustCall, RustCold, Stdcall { unwind: false }, Stdcall { unwind: true }, System { unwind: false }, System { unwind: true }, SysV64 { unwind: false }, SysV64 { unwind: true }, Thiscall { unwind: false }, Thiscall { unwind: true }, Unadjusted, Vectorcall { unwind: false }, Vectorcall { unwind: true }, Win64 { unwind: false }, Win64 { unwind: true }, X86Interrupt]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    extern_abi::tests::guarantee_lexicographic_ordering

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 352.74µs

error: test failed, to rerun pass `-p rustc_abi --lib`
Build completed unsuccessfully in 0:29:06
  local time: Thu May  8 17:37:37 UTC 2025
  network time: Thu, 08 May 2025 17:37:37 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 08 '25 17:05 rust-log-analyzer

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 20.4s done
#18 DONE 26.9s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
To only update this specific test, also pass `--test-args print-calling-conventions.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/print-calling-conventions.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/print-calling-conventions" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--print" "calling-conventions"
--- stdout -------------------------------
C
C-cmse-nonsecure-call
C-cmse-nonsecure-entry
C-unwind

rust-log-analyzer avatar May 08 '25 18:05 rust-log-analyzer

Emit some extern "custom" errors in ast_validation:wq

Did you forget to press escape before quitting vim?

bjorn3 avatar May 08 '25 18:05 bjorn3

ah, yeah. Well it'll probably get squashed before this is ready

folkertdev avatar May 08 '25 18:05 folkertdev

I've made a proper tracking issue at https://github.com/rust-lang/rust/issues/140829

folkertdev avatar May 08 '25 20:05 folkertdev

:umbrella: The latest upstream changes (presumably #141002) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar May 17 '25 07:05 bors

:umbrella: The latest upstream changes (presumably #141984) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 04 '25 03:06 bors

I've rebased and changed the implementation to match https://github.com/rust-lang/rust/pull/141774, which is both shorter and apparently faster too.

folkertdev avatar Jun 05 '25 21:06 folkertdev

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar Jun 05 '25 21:06 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #142099) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 06 '25 16:06 bors

@traviscross are we waiting for T-lang for something here? Otherwise we could get a T-compiler review to move this forward right?

folkertdev avatar Jun 06 '25 16:06 folkertdev

:umbrella: The latest upstream changes (presumably #141774) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 06 '25 22:06 bors

I believe T-lang has already basically okayed this experiment per TC's comment here and I think any concerns that TC winds up having, in addition to the review TC already gave, can be addressed in followup. It's not like lang's gonna FCP this tomorrow, is it? Rolling a compiler review.

r? compiler

workingjubilee avatar Jun 07 '25 03:06 workingjubilee

Yes, this is OK as a lang matter. I'd probably suggest...

r? tgross35

traviscross avatar Jun 07 '25 05:06 traviscross

Failed to set assignee to tgross: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

rustbot avatar Jun 07 '25 05:06 rustbot

Happy to review on Monday, but @workingjubilee if you've already taken a look at the rest then feel free to pick it up as well

tgross35 avatar Jun 08 '25 02:06 tgross35

:umbrella: The latest upstream changes (presumably #142181) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 08 '25 02:06 bors

:umbrella: The latest upstream changes (presumably #141435) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 09 '25 09:06 bors

:umbrella: The latest upstream changes (presumably #141883) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 11 '25 03:06 bors

Some changes occurred in src/tools/cargo

cc @ehuss

rustbot avatar Jun 11 '25 19:06 rustbot

:warning: Warning :warning:

  • Some commits in this PR modify submodules.

rustbot avatar Jun 11 '25 19:06 rustbot

Looks great with green CI and a squash. Thanks for picking this up!

@bors delegate+

tgross35 avatar Jun 11 '25 19:06 tgross35

:v: @folkertdev, you can now approve this pull request!

If @tgross35 told you to "r=me" after making some further change, please make that change, then do @bors r=@tgross35

bors avatar Jun 11 '25 19:06 bors

@bors r=@tgross35

folkertdev avatar Jun 11 '25 21:06 folkertdev