aboutsummaryrefslogtreecommitdiff
path: root/doc/langref.html.in
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-03-04 16:20:31 -0500
committerGitHub <noreply@github.com>2023-03-04 16:20:31 -0500
commite7f128c2051b086cdb1c03da041745b560bbaa3e (patch)
tree89d06ee67639dfa0260c5beabc344fb33099df0d /doc/langref.html.in
parentc9d990d79083f117564837f762c3e225d7fbc5cf (diff)
parent4eb3f50fcf6fcfb6b8013571be00b9eeeb909833 (diff)
downloadzig-e7f128c2051b086cdb1c03da041745b560bbaa3e.tar.gz
zig-e7f128c2051b086cdb1c03da041745b560bbaa3e.zip
Merge pull request #14782 from r00ster91/trap
add `@trap` builtin
Diffstat (limited to 'doc/langref.html.in')
-rw-r--r--doc/langref.html.in17
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 71d99b3aae..a413c3aab5 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -7818,12 +7818,14 @@ comptime {
<p>
This function inserts a platform-specific debug trap instruction which causes
debuggers to break there.
+ Unlike for {#syntax#}@trap(){#endsyntax#}, execution may continue after this point if the program is resumed.
</p>
<p>
This function is only valid within function scope.
</p>
-
+ {#see_also|@trap#}
{#header_close#}
+
{#header_open|@mulAdd#}
<pre>{#syntax#}@mulAdd(comptime T: type, a: T, b: T, c: T) T{#endsyntax#}</pre>
<p>
@@ -9393,6 +9395,19 @@ fn List(comptime T: type) type {
</p>
{#header_close#}
+ {#header_open|@trap#}
+ <pre>{#syntax#}@trap() noreturn{#endsyntax#}</pre>
+ <p>
+ This function inserts a platform-specific trap/jam instruction which can be used to exit the program abnormally.
+ This may be implemented by explicitly emitting an invalid instruction which may cause an illegal instruction exception of some sort.
+ Unlike for {#syntax#}@breakpoint(){#endsyntax#}, execution does not continue after this point.
+ </p>
+ <p>
+ This function is only valid within function scope.
+ </p>
+ {#see_also|@breakpoint#}
+ {#header_close#}
+
{#header_open|@truncate#}
<pre>{#syntax#}@truncate(comptime T: type, integer: anytype) T{#endsyntax#}</pre>
<p>