Closed
Description
This includes on https://doc.rust-lang.org/book/no-stdlib.html and https://doc.rust-lang.org/core/. The former has an incorrect signature on panic_fmt
and the latter doesn't mention that you need a #[lang]
annotation. The relationship between panic_fmt
and rust_begin_unwind
(the former is a lang item, and the latter is a symbol that the former produces) has been confusing people on #rust
recently, and should probably be documented as well.
For reference, the correct way to define it is:
#[lang="panic_fmt"]
#[unwind]
extern fn panic_fmt(args: ::core::fmt::Arguments, file: &'static str, line: u32) -> ! {
// ...
}
Every part of that signature (except the function name) is necessary; any omission can cause unclear or misleading errors, or lead to the function being called with the wrong ABI.