diff options
| author | Alexandru RADOVICI <alexandru.radovici@wyliodrin.com> | 2025-04-30 14:52:15 +0300 |
|---|---|---|
| committer | Alexandru RADOVICI <alexandru.radovici@wyliodrin.com> | 2025-04-30 14:54:10 +0300 |
| commit | 07c7e5ffb3c096f80ffede421fb20089fbe7fe3f (patch) | |
| tree | dee779ff48b21c221bdb66b5609ef7ae1acc1acb /tests/ui/codegen/no-mangle-on-panic-handler.rs | |
| parent | 49e5e4e3a5610c240a717cb99003a5d5d3356679 (diff) | |
| download | rust-07c7e5ffb3c096f80ffede421fb20089fbe7fe3f.tar.gz rust-07c7e5ffb3c096f80ffede421fb20089fbe7fe3f.zip | |
error when using no_mangle on language items
add suggestion on how to add a panic breakpoint Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com> delete no_mangle from ui/panic-handler/panic-handler-wrong-location test issue an error for the usage of #[no_mangle] on internal language items delete the comments add newline rephrase note Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> update error not to leak implementation details delete no_mangle_span Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> delete commented code
Diffstat (limited to 'tests/ui/codegen/no-mangle-on-panic-handler.rs')
| -rw-r--r-- | tests/ui/codegen/no-mangle-on-panic-handler.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/codegen/no-mangle-on-panic-handler.rs b/tests/ui/codegen/no-mangle-on-panic-handler.rs new file mode 100644 index 00000000000..1dc0cce0a2e --- /dev/null +++ b/tests/ui/codegen/no-mangle-on-panic-handler.rs @@ -0,0 +1,14 @@ +// Issue an error when the user uses #[no_mangle] on the panic handler +//@ edition:2024 + +#![crate_type="lib"] +#![no_std] +#![no_main] + +use core::panic::PanicInfo; + +#[unsafe(no_mangle)] //~ ERROR `#[no_mangle]` cannot be used on internal language items +#[panic_handler] +pub unsafe fn panic_fmt(pi: &PanicInfo) -> ! { + loop {} +} |
