diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-01-27 16:03:51 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-01-30 15:20:16 +0200 |
| commit | a9785fe8eef564011b4266e8a1b9aa15b7e37189 (patch) | |
| tree | 6f350d82c03043356608001c9a3bed2ae68fe59b /doc/langref.html.in | |
| parent | b129350cb5de2251d50b142a50d8d74ccd92ae73 (diff) | |
| download | zig-a9785fe8eef564011b4266e8a1b9aa15b7e37189.tar.gz zig-a9785fe8eef564011b4266e8a1b9aa15b7e37189.zip | |
Sema: add helpful notes to invalid `@ptrCast` operations
Closes #14474
Diffstat (limited to 'doc/langref.html.in')
| -rw-r--r-- | doc/langref.html.in | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index fd4aa8ae76..e1521795ca 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -8799,6 +8799,15 @@ pub const PrefetchOptions = struct { {#link|Optional Pointers#} are allowed. Casting an optional pointer which is {#link|null#} to a non-optional pointer invokes safety-checked {#link|Undefined Behavior#}. </p> + <p> + {#syntax#}@ptrCast{#endsyntax#} cannot be used for: + </p> + <ul> + <li>Removing {#syntax#}const{#endsyntax#} or {#syntax#}volatile{#endsyntax#} qualifier. TODO add a {#syntax#}@qualCast{#endsyntax#} builtin.</li> + <li>Changing pointer address space, use {#link|@addrSpaceCast#}</li> + <li>Increasing pointer alignment, use {#link|@alignCast#}</li> + <li>Casting a non-slice pointer to a slice, use slicing syntax {#syntax#}ptr[start..end]{#endsyntax#}</li> + </ul> {#header_close#} {#header_open|@ptrToInt#} |
