Skip to content

StaticStringMap evaluation branch quota too low #19803

Closed
@zhylmzr

Description

@zhylmzr

Zig Version

0.13.0-dev.47+c231d9496

Steps to Reproduce and Observed Behavior

const std = @import("std");
const TypeToByteSizeLUT = std.StaticStringMap(u32).initComptime(.{
    .{ "bool", 0 },
    .{ "c_int", 0 },
    .{ "c_long", 0 },
    .{ "c_longdouble", 0 },
    .{ "t20", 0 },
    .{ "t19", 0 },
    .{ "t18", 0 },
    .{ "t17", 0 },
    .{ "t16", 0 },
    .{ "t15", 0 },
    .{ "t14", 0 },
    .{ "t13", 0 },
    .{ "t12", 0 },
    .{ "t11", 0 },
    .{ "t10", 0 },
    .{ "t9", 0 },
    .{ "t8", 0 },
    .{ "t7", 0 },
    .{ "t6", 0 },
    .{ "t5", 0 },
    .{ "t4", 0 },
    .{ "t3", 0 },
    .{ "t2", 0 },
    .{ "t1", 0 },
});

pub fn main() void {
    _ = TypeToByteSizeLUT.kvs;
}

The above example results in error: evaluation exceeded 1000 backwards branches, you can change any key name you want and it may or may not compile. Or you can change the order of t20 ~ t1 to t1 ~ t20 and it will compile.

Expected Behavior

Compile success.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions