| ... | @@ -2415,8 +2415,8 @@ test "anonymous list literal syntax" { | ... | @@ -2415,8 +2415,8 @@ test "anonymous list literal syntax" { |
| 2415 | } | 2415 | } |
| 2416 | {#code_end#} | 2416 | {#code_end#} |
| 2417 | <p> | 2417 | <p> |
| 2418 | If there is no type in the result location then an anonymous list literal actually | 2418 | If there is no type in the {#link|result location|Result Location Semantics#} then an |
| 2419 | turns into a {#link|struct#} with numbered field names: | 2419 | anonymous list literal actually turns into a {#link|struct#} with numbered field names: |
| 2420 | </p> | 2420 | </p> |
| 2421 | {#code_begin|test|infer_list_literal#} | 2421 | {#code_begin|test|infer_list_literal#} |
| 2422 | const std = @import("std"); | 2422 | const std = @import("std"); |
| ... | @@ -3497,7 +3497,8 @@ fn List(comptime T: type) type { | ... | @@ -3497,7 +3497,8 @@ fn List(comptime T: type) type { |
| 3497 | {#header_open|Anonymous Struct Literals#} | 3497 | {#header_open|Anonymous Struct Literals#} |
| 3498 | <p> | 3498 | <p> |
| 3499 | Zig allows omitting the struct type of a literal. When the result is {#link|coerced|Type Coercion#}, | 3499 | Zig allows omitting the struct type of a literal. When the result is {#link|coerced|Type Coercion#}, |
| 3500 | the struct literal will directly instantiate the result location, with no copy: | 3500 | the struct literal will directly instantiate the {#link|result location|Result Location Semantics#}, |
| | 3501 | with no copy: |
| 3501 | </p> | 3502 | </p> |
| 3502 | {#code_begin|test|struct_result#} | 3503 | {#code_begin|test|struct_result#} |
| 3503 | const std = @import("std"); | 3504 | const std = @import("std"); |
| ... | @@ -3515,8 +3516,8 @@ test "anonymous struct literal" { | ... | @@ -3515,8 +3516,8 @@ test "anonymous struct literal" { |
| 3515 | } | 3516 | } |
| 3516 | {#code_end#} | 3517 | {#code_end#} |
| 3517 | <p> | 3518 | <p> |
| 3518 | The struct type can be inferred. Here the result location does not include a type, and | 3519 | The struct type can be inferred. Here the {#link|result location|Result Location Semantics#} |
| 3519 | so Zig infers the type: | 3520 | does not include a type, and so Zig infers the type: |
| 3520 | </p> | 3521 | </p> |
| 3521 | {#code_begin|test|struct_anon#} | 3522 | {#code_begin|test|struct_anon#} |
| 3522 | const std = @import("std"); | 3523 | const std = @import("std"); |