From 3a62b424149ba583ad7c1ad0ce2c2f4f89120d53 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 4 Aug 2016 00:59:41 +0200 Subject: [PATCH] Link to nightly docs as stable still has wrong clobber syntax See #195 --- blog/post/2016-08-03-better-exception-messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/post/2016-08-03-better-exception-messages.md b/blog/post/2016-08-03-better-exception-messages.md index bc3f537e..3224adbc 100644 --- a/blog/post/2016-08-03-better-exception-messages.md +++ b/blog/post/2016-08-03-better-exception-messages.md @@ -66,7 +66,7 @@ extern "C" fn divide_by_zero_handler() -> ! { ``` We're using [inline assembly] here to load the value from the `rsp` register into `stack_frame`. The syntax is a bit strange, so here's a quick explanation: -[inline assembly]: https://doc.rust-lang.org/book/inline-assembly.html +[inline assembly]: https://doc.rust-lang.org/nightly/book/inline-assembly.html - The `asm!` macro emits raw assembly instructions. This is the only way to read raw register values in Rust. - We insert a single assembly instruction: `mov $0, rsp`. It moves the value of `rsp` to some register (the `$0` is a placeholder for an arbitrary register, which gets filled by the compiler). @@ -75,7 +75,7 @@ We're using [inline assembly] here to load the value from the `rsp` register int - After the third colon, the macro expects so called [clobbers]. We don't change any register values, so we leave it empty too. - The last block (after the 4th colon) specifies options. The `intel` option tells the compiler that our code is in Intel assembly syntax (instead of the default AT&T syntax). -[clobbers]: https://doc.rust-lang.org/book/inline-assembly.html#clobbers +[clobbers]: https://doc.rust-lang.org/nightly/book/inline-assembly.html#clobbers So the inline assembly loads the stack pointer value to `stack_frame` at the very beginning of our function. Thus we have a pointer to the exception stack frame and are able to pretty-print its `Debug` formatting through the `{:#?}` argument.