diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 2ed6b12c71..849a013f69 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -2228,6 +2228,21 @@ pub fn requiresLibC(target: *const Target) bool { }; } +/// The places where a user can specify an address space attribute +pub const AddressSpaceContext = enum { + /// A function is specified to be placed in a certain address space. + function, + /// A (global) variable is specified to be placed in a certain address space. In contrast to + /// `.constant`, these values (and thus the address space they will be placed in) are required + /// to be mutable. + variable, + /// A (global) constant value is specified to be placed in a certain address space. In contrast + /// to `.variable`, values placed in this address space are not required to be mutable. + constant, + /// A pointer is ascripted to point into a certain address space. + pointer, +}; + /// Returns whether this target supports `address_space`. If `context` is `null`, this /// function simply answers the general question of whether the target has any concept /// of `address_space`; if non-`null`, the function additionally checks whether @@ -2235,7 +2250,7 @@ pub fn requiresLibC(target: *const Target) bool { pub fn supportsAddressSpace( target: Target, address_space: std.builtin.AddressSpace, - context: ?std.builtin.AddressSpace.Context, + context: ?AddressSpaceContext, ) bool { const arch = target.cpu.arch; diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 46d3678297..3e1413cd99 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) { /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. pub const AddressSpace = enum(u5) { - /// The places where a user can specify an address space attribute - pub const Context = enum { - /// A function is specified to be placed in a certain address space. - function, - /// A (global) variable is specified to be placed in a certain address space. - /// In contrast to .constant, these values (and thus the address space they will be - /// placed in) are required to be mutable. - variable, - /// A (global) constant value is specified to be placed in a certain address space. - /// In contrast to .variable, values placed in this address space are not required to be mutable. - constant, - /// A pointer is ascripted to point into a certain address space. - pointer, - }; - // CPU address spaces. generic, gs, diff --git a/src/Sema.zig b/src/Sema.zig index 4872f47ac7..9b086e201e 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -36517,7 +36517,7 @@ fn resolveAddressSpace( block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref, - ctx: std.builtin.AddressSpace.Context, + ctx: std.Target.AddressSpaceContext, ) !std.builtin.AddressSpace { const air_ref = try sema.resolveInst(zir_ref); return sema.analyzeAsAddressSpace(block, src, air_ref, ctx); @@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace( block: *Block, src: LazySrcLoc, air_ref: Air.Inst.Ref, - ctx: std.builtin.AddressSpace.Context, + ctx: std.Target.AddressSpaceContext, ) !std.builtin.AddressSpace { const pt = sema.pt; const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace); @@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers( }; const @"addrspace": std.builtin.AddressSpace = as: { - const addrspace_ctx: std.builtin.AddressSpace.Context = switch (zir_decl.kind) { + const addrspace_ctx: std.Target.AddressSpaceContext = switch (zir_decl.kind) { .@"var" => .variable, else => switch (nav_ty.zigTypeTag(zcu)) { .@"fn" => .function,