authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-25 22:42:04-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-26 14:41:33-05:00
log7c2649f89dc76afca46c3aa5c675719b647cdd10
treeba64a7f8f5217726e16f70647492c96b058a3f5d
parent25790e95f1e8563f439bb13c460fdd4a46e68c43

langref: fix whitespace


2 files changed, 30 insertions(+), 30 deletions(-)

doc/langref.html.in+29-29
......@@ -2288,7 +2288,7 @@ or
22882288 {#code|test_aligned_struct_fields.zig#}
22892289
22902290 <p>
2291 Equating packed structs results in a comparison of the backing integer,
2291 Equating packed structs results in a comparison of the backing integer,
22922292 and only works for the `==` and `!=` operators.
22932293 </p>
22942294 {#code|test_packed_struct_equality.zig#}
......@@ -4086,7 +4086,7 @@ fn performFn(start_value: i32) i32 {
40864086 special-case syntax.
40874087 </p>
40884088 <p>
4089 Here is an example of a generic {#syntax#}List{#endsyntax#} data structure.
4089 Here is an example of a generic {#syntax#}List{#endsyntax#} data structure.
40904090 </p>
40914091 {#code|generic_data_structure.zig#}
40924092
......@@ -4291,10 +4291,10 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
42914291 <pre>{#syntax#}@addrSpaceCast(ptr: anytype) anytype{#endsyntax#}</pre>
42924292 <p>
42934293 Converts a pointer from one address space to another. The new address space is inferred
4294 based on the result type. Depending on the current target and address spaces, this cast
4295 may be a no-op, a complex operation, or illegal. If the cast is legal, then the resulting
4296 pointer points to the same memory location as the pointer operand. It is always valid to
4297 cast a pointer between the same address spaces.
4294 based on the result type. Depending on the current target and address spaces, this cast
4295 may be a no-op, a complex operation, or illegal. If the cast is legal, then the resulting
4296 pointer points to the same memory location as the pointer operand. It is always valid to
4297 cast a pointer between the same address spaces.
42984298 </p>
42994299 {#header_close#}
43004300 {#header_open|@addWithOverflow#}
......@@ -4307,7 +4307,7 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
43074307 <pre>{#syntax#}@alignCast(ptr: anytype) anytype{#endsyntax#}</pre>
43084308 <p>
43094309 {#syntax#}ptr{#endsyntax#} can be {#syntax#}*T{#endsyntax#}, {#syntax#}?*T{#endsyntax#}, or {#syntax#}[]T{#endsyntax#}.
4310 Changes the alignment of a pointer. The alignment to use is inferred based on the result type.
4310 Changes the alignment of a pointer. The alignment to use is inferred based on the result type.
43114311 </p>
43124312 <p>A {#link|pointer alignment safety check|Incorrect Pointer Alignment#} is added
43134313 to the generated code to make sure the pointer is aligned as promised.</p>
......@@ -4384,7 +4384,7 @@ comptime {
43844384 <pre>{#syntax#}@bitCast(value: anytype) anytype{#endsyntax#}</pre>
43854385 <p>
43864386 Converts a value of one type to another type. The return type is the
4387 inferred result type.
4387 inferred result type.
43884388 </p>
43894389 <p>
43904390 Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.
......@@ -4740,41 +4740,41 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
47404740 </p>
47414741 {#see_also|@cVaArg|@cVaCopy|@cVaEnd#}
47424742 {#header_close#}
4743
4743
47444744 {#header_open|@deprecated#}
47454745 <pre>{#syntax#}@deprecated(value: anytype) @TypeOf(value){#endsyntax#}</pre>
47464746 <pre>{#syntax#}@deprecated() void{#endsyntax#}</pre>
47474747 <p>
4748 Used to mark a given code path as deprecated. It evaluates to the same value
4749 passed in as argument, or the void value when given none.
4748 Used to mark a given code path as deprecated. It evaluates to the same value
4749 passed in as argument, or the void value when given none.
47504750 </p>
47514751 <p>
47524752 As an example, a library that wishes to move or rename a declaration, while
4753 deprecating usage of the old name can use {#syntax#}@deprecated{#endsyntax#} like so:
4754 </p>
4753 deprecating usage of the old name can use {#syntax#}@deprecated{#endsyntax#} like so:
4754 </p>
47554755 {#syntax_block|zig|root.zig#}
47564756pub const fooToBar = @deprecated(bar.fromFoo); // moved
47574757 {#end_syntax_block#}
47584758
47594759 <p>
47604760 By default it is a <b>compile error</b> to reference deprecated code in
4761 a module defined by the root package, while it is not in modules defined
4762 by dependencies. This behavior can be overridden for the entire dependency
4763 tree by passing {#syntax#}-fallow-deprecated{#endsyntax#} or
4764 {#syntax#}-fno-allow-deprecated{#endsyntax#} to {#syntax#}zig build{#endsyntax#}.
4761 a module defined by the root package, while it is not in modules defined
4762 by dependencies. This behavior can be overridden for the entire dependency
4763 tree by passing {#syntax#}-fallow-deprecated{#endsyntax#} or
4764 {#syntax#}-fno-allow-deprecated{#endsyntax#} to {#syntax#}zig build{#endsyntax#}.
47654765 </p>
47664766 <p>
4767 Usage of this builtin is meant to help <i>direct</i> consumers discover (and remove)
4768 their dependance on deprecated code during the grace period before a deprecated
4769 functionality is turned into a {#syntax#}@compileError{#endsyntax#} or
4770 removed entirely.
4767 Usage of this builtin is meant to help <i>direct</i> consumers discover (and remove)
4768 their dependance on deprecated code during the grace period before a deprecated
4769 functionality is turned into a {#syntax#}@compileError{#endsyntax#} or
4770 removed entirely.
47714771 </p>
47724772
4773 <p>
4773 <p>
47744774 Using {#syntax#}@deprecated{#endsyntax#} without an argument can be useful inside of blocks:
4775 </p>
4775 </p>
47764776 {#code|test_deprecated_builtin.zig#}
4777
4777
47784778 {#header_close#}
47794779
47804780 {#header_open|@divExact#}
......@@ -4891,8 +4891,8 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
48914891 <pre>{#syntax#}@errorCast(value: anytype) anytype{#endsyntax#}</pre>
48924892 <p>
48934893 Converts an error set or error union value from one error set to another error set. The return type is the
4894 inferred result type. Attempting to convert an error which is not in the destination error
4895 set results in safety-checked {#link|Illegal Behavior#}.
4894 inferred result type. Attempting to convert an error which is not in the destination error
4895 set results in safety-checked {#link|Illegal Behavior#}.
48964896 </p>
48974897 {#header_close#}
48984898
......@@ -4971,7 +4971,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
49714971 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
49724972 <p>
49734973 Converts an integer to the closest floating point representation. The return type is the inferred result type.
4974 To convert the other way, use {#link|@intFromFloat#}. This operation is legal
4974 To convert the other way, use {#link|@intFromFloat#}. This operation is legal
49754975 for all values of all integer types.
49764976 </p>
49774977 {#header_close#}
......@@ -5063,7 +5063,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
50635063 <pre>{#syntax#}@intCast(int: anytype) anytype{#endsyntax#}</pre>
50645064 <p>
50655065 Converts an integer to another integer while keeping the same numerical value.
5066 The return type is the inferred result type.
5066 The return type is the inferred result type.
50675067 Attempting to convert a number which is out of range of the destination type results in
50685068 safety-checked {#link|Illegal Behavior#}.
50695069 </p>
......@@ -5316,7 +5316,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
53165316 <pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>
53175317 <p>
53185318 Converts an integer to a {#link|pointer|Pointers#}. The return type is the inferred result type.
5319 To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
5319 To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
53205320 which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a
53215321 {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.
53225322 </p>
test/tests.zig+1-1
......@@ -1195,7 +1195,7 @@ pub fn addCliTests(b: *std.Build) *Step {
11951195 \\}
11961196 \\
11971197 \\test {
1198 \\ if (bad != 42) return error.Bad;
1198 \\ if (bad != 42) return error.Bad;
11991199 \\}
12001200 ;
12011201