Files
rust/compiler
Jacob Pratt 4f27b89be4 Rollup merge of #163559 - simonether:no-std-no-mangle-help, r=nnethercote
Suggest `#[unsafe(no_mangle)]` for entry points in `no_std` binaries

Fixes rust-lang/rust#160052

The help for "using `fn main` requires the standard library" told users to declare their own entry point with `#[no_mangle]`, which is an error in edition 2024. It now suggests `#[unsafe(no_mangle)]`. rustc has accepted that form in every edition since 1.82 (rust-lang/rust#128771), so the help does not need to depend on the edition.

The help keeps the bracketed form rather than naming the attribute in words (mejrs's suggestion), because it shows text the user writes verbatim. This follows [nnethercote's comment](https://github.com/rust-lang/rust/issues/160052#issuecomment-5103462837), and `rustc_lint` already does the same ([diagnostics.rs](1625626af1/compiler/rustc_lint/src/diagnostics.rs (L950))).

I updated the expected output of the UI test, and tidy passes. I have not built the compiler locally, so the UI test will first run in CI.
2026-10-01 00:39:10 -04:00
..
2026-09-28 07:36:17 +00:00
2026-09-28 07:36:17 +00:00
2026-09-30 11:53:33 +02:00
2026-09-28 07:36:17 +00:00
2026-09-28 07:36:17 +00:00
2026-09-28 07:36:17 +00:00
2026-09-28 07:36:17 +00:00