Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blog/post/03-set-up-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Now we place our root source file in `src/lib.rs`:
pub extern fn rust_main() {}

#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! {loop{}}
#[lang = "panic_fmt"] #[no_mangle] extern fn panic_fmt() -> ! {loop{}}
```
Let's break it down:

Expand Down
2 changes: 2 additions & 0 deletions blog/post/05-allocating-frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ We used `expect` in the code above, which will panic if there is no memory map t

```rust
#[lang = "panic_fmt"]
#[no_mangle]
extern fn panic_fmt() -> ! {
println!("PANIC");
loop{}
Expand All @@ -112,6 +113,7 @@ Now we get a `PANIC` message. But we can do even better. The `panic_fmt` functio

```rust
#[lang = "panic_fmt"]
#[no_mangle]
extern fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str,
line: u32) -> !
{
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ extern "C" fn eh_personality() {}

#[cfg(not(test))]
#[lang = "panic_fmt"]
#[no_mangle]
extern "C" fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str, line: u32) -> ! {
println!("\n\nPANIC in {} at line {}:", file, line);
println!(" {}", fmt);
Expand Down