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...@@ -2288,7 +2288,7 @@ or
2288 {#code|test_aligned_struct_fields.zig#}2288 {#code|test_aligned_struct_fields.zig#}
22892289
2290 <p>2290 <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,
2292 and only works for the `==` and `!=` operators.2292 and only works for the `==` and `!=` operators.
2293 </p>2293 </p>
2294 {#code|test_packed_struct_equality.zig#}2294 {#code|test_packed_struct_equality.zig#}
...@@ -4086,7 +4086,7 @@ fn performFn(start_value: i32) i32 {...@@ -4086,7 +4086,7 @@ fn performFn(start_value: i32) i32 {
4086 special-case syntax.4086 special-case syntax.
4087 </p>4087 </p>
4088 <p>4088 <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.
4090 </p>4090 </p>
4091 {#code|generic_data_structure.zig#}4091 {#code|generic_data_structure.zig#}
40924092
...@@ -4291,10 +4291,10 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {...@@ -4291,10 +4291,10 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
4291 <pre>{#syntax#}@addrSpaceCast(ptr: anytype) anytype{#endsyntax#}</pre>4291 <pre>{#syntax#}@addrSpaceCast(ptr: anytype) anytype{#endsyntax#}</pre>
4292 <p>4292 <p>
4293 Converts a pointer from one address space to another. The new address space is inferred4293 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 cast4294 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 resulting4295 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 to4296 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.4297 cast a pointer between the same address spaces.
4298 </p>4298 </p>
4299 {#header_close#}4299 {#header_close#}
4300 {#header_open|@addWithOverflow#}4300 {#header_open|@addWithOverflow#}
...@@ -4307,7 +4307,7 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {...@@ -4307,7 +4307,7 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
4307 <pre>{#syntax#}@alignCast(ptr: anytype) anytype{#endsyntax#}</pre>4307 <pre>{#syntax#}@alignCast(ptr: anytype) anytype{#endsyntax#}</pre>
4308 <p>4308 <p>
4309 {#syntax#}ptr{#endsyntax#} can be {#syntax#}*T{#endsyntax#}, {#syntax#}?*T{#endsyntax#}, or {#syntax#}[]T{#endsyntax#}.4309 {#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.
4311 </p>4311 </p>
4312 <p>A {#link|pointer alignment safety check|Incorrect Pointer Alignment#} is added4312 <p>A {#link|pointer alignment safety check|Incorrect Pointer Alignment#} is added
4313 to the generated code to make sure the pointer is aligned as promised.</p>4313 to the generated code to make sure the pointer is aligned as promised.</p>
...@@ -4384,7 +4384,7 @@ comptime {...@@ -4384,7 +4384,7 @@ comptime {
4384 <pre>{#syntax#}@bitCast(value: anytype) anytype{#endsyntax#}</pre>4384 <pre>{#syntax#}@bitCast(value: anytype) anytype{#endsyntax#}</pre>
4385 <p>4385 <p>
4386 Converts a value of one type to another type. The return type is the4386 Converts a value of one type to another type. The return type is the
4387 inferred result type.4387 inferred result type.
4388 </p>4388 </p>
4389 <p>4389 <p>
4390 Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.4390 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...@@ -4740,41 +4740,41 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
4740 </p>4740 </p>
4741 {#see_also|@cVaArg|@cVaCopy|@cVaEnd#}4741 {#see_also|@cVaArg|@cVaCopy|@cVaEnd#}
4742 {#header_close#}4742 {#header_close#}
4743 4743
4744 {#header_open|@deprecated#}4744 {#header_open|@deprecated#}
4745 <pre>{#syntax#}@deprecated(value: anytype) @TypeOf(value){#endsyntax#}</pre>4745 <pre>{#syntax#}@deprecated(value: anytype) @TypeOf(value){#endsyntax#}</pre>
4746 <pre>{#syntax#}@deprecated() void{#endsyntax#}</pre>4746 <pre>{#syntax#}@deprecated() void{#endsyntax#}</pre>
4747 <p>4747 <p>
4748 Used to mark a given code path as deprecated. It evaluates to the same value4748 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.4749 passed in as argument, or the void value when given none.
4750 </p>4750 </p>
4751 <p>4751 <p>
4752 As an example, a library that wishes to move or rename a declaration, while4752 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:4753 deprecating usage of the old name can use {#syntax#}@deprecated{#endsyntax#} like so:
4754 </p>4754 </p>
4755 {#syntax_block|zig|root.zig#}4755 {#syntax_block|zig|root.zig#}
4756pub const fooToBar = @deprecated(bar.fromFoo); // moved4756pub const fooToBar = @deprecated(bar.fromFoo); // moved
4757 {#end_syntax_block#}4757 {#end_syntax_block#}
47584758
4759 <p>4759 <p>
4760 By default it is a <b>compile error</b> to reference deprecated code in4760 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 defined4761 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 dependency4762 by dependencies. This behavior can be overridden for the entire dependency
4763 tree by passing {#syntax#}-fallow-deprecated{#endsyntax#} or4763 tree by passing {#syntax#}-fallow-deprecated{#endsyntax#} or
4764 {#syntax#}-fno-allow-deprecated{#endsyntax#} to {#syntax#}zig build{#endsyntax#}.4764 {#syntax#}-fno-allow-deprecated{#endsyntax#} to {#syntax#}zig build{#endsyntax#}.
4765 </p>4765 </p>
4766 <p>4766 <p>
4767 Usage of this builtin is meant to help <i>direct</i> consumers discover (and remove)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 deprecated4768 their dependance on deprecated code during the grace period before a deprecated
4769 functionality is turned into a {#syntax#}@compileError{#endsyntax#} or4769 functionality is turned into a {#syntax#}@compileError{#endsyntax#} or
4770 removed entirely. 4770 removed entirely.
4771 </p>4771 </p>
47724772
4773 <p>4773 <p>
4774 Using {#syntax#}@deprecated{#endsyntax#} without an argument can be useful inside of blocks:4774 Using {#syntax#}@deprecated{#endsyntax#} without an argument can be useful inside of blocks:
4775 </p>4775 </p>
4776 {#code|test_deprecated_builtin.zig#}4776 {#code|test_deprecated_builtin.zig#}
4777 4777
4778 {#header_close#}4778 {#header_close#}
47794779
4780 {#header_open|@divExact#}4780 {#header_open|@divExact#}
...@@ -4891,8 +4891,8 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved...@@ -4891,8 +4891,8 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
4891 <pre>{#syntax#}@errorCast(value: anytype) anytype{#endsyntax#}</pre>4891 <pre>{#syntax#}@errorCast(value: anytype) anytype{#endsyntax#}</pre>
4892 <p>4892 <p>
4893 Converts an error set or error union value from one error set to another error set. The return type is the4893 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 error4894 inferred result type. Attempting to convert an error which is not in the destination error
4895 set results in safety-checked {#link|Illegal Behavior#}.4895 set results in safety-checked {#link|Illegal Behavior#}.
4896 </p>4896 </p>
4897 {#header_close#}4897 {#header_close#}
48984898
...@@ -4971,7 +4971,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved...@@ -4971,7 +4971,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
4971 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>4971 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
4972 <p>4972 <p>
4973 Converts an integer to the closest floating point representation. The return type is the inferred result type.4973 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 legal4974 To convert the other way, use {#link|@intFromFloat#}. This operation is legal
4975 for all values of all integer types.4975 for all values of all integer types.
4976 </p>4976 </p>
4977 {#header_close#}4977 {#header_close#}
...@@ -5063,7 +5063,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved...@@ -5063,7 +5063,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
5063 <pre>{#syntax#}@intCast(int: anytype) anytype{#endsyntax#}</pre>5063 <pre>{#syntax#}@intCast(int: anytype) anytype{#endsyntax#}</pre>
5064 <p>5064 <p>
5065 Converts an integer to another integer while keeping the same numerical value.5065 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.
5067 Attempting to convert a number which is out of range of the destination type results in5067 Attempting to convert a number which is out of range of the destination type results in
5068 safety-checked {#link|Illegal Behavior#}.5068 safety-checked {#link|Illegal Behavior#}.
5069 </p>5069 </p>
...@@ -5316,7 +5316,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved...@@ -5316,7 +5316,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
5316 <pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>5316 <pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>
5317 <p>5317 <p>
5318 Converts an integer to a {#link|pointer|Pointers#}. The return type is the inferred result type.5318 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 type5319 To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
5320 which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a5320 which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a
5321 {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.5321 {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.
5322 </p>5322 </p>
test/tests.zig+1-1
...@@ -1195,7 +1195,7 @@ pub fn addCliTests(b: *std.Build) *Step {...@@ -1195,7 +1195,7 @@ pub fn addCliTests(b: *std.Build) *Step {
1195 \\}1195 \\}
1196 \\1196 \\
1197 \\test {1197 \\test {
1198 \\ if (bad != 42) return error.Bad; 1198 \\ if (bad != 42) return error.Bad;
1199 \\}1199 \\}
1200 ;1200 ;
12011201