summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-21 11:58:37 +0100
committerGitHub <noreply@github.com>2024-11-21 11:58:37 +0100
commit395649558a99eb5bc5d76b556dca12fc1f336346 (patch)
treef2cb9051d11d2021ae49f142ace3a78ffd4fca4d /src
parentfe5403f517617e1ecdf1cd3cd33bf205727f92c9 (diff)
parent809dc73d90d191c75b24840113797bd4f7e138b3 (diff)
downloadrust-395649558a99eb5bc5d76b556dca12fc1f336346.tar.gz
rust-395649558a99eb5bc5d76b556dca12fc1f336346.zip
Rollup merge of #131544 - nbdd0121:asm_goto_safe_block, r=petrochenkov
Make asm label blocks safe context

Tracking issue: https://github.com/rust-lang/rust/issues/119364

`asm!()` is forced to be wrapped inside unsafe. If there's no special treatment, the label blocks would also always be unsafe with no way of opting out. It was suggested that a simple fix is to make asm label blocks safe: https://github.com/rust-lang/rust/issues/119364#issuecomment-2316037703.

`@rustbot` labels: +A-inline-assembly +F-asm
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/language-features/asm-goto.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/doc/unstable-book/src/language-features/asm-goto.md b/src/doc/unstable-book/src/language-features/asm-goto.md
index d72eb7c0c6e..823118bcae1 100644
--- a/src/doc/unstable-book/src/language-features/asm-goto.md
+++ b/src/doc/unstable-book/src/language-features/asm-goto.md
@@ -21,7 +21,9 @@ unsafe {
 }
 ```
 
-The block must have unit type or diverge.
+The block must have unit type or diverge. The block starts a new safety context,
+so despite outer `unsafe`, you need extra unsafe to perform unsafe operations
+within `label <block>`.
 
 When `label <block>` is used together with `noreturn` option, it means that the
 assembly will not fallthrough. It's allowed to jump to a label within the