| ... | ... | @@ -4746,19 +4746,18 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 4746 | 4746 | <pre>{#syntax#}@deprecated() void{#endsyntax#}</pre> |
| 4747 | 4747 | <p> |
| 4748 | 4748 | 	 Used to mark a given code path as deprecated. It evaluates to the same value |
| 4749 | | 	 passed in as argument, or the {#syntax#}void{#endsyntax#} value when given none. |
| 4749 | 	 passed in as argument, or the void value when given none. |
| 4750 | 4750 | </p> |
| 4751 | 4751 | <p> |
| 4752 | | As an example, in Zig 0.14.0 {#syntax#}std.time.sleep{#endsyntax#} was |
| 4753 | | 	 deprecated and the sleep function was moved to {#syntax#}std.Thread.sleep{#endsyntax#}. |
| 4754 | | 	 This is how this deprecation could have been expressed: |
| 4755 | | 	 |
| 4756 | | {#syntax_block|zig|lib/std/time.zig#} |
| 4757 | | pub const sleep = @deprecated(std.Thread.sleep); // moved |
| 4758 | | {#end_syntax_block#} |
| 4752 | 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: |
| 4759 | 4754 | 	 </p> |
| 4755 | {#syntax_block|zig|root.zig#} |
| 4756 | pub const fooToBar = @deprecated(bar.fromFoo); // moved |
| 4757 | {#end_syntax_block#} |
| 4758 | |
| 4760 | 4759 | <p> |
| 4761 | | By default it is a <b>compile error</b> to depend on deprecated code in |
| 4760 | By default it is a <b>compile error</b> to reference deprecated code in |
| 4762 | 4761 | 	 a module defined by the root package, while it is not in modules defined |
| 4763 | 4762 | 	 by dependencies. This behavior can be overridden for the entire dependency |
| 4764 | 4763 | 	 tree by passing {#syntax#}-fallow-deprecated{#endsyntax#} or |
| ... | ... | @@ -4772,9 +4771,9 @@ pub const sleep = @deprecated(std.Thread.sleep); // moved |
| 4772 | 4771 | </p> |
| 4773 | 4772 | |
| 4774 | 4773 | 	 <p> |
| 4775 | | {#syntax#}@deprecated{#endsyntax#} can also be used without argument: 	 |
| 4776 | | {#code|test_deprecated_builtin.zig#} |
| 4774 | Using {#syntax#}@deprecated{#endsyntax#} without an argument can be useful inside of blocks: |
| 4777 | 4775 | 	 </p> |
| 4776 | {#code|test_deprecated_builtin.zig#} |
| 4778 | 4777 | 	 |
| 4779 | 4778 | {#header_close#} |
| 4780 | 4779 | |