Skip to content

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Jun 30, 2025

fixes:

error: `#[no_mangle]` cannot be used on internal language items
  --> src/lib.rs:47:1
   |
47 | #[no_mangle]
   | ^^^^^^^^^^^^
48 | fn panic(_info: &PanicInfo) -> ! {
   | -------------------------------- should be the internal language item
   |
   = note: Rustc requires this item to have a specific mangled name.
   = note: If you are trying to prevent mangling to ease debugging, many
   = note: debuggers support a command such as `rbreak rust_begin_unwind` to
   = note: match `.*rust_begin_unwind.*` instead of `break rust_begin_unwind` on a specific name

error: could not compile `no-std-check` (lib) due to 1 previous error

fixes:

```
error: `#[no_mangle]` cannot be used on internal language items
  --> src/lib.rs:47:1
   |
47 | #[no_mangle]
   | ^^^^^^^^^^^^
48 | fn panic(_info: &PanicInfo) -> ! {
   | -------------------------------- should be the internal language item
   |
   = note: Rustc requires this item to have a specific mangled name.
   = note: If you are trying to prevent mangling to ease debugging, many
   = note: debuggers support a command such as `rbreak rust_begin_unwind` to
   = note: match `.*rust_begin_unwind.*` instead of `break rust_begin_unwind` on a specific name

error: could not compile `no-std-check` (lib) due to 1 previous error
```
@melekes melekes self-assigned this Jun 30, 2025
@melekes melekes requested a review from Copilot June 30, 2025 12:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR attempts to address a compile error by changing the #[no_mangle] attribute on the panic handler to an #[unsafe(no_mangle)] form.

  • Updated the panic handler’s attribute from #[no_mangle] to #[unsafe(no_mangle)]
Comments suppressed due to low confidence (1)

tools/no-std-check/src/lib.rs:47

  • The attribute #[unsafe(no_mangle)] is not valid Rust syntax. Remove this attribute—#[panic_handler] is a language item and should not use no_mangle here. If you need to match the panic symbol in a debugger, rely on regex-based breakpoints instead.
#[unsafe(no_mangle)]

@melekes melekes changed the title fix(tools/no-std-check): mark no_mangle as unsafe fix(tools/no-std-check): drop no_mangle attr Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants