From 0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9 Mon Sep 17 00:00:00 2001 From: mlugg Date: Wed, 28 Aug 2024 02:35:53 +0100 Subject: [PATCH] std: update `std.builtin.Type` fields to follow naming conventions The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938. --- doc/langref.html.in | 24 +- doc/langref/inline_prong_range.zig | 4 +- doc/langref/poc_printValue_fn.zig | 6 +- doc/langref/test_enums.zig | 6 +- doc/langref/test_error_union.zig | 4 +- doc/langref/test_fn_reflection.zig | 6 +- doc/langref/test_inline_else.zig | 4 +- doc/langref/test_inline_switch.zig | 4 +- doc/langref/test_optional_type.zig | 2 +- doc/langref/test_pointer_casting.zig | 2 +- doc/langref/test_variable_alignment.zig | 2 +- doc/langref/test_variable_func_alignment.zig | 2 +- doc/langref/test_variadic_function.zig | 2 +- lib/compiler/aro/aro/Attribute.zig | 28 +- lib/compiler/aro/aro/Compilation.zig | 4 +- lib/compiler/aro/aro/Tree.zig | 4 +- lib/compiler/aro/aro/Value.zig | 2 +- lib/compiler/aro/backend/Interner.zig | 8 +- lib/compiler/aro_translate_c.zig | 2 +- lib/compiler/resinator/bmp.zig | 2 +- lib/compiler/resinator/code_pages.zig | 2 +- lib/compiler/resinator/errors.zig | 2 +- lib/compiler/resinator/ico.zig | 2 +- lib/compiler/resinator/lang.zig | 2 +- lib/compiler/test_runner.zig | 2 +- lib/compiler_rt/addf3.zig | 2 +- lib/compiler_rt/ceil.zig | 2 +- lib/compiler_rt/common.zig | 10 +- lib/compiler_rt/comparef.zig | 4 +- lib/compiler_rt/cos.zig | 2 +- lib/compiler_rt/count0bits.zig | 2 +- lib/compiler_rt/exp.zig | 2 +- lib/compiler_rt/exp2.zig | 2 +- lib/compiler_rt/extendf.zig | 10 +- lib/compiler_rt/fabs.zig | 4 +- lib/compiler_rt/float_from_int.zig | 2 +- lib/compiler_rt/floor.zig | 2 +- lib/compiler_rt/fma.zig | 2 +- lib/compiler_rt/fmax.zig | 2 +- lib/compiler_rt/fmin.zig | 2 +- lib/compiler_rt/fmod.zig | 4 +- lib/compiler_rt/int_from_float.zig | 8 +- lib/compiler_rt/log.zig | 2 +- lib/compiler_rt/log10.zig | 2 +- lib/compiler_rt/log2.zig | 2 +- lib/compiler_rt/mulf3.zig | 6 +- lib/compiler_rt/parity.zig | 2 +- lib/compiler_rt/round.zig | 2 +- lib/compiler_rt/sin.zig | 2 +- lib/compiler_rt/sincos.zig | 4 +- lib/compiler_rt/sqrt.zig | 2 +- lib/compiler_rt/tan.zig | 2 +- lib/compiler_rt/trunc.zig | 2 +- lib/compiler_rt/truncf.zig | 12 +- lib/compiler_rt/trunctfxf2.zig | 2 +- lib/docs/wasm/Walk.zig | 2 +- lib/docs/wasm/markdown/Document.zig | 2 +- lib/docs/wasm/markdown/Parser.zig | 2 +- lib/fuzzer.zig | 4 +- lib/std/Build.zig | 46 +- lib/std/Build/Cache.zig | 6 +- lib/std/Build/Cache/Path.zig | 4 +- lib/std/Build/Step/ConfigHeader.zig | 22 +- lib/std/Build/Step/Options.zig | 34 +- lib/std/Build/Step/Run.zig | 2 +- lib/std/Progress.zig | 18 +- lib/std/Random.zig | 40 +- lib/std/Target.zig | 4 +- lib/std/Target/Query.zig | 4 +- lib/std/Target/aarch64.zig | 4 +- lib/std/Target/amdgpu.zig | 4 +- lib/std/Target/arc.zig | 4 +- lib/std/Target/arm.zig | 4 +- lib/std/Target/avr.zig | 4 +- lib/std/Target/bpf.zig | 4 +- lib/std/Target/csky.zig | 4 +- lib/std/Target/hexagon.zig | 4 +- lib/std/Target/loongarch.zig | 4 +- lib/std/Target/m68k.zig | 4 +- lib/std/Target/mips.zig | 4 +- lib/std/Target/msp430.zig | 4 +- lib/std/Target/nvptx.zig | 4 +- lib/std/Target/powerpc.zig | 4 +- lib/std/Target/riscv.zig | 4 +- lib/std/Target/s390x.zig | 4 +- lib/std/Target/sparc.zig | 4 +- lib/std/Target/spirv.zig | 4 +- lib/std/Target/ve.zig | 4 +- lib/std/Target/wasm.zig | 4 +- lib/std/Target/x86.zig | 4 +- lib/std/Target/xtensa.zig | 4 +- lib/std/Thread.zig | 18 +- lib/std/array_hash_map.zig | 22 +- lib/std/bit_set.zig | 4 +- lib/std/builtin.zig | 48 +- lib/std/c/darwin.zig | 2 +- lib/std/compress/flate/huffman_encoder.zig | 2 +- lib/std/crypto/cmac.zig | 2 +- lib/std/crypto/ff.zig | 4 +- lib/std/crypto/phc_encoding.zig | 16 +- lib/std/crypto/timing_safe.zig | 14 +- lib/std/crypto/tls.zig | 4 +- lib/std/debug.zig | 2 +- lib/std/debug/Dwarf.zig | 2 +- lib/std/debug/Dwarf/expression.zig | 6 +- lib/std/debug/FixedBufferReader.zig | 2 +- lib/std/debug/Pdb.zig | 2 +- lib/std/debug/SelfInfo.zig | 10 +- lib/std/enums.zig | 62 +- lib/std/fmt.zig | 76 +- lib/std/fmt/format_float.zig | 12 +- lib/std/fmt/parse_float.zig | 4 +- lib/std/hash/auto_hash.zig | 56 +- lib/std/hash/verify.zig | 10 +- lib/std/hash_map.zig | 22 +- lib/std/heap/logging_allocator.zig | 2 +- lib/std/io.zig | 8 +- lib/std/io/Reader.zig | 6 +- lib/std/io/Writer.zig | 4 +- lib/std/io/bit_writer.zig | 2 +- lib/std/io/fixed_buffer_stream.zig | 6 +- lib/std/io/multi_writer.zig | 2 +- lib/std/io/tty.zig | 2 +- lib/std/json/static.zig | 46 +- lib/std/json/stringify.zig | 32 +- lib/std/leb128.zig | 38 +- lib/std/log.zig | 12 +- lib/std/math.zig | 196 +- lib/std/math/big.zig | 2 +- lib/std/math/big/int.zig | 24 +- lib/std/math/big/int_test.zig | 26 +- lib/std/math/big/rational.zig | 14 +- lib/std/math/copysign.zig | 2 +- lib/std/math/float.zig | 20 +- lib/std/math/frexp.zig | 2 +- lib/std/math/gcd.zig | 4 +- lib/std/math/hypot.zig | 4 +- lib/std/math/ilogb.zig | 2 +- lib/std/math/isfinite.zig | 2 +- lib/std/math/isinf.zig | 2 +- lib/std/math/isnormal.zig | 2 +- lib/std/math/iszero.zig | 4 +- lib/std/math/ldexp.zig | 2 +- lib/std/math/log.zig | 10 +- lib/std/math/log10.zig | 12 +- lib/std/math/log2.zig | 8 +- lib/std/math/log_int.zig | 8 +- lib/std/math/nextafter.zig | 12 +- lib/std/math/pow.zig | 6 +- lib/std/math/powi.zig | 2 +- lib/std/math/signbit.zig | 2 +- lib/std/math/sqrt.zig | 12 +- lib/std/mem.zig | 178 +- lib/std/mem/Allocator.zig | 20 +- lib/std/meta.zig | 190 +- lib/std/meta/trailer_flags.zig | 16 +- lib/std/multi_array_list.zig | 21 +- lib/std/os/emscripten.zig | 2 +- lib/std/os/linux.zig | 14 +- lib/std/os/linux/bpf.zig | 2 +- lib/std/os/uefi/protocol/device_path.zig | 4 +- lib/std/os/uefi/status.zig | 4 +- lib/std/posix.zig | 4 +- lib/std/posix/test.zig | 2 +- lib/std/process/Child.zig | 2 +- lib/std/segmented_list.zig | 2 +- lib/std/simd.zig | 14 +- lib/std/start.zig | 12 +- lib/std/testing.zig | 132 +- lib/std/zig.zig | 4 +- lib/std/zig/AstGen.zig | 78 +- lib/std/zig/ErrorBundle.zig | 12 +- lib/std/zig/Server.zig | 6 +- lib/std/zig/Zir.zig | 16 +- lib/std/zig/c_translation.zig | 118 +- lib/std/zig/parser_test.zig | 2 +- lib/std/zig/system/windows.zig | 4 +- src/Air/types_resolved.zig | 50 +- src/Compilation.zig | 10 +- src/InternPool.zig | 186 +- src/Package/Fetch.zig | 4 +- src/Sema.zig | 1942 ++++++++--------- src/Sema/bitcast.zig | 14 +- src/Sema/comptime_ptr_access.zig | 128 +- src/Type.zig | 186 +- src/Value.zig | 260 +-- src/Zcu.zig | 8 +- src/Zcu/PerThread.zig | 14 +- src/arch/aarch64/CodeGen.zig | 112 +- src/arch/aarch64/abi.zig | 54 +- src/arch/arm/CodeGen.zig | 116 +- src/arch/arm/abi.zig | 52 +- src/arch/arm/bits.zig | 4 +- src/arch/riscv64/CodeGen.zig | 110 +- src/arch/riscv64/abi.zig | 62 +- src/arch/riscv64/bits.zig | 6 +- src/arch/sparc64/CodeGen.zig | 78 +- src/arch/wasm/CodeGen.zig | 184 +- src/arch/wasm/abi.zig | 48 +- src/arch/x86_64/CodeGen.zig | 236 +- src/arch/x86_64/Encoding.zig | 6 +- src/arch/x86_64/Lower.zig | 2 +- src/arch/x86_64/Mir.zig | 4 +- src/arch/x86_64/abi.zig | 66 +- src/arch/x86_64/bits.zig | 4 +- src/arch/x86_64/encoder.zig | 8 +- src/codegen.zig | 50 +- src/codegen/c.zig | 58 +- src/codegen/c/Type.zig | 50 +- src/codegen/llvm.zig | 226 +- src/codegen/llvm/BitcodeReader.zig | 6 +- src/codegen/llvm/Builder.zig | 94 +- src/codegen/llvm/bitcode_writer.zig | 18 +- src/codegen/spirv.zig | 130 +- src/codegen/spirv/Section.zig | 52 +- src/link.zig | 12 +- src/link/Coff.zig | 2 +- src/link/Dwarf.zig | 12 +- src/link/Elf/Atom.zig | 2 +- src/link/Elf/LdScript.zig | 2 +- src/link/Elf/LinkerDefined.zig | 8 +- src/link/Elf/Object.zig | 16 +- src/link/Elf/SharedObject.zig | 8 +- src/link/Elf/Symbol.zig | 2 +- src/link/Elf/ZigObject.zig | 16 +- src/link/MachO/Archive.zig | 2 +- src/link/MachO/Atom.zig | 2 +- src/link/MachO/Dylib.zig | 8 +- src/link/MachO/InternalObject.zig | 16 +- src/link/MachO/Object.zig | 16 +- src/link/MachO/Symbol.zig | 2 +- src/link/MachO/ZigObject.zig | 16 +- src/link/Wasm.zig | 12 +- src/link/Wasm/Object.zig | 4 +- src/link/Wasm/ZigObject.zig | 2 +- src/link/riscv.zig | 2 +- src/link/tapi/yaml.zig | 56 +- src/main.zig | 4 +- src/mutable_value.zig | 24 +- src/print_env.zig | 2 +- src/print_value.zig | 12 +- src/print_zir.zig | 6 +- src/translate_c.zig | 8 +- test/behavior/abs.zig | 2 +- test/behavior/align.zig | 2 +- test/behavior/async_fn.zig | 6 +- test/behavior/atomics.zig | 2 +- test/behavior/basic.zig | 10 +- test/behavior/bit_shifting.zig | 6 +- test/behavior/bitcast.zig | 4 +- test/behavior/call.zig | 6 +- test/behavior/cast.zig | 88 +- test/behavior/comptime_memory.zig | 2 +- test/behavior/empty_tuple_fields.zig | 12 +- test/behavior/enum.zig | 16 +- test/behavior/error.zig | 16 +- test/behavior/eval.zig | 4 +- .../export_self_referential_type_info.zig | 2 +- test/behavior/fn.zig | 10 +- test/behavior/generics.zig | 12 +- test/behavior/math.zig | 8 +- test/behavior/packed-struct.zig | 4 +- test/behavior/pointers.zig | 36 +- test/behavior/reflection.zig | 2 +- test/behavior/slice.zig | 6 +- test/behavior/struct.zig | 6 +- test/behavior/tuple.zig | 12 +- test/behavior/tuple_declarations.zig | 2 +- test/behavior/type.zig | 118 +- test/behavior/type_info.zig | 350 +-- ...e_info_mul_linksection_addrspace_decls.zig | 2 +- test/behavior/typename.zig | 2 +- test/behavior/union.zig | 12 +- test/behavior/usingnamespace.zig | 2 +- test/behavior/vector.zig | 34 +- test/c_import/macros.zig | 2 +- .../@errorCast_with_bad_type.zig | 4 +- .../access_invalid_typeInfo_decl.zig | 2 +- .../addition_with_non_numbers.zig | 2 +- ...nit_generic_fn_with_inferred_error_set.zig | 4 +- .../attempt_to_create_17_bit_float_type.zig | 2 +- .../binary_OR_operator_on_error_sets.zig | 2 +- ...store_in_comptime_switch_in_runtime_if.zig | 2 +- .../compile_errors/dereference_anyopaque.zig | 4 +- .../compile_errors/error_set_membership.zig | 2 +- .../compile_errors/for_loop_error_union.zig | 2 +- ...ailure_in_generic_function_return_type.zig | 6 +- .../helpful_return_type_error_message.zig | 6 +- .../invalid_pointer_arithmetic.zig | 2 +- .../invalid_pointer_with_reify_type.zig | 2 +- .../issue_15572_break_on_inline_while.zig | 2 +- ...d_by_typeInfo_and_passed_into_function.zig | 2 +- .../method_call_on_error_union.zig | 2 +- test/cases/compile_errors/nested_vectors.zig | 2 +- .../non-enum_tag_type_passed_to_union.zig | 2 +- ...teger_tag_type_to_automatic_union_enum.zig | 2 +- .../cases/compile_errors/not_an_enum_type.zig | 2 +- ...d_alignment_unavailable_for_reify_type.zig | 2 +- ...e_operator_in_switch_used_on_error_set.zig | 2 +- ...when_assigning_a_value_within_a_struct.zig | 2 +- .../reified_enum_field_value_overflow.zig | 2 +- .../reify_enum_with_duplicate_field.zig | 2 +- .../reify_enum_with_duplicate_tag_value.zig | 2 +- test/cases/compile_errors/reify_struct.zig | 10 +- .../reify_type.Fn_with_is_generic_true.zig | 2 +- ...th_is_var_args_true_and_non-C_callconv.zig | 2 +- .../reify_type.Fn_with_return_type_null.zig | 2 +- ...austive_enum_with_non-integer_tag_type.zig | 2 +- ...xhaustive_enum_with_undefined_tag_type.zig | 2 +- ...for_tagged_union_with_extra_enum_field.zig | 4 +- ...or_tagged_union_with_extra_union_field.zig | 4 +- ...e_for_tagged_union_with_no_enum_fields.zig | 4 +- ..._for_tagged_union_with_no_union_fields.zig | 4 +- ...reify_type_for_union_with_opaque_field.zig | 2 +- .../reify_type_union_payload_is_undefined.zig | 2 +- ...eify_type_with_invalid_field_alignment.zig | 6 +- .../reify_type_with_undefined.zig | 6 +- ...solve_inferred_error_set_of_generic_fn.zig | 4 +- ...runtime_index_into_comptime_type_slice.zig | 4 +- ...ating_arithmetic_does_not_allow_floats.zig | 2 +- ..._error_with_non_trivial_switch_operand.zig | 4 +- .../unable_to_evaluate_comptime_expr.zig | 2 +- ...are_resolved_before_tag_type_is_needed.zig | 2 +- .../union_noreturn_field_initialized.zig | 4 +- .../fn_typeinfo_passed_to_comptime_fn.zig | 2 +- .../@tagName on corrupted union value.zig | 2 +- test/link/build.zig | 2 +- test/src/Cases.zig | 8 +- test/standalone/build.zig | 2 +- test/standalone/simple/issue_7030.zig | 2 +- .../standalone/simple/std_enums_big_enums.zig | 26 +- tools/generate_c_size_and_align_checks.zig | 2 +- tools/lldb_pretty_printers.py | 2 +- tools/update_clang_options.zig | 2 +- tools/update_cpu_features.zig | 4 +- tools/update_spirv_features.zig | 4 +- 336 files changed, 4107 insertions(+), 4114 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 73ffbb0de81c..391702cf8fcd 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4299,7 +4299,7 @@ comptime { Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.

- Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this. + Asserts that {#syntax#}@typeInfo(DestType) != .pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this.

Can be used for these things for example: @@ -4517,7 +4517,7 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.

-

{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

+

{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgWeak#} {#header_close#} @@ -4549,7 +4549,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer or an enum.

-

{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

+

{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgStrong#} {#header_close#} @@ -4672,7 +4672,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val

Floored division. Rounds toward negative infinity. For unsigned integers it is the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and - {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}. + {#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.