# stage2: improvements aimed at std lib integration · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/bcfebb4b2b17dcac445fc5dedbbd259cc8c2f306)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: bcfebb4b2b17dcac445fc5dedbbd259cc8c2f306

Requested commit: bcfebb4b2b17dcac445fc5dedbbd259cc8c2f306

Commit: bcfebb4b2b17dcac445fc5dedbbd259cc8c2f306

Tree: 48950201c23c8ccde48e2e31c91464c7e96e6163

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: improvements aimed at std lib integration

 * AstGen: emit decl lookup ZIR instructions rather than directly
   looking up decls in AstGen. This is necessary because we want to
   reuse the same immutable ZIR code for multiple generic instantiations
   (and comptime function calls).
 * AstGen: fix using members_len instead of fields_len for struct decls.
 * structs: the struct_decl ZIR instruction is now also a block. This is
   so that the type expressions, default field value expressions, and
   alignment expressions can be evaluated in a scope that contains the
   decls from the struct namespace itself.
 * Add "std" and "builtin" packages to the builtin package.
 * Don't try to build glibc, musl, or mingw-w64 when using `-ofmt=c`.
 * builtin.zig is generated without `usingnamespace`.
 * builtin.zig takes advantage of `std.zig.fmtId` for CPU features.
 * A first pass at implementing `usingnamespace`. It's problematic and
   should either be deleted, or polished, before merging this branch.
 * Sema: allow explicitly specifying the namespace in which to look up
   Decls. This is used by `struct_decl` in order to put the decls from
   the struct namespace itself in scope when evaluating the type
   expressions, default value expressions, and alignment expressions.
 * Module: fix `analyzeNamespace` assuming that it is the top-level root
   declaration node.
 * Sema: implement comptime and runtime cmp operator.
 * Sema: implement peer type resolution for enums and enum literals.
 * Pull in the changes from master branch:
   262e09c482d98a78531c049a18b7f24146fe157f.
 * ZIR: complete out simple_ptr_type debug printing

```

## Parents

- [429cd2b5dd27bec15a4a3351114ce1bcd12d8d01](https://git.cafe/gitcafe/zig/commit/429cd2b5dd27bec15a4a3351114ce1bcd12d8d01?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/bcfebb4b2b17dcac445fc5dedbbd259cc8c2f306?format=markdown)
