rust-lang / rust-lang/rust

Exporting a `rustc_macro_transparency = "opaque"` macro from `std` spams `missing stability attribute` errors

Open
#146,993 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-decl-macros-2-0 A-hygiene C-bug F-decl_macro F-staged_api requires-internal-features T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

// inside any publicly visible module of `std`
// (not `core` or `alloc`)

#[doc(hidden)] // or any docs you want
#[unstable(feature = "foobar", issue = "none")] // or any stability you want
pub macro foo {() => {},}

I expected to see this happen: It compiles

Instead, this happened: 934 instances of error: ... has missing stability attribute, from items all over std

Meta

stage1 build of 15283f6fe95e5b604273d13a428bab5fc0788f5a (./x build library/std)

@rustbot label requires-nightly requires-internal-features F-staged_api F-decl_macro A-decl-macros-2-0 T-compiler A-hygiene

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by adding the shown macro to a publicly visible module in std and running the stage1 build command, ./x build library/std. Then trace the stability checking involved in exporting the opaque macro. Done means the std build completes without the reported missing stability attribute errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.