Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 1.62.0 with macro exports in doctests #98735

Closed
jonhoo opened this issue Jun 30, 2022 · 7 comments
Closed

Regression in 1.62.0 with macro exports in doctests #98735

jonhoo opened this issue Jun 30, 2022 · 7 comments
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Jun 30, 2022

Code

I tried this code (in a crate called foo):

/// ```
/// # #[macro_use] extern crate foo;
///
/// mockable! {}
/// ```
macro_rules! mockable {
    () => {};
}

and run

$ cargo t --doc

I expected to see this happen: the doctest passes

Instead, this happened: the doctest fails to build with

running 1 test
test src/lib.rs - mockable (line 1) ... FAILED

failures:

---- src/lib.rs - mockable (line 1) stdout ----
error: cannot find macro `mockable` in this scope
 --> src/lib.rs:4:1
  |
5 | mockable! {}
  | ^^^^^^^^

error: aborting due to previous error

Version it worked on

It most recently worked on: Rust 1.61.0

Version with regression

rustc --version --verbose:

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: aarch64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5

Notes

It works if I add #[macro_export] above the macro_rules!. If intended, this feels like it should be listed in the compatibility notes.

@jonhoo jonhoo added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jun 30, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 30, 2022
@steffahn
Copy link
Member

On my machine, on 1.61 or older it doesn’t appear to be running the doctest at all (i.e. it says running 0 tests, and the test could just as well be completely invalid code, or unconditionally failing); does that mirror what you’re observing?

@jonhoo
Copy link
Contributor Author

jonhoo commented Jun 30, 2022

Oh, yes, good catch, that's what I observe on 1.61 and before too.

@jonhoo
Copy link
Contributor Author

jonhoo commented Jun 30, 2022

Makes me wonder if this is somehow related to rust-lang/cargo#10594

@steffahn
Copy link
Member

Running cargo-bisect-rustc

regressed nightly: nightly-2022-05-06
searched commit range: 4c60a0e...30f3860
regressed commit: 3d18f94

which is #96630 which has a relnotes tag, and is considered a bugfix (of #88038). I don’t know why it didn’t actually end up in the release notes, as far as I can tell.

@jyn514
Copy link
Member

jyn514 commented Jun 30, 2022

Duplicate of #97030

@jonhoo
Copy link
Contributor Author

jonhoo commented Jun 30, 2022

@jyn514 I left a comment over there. I think we should make sure to update the changelog with a note about this change then, and sooner rather than later since 1.62.0 is now out.

@jyn514
Copy link
Member

jyn514 commented Jun 30, 2022

I'm not the one who approved the PR. Anyone is welcome to submit a change to the release notes.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 1, 2022
Add macro_rules! rustdoc change to 1.62 relnotes

rust-lang#96630 was tagged <kbd>relnotes</kbd> but didn't make it into the notes. Given this is a compatibility issue (rust-lang#97030, rust-lang#98735, rust-lang#98743), it probably *should* be retroactively added.
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 1, 2022
jbgalet added a commit to jbgalet/MLA that referenced this issue Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

No branches or pull requests

5 participants