Change:
|     ^^^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library <ins> --> $DIR/issue-43106-gating-of-unstable.rs:10:1 | LL | #[unstable()] | ^^^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library </ins> --> $DIR/issue-43106-gating-of-unstable.rs:7:1 | LL | #![unstable()]

Discussion:
https://crater- https://crater- https://crater- https://crater- https://crater- https://crater-
searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.8</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </detailsDid this regress in ? cc
Specifically seems suspicious due to title alone, didn't look into it much though.
This was reported by one of the affected crate authors in
WG-prioritization assigning priority (). Since these crates regressed, it could probably be good to keep this on the radar (release in 15 days) label -I-prioritize +P-high
I plan to fix it later this week ( is assigned to me).
Fixed in
Thanks FWIW, I've since submitted a new version of which does not rely in this AST ordering quirk: maybe that way in a few months this "breakage" can take place? I wouldn't want to embody the following xkcd: <img src="" title="xkcd: workflow (1172)" alt="xkcd: workflow (1172)" height="400px" /
I plan to fix this properly in after the initial regression is addressed (maybe with a temporary deprecation lint), so fixing crates exploiting this bug still make sense.
Reopening to track beta backport
Closing, backported to beta.

I tried this code: I expected to see this happen: Instead, this happened: Note that this problem still does not occur at the top-most level. That is, removing above makes it work: It most recently worked on: +nightly-2024-04-27 : _ modify labels: +regression-from-stable-to-nightly -regression-untriaged
IIUC this is also on beta 1.79 but I don't think it's in 1.78, which becomes stable on Thursday.
Good point, in three (?) days it will become a !
beta 1.79 is already out IIRC?
Why did it work at all? The doc comment is defined earlier in the source order than the macro, so it shouldn't be able to see the macro.
This is from cc
The AST visiting order (mutable and immutable) was tweaked in , yes. Not sure which exactly pass is responsible for the change though. The new behavior looks correct to me, is not in scope at the doc comment's location. I wonder how widespread this breakage is.
I agree it could be sensible not to try to keep backcompat too much, and "tank" the breakage. Especially since adding a after the macro definition (as it is already customarily done so that a macro become nameable before its definition) does make the error go away: I am fine doing this for my crate which runs into this; I was just worried about doc strings potentially ending up, eventually, fully unable to refer to macros defined within the module. _ I do think something ought to be done w.r.t. the root/top-level module, since that one has not regressed, meaning it is currently still possible to have: working, which given the current issue, hints at some future regression eventually happening in the future: it could thus warrant a FCW, or a fully-fledged breakage here and now?
Note, that name resolution for inner attributes is not well defined, and that's why non-builtin inner attributes are unstable. For the same reasons it would be reasonable to keep unstable as well, but apparently nobody thought about this in time. The situation with is better than with inner attributes in general though, because at least it cannot transform content of the module it's applied to into something different. So in we can resolve inside without it going from under our feet.

I think my preference would be fixing the root module case, auditing the implementation for other possible interesting cases, and then running crater to see what code is affected.
I've encountered this very issue (with , but I guess it's the same thing), but the error messages seem a bit different, so it took me quite a while to find this issue here... I'll paste my minimal repro here so that it might help someone after me: If the approach is recommended, then the message could use some improvements here.
Fixed in
Reopening to track beta backport
Closing, backported in