Skip to content

Stdlib .rmeta files not included in sysroot glob, causing "only metadata stub found" errors with recent Rust nightlies #3859

Closed

Description

@redsun82

Starting around nightly 2026-01-22 (rustc 1.95.0-nightly), the Rust distribution ships stdlib .rlib files as ~440-byte metadata stubs, with full metadata in separate .rmeta files alongside them. Previously, .rlib files contained the full metadata (~47MB each) and no .rmeta files existed.

The _build_file_for_stdlib_template glob only includes *.rlib and not *.rmeta, so the metadata files are excluded from the sysroot, causing:

error[E0786]: found invalid metadata files for crate `core`
  = note: only metadata stub found for rlib dependency `core`

Cargo builds with the same nightly work fine, confirming the issue is specific to how rules_rust assembles the sysroot.

Fix

Add *.rmeta to the glob:

     srcs = glob(
         [
             "lib/rustlib/{target_triple}/lib/*.rlib",
+            "lib/rustlib/{target_triple}/lib/*.rmeta",
             "lib/rustlib/{target_triple}/lib/*{dylib_ext}*",

_symlink_sysroot_tree symlinks all files from the stdlib target, so the new files will be picked up transitively. _rust_stdlib_filegroup_impl iterates over .rlib files specifically for ordering, but that should still work since .rlib files are still present.

Versions

  • rules_rust: 0.68.1
  • Rust: nightly-2026-01-22 (rustc 1.95.0-nightly)
  • Bazel: 8.x
  • Platforms confirmed: macOS aarch64, macOS x86_64 (cross-compile)

Activity

  1. added a commit that references this issue on Feb 23, 2026
    5f633d2
  2. added a commit that references this issue on Apr 2, 2026
    e3960c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions