-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-cmse_nonsecure_entry`#![feature(cmse_nonsecure_entry)]``#![feature(cmse_nonsecure_entry)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Just documenting this so we have a paper trail. I intend to resolve this by disallowing impl Trait
in return types altogether: we already disallow standard generics on functions with this ABI.
Code
#![feature(cmse_nonsecure_entry)]
#![no_std]
extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
0u128
}
#[unsafe(no_mangle)]
fn foo() {
let _x = return_impl_trait();
}
Meta
rustc --version --verbose
:
cargo 1.92.0-nightly (966f94733 2025-09-16)
release: 1.92.0-nightly
commit-hash: 966f94733bbc94ca51ff9f1e4c49ad250ebbdc50
commit-date: 2025-09-16
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.2)
ssl: OpenSSL 3.5.2 5 Aug 2025
os: Linux Mint 22.0.0 (wilma) [64-bit]
Error output
warning: `extern` fn uses type `impl core::marker::Copy`, which is not FFI-safe
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= note: opaque types have no C equivalent
= note: `#[warn(improper_ctypes_definitions)]` on by default
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error[E0391]: cycle detected when computing function signature of `return_impl_trait`
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which requires computing layout of `return_impl_trait::{opaque#0}`...
= note: ...which requires normalizing `return_impl_trait::{opaque#0}`...
note: ...which requires computing type of `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires checking if `return_impl_trait` contains FFI-unwind calls...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires match-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing the opaque types defined by `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing function signature of `return_impl_trait`, completing the cycle
note: cycle used when checking that `return_impl_trait` is well-formed
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:602:16 - disabled backtrace
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: internal compiler error[E0391]: cycle detected when computing function signature of `return_impl_trait`
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which requires computing layout of `return_impl_trait::{opaque#0}`...
= note: ...which requires normalizing `return_impl_trait::{opaque#0}`...
note: ...which requires computing type of `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires checking if `return_impl_trait` contains FFI-unwind calls...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires match-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing function signature of `return_impl_trait`, completing the cycle
note: cycle used when checking that `return_impl_trait` is well-formed
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:602:16 - disabled backtrace
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: internal compiler error[E0391]: cycle detected when computing function signature of `return_impl_trait`
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which requires computing layout of `return_impl_trait::{opaque#0}`...
= note: ...which requires normalizing `return_impl_trait::{opaque#0}`...
note: ...which requires computing type of `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires checking if `return_impl_trait` contains FFI-unwind calls...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing function signature of `return_impl_trait`, completing the cycle
note: cycle used when checking that `return_impl_trait` is well-formed
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:602:16 - disabled backtrace
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: internal compiler error[E0391]: cycle detected when computing function signature of `return_impl_trait`
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: ...which requires computing layout of `return_impl_trait::{opaque#0}`...
= note: ...which requires normalizing `return_impl_trait::{opaque#0}`...
note: ...which requires computing type of `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `return_impl_trait::{opaque#0}`...
--> src/lib.rs:4:57
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `return_impl_trait`...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires checking if `return_impl_trait` contains FFI-unwind calls...
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing function signature of `return_impl_trait`, completing the cycle
note: cycle used when checking that `return_impl_trait` is well-formed
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:602:16 - disabled backtrace
--> src/lib.rs:4:1
|
4 | extern "cmse-nonsecure-entry" fn return_impl_trait() -> impl core::marker::Copy {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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: please attach the file at `/home/folkertdev/rust/playground/rustc-ice-2025-10-01T18_43_37-135196.txt` to your bug report
note: compiler flags: --crate-type lib -C opt-level=3 -C panic=abort -C embed-bitcode=no -C debuginfo=2 -Z unstable-options -C llvm-args=-x86-asm-syntax=intel -C debuginfo=2 -C codegen-units=1
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground` (lib); 1 warning emitted
Caused by:
process didn't exit successfully: `/home/folkertdev/.rustup/toolchains/stage1/bin/rustc --crate-name playground --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=190 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=f3bf8d08de02bd06 -C extra-filename=-642b5b0b4127d905 --out-dir /home/folkertdev/rust/playground/target/thumbv8m.main-none-eabi/release/deps --target thumbv8m.main-none-eabi -L dependency=/home/folkertdev/rust/playground/target/thumbv8m.main-none-eabi/release/deps -L dependency=/home/folkertdev/rust/playground/target/release/deps --extern 'noprelude:compiler_builtins=/home/folkertdev/rust/playground/target/thumbv8m.main-none-eabi/release/deps/libcompiler_builtins-eb37b01561e12bc2.rmeta' --extern 'noprelude:core=/home/folkertdev/rust/playground/target/thumbv8m.main-none-eabi/release/deps/libcore-5dcd424cf93dc313.rmeta' -Z unstable-options --emit asm -C llvm-args=-x86-asm-syntax=intel -Cdebuginfo=2 -Ccodegen-units=1` (exit status: 101)
Backtrace
<backtrace>
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-cmse_nonsecure_entry`#![feature(cmse_nonsecure_entry)]``#![feature(cmse_nonsecure_entry)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.