-
Notifications
You must be signed in to change notification settings - Fork 58
DOCS_RS=1 cargo build
fails, even with a patch to proc-macro2
#114
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
Comments
Addon: can only reproduce on stable toolchain. |
I seem to be unable to reproduce this, what rustc/cargo versions are you on? |
We are on |
Ah I figured out how to reproduce it. If you build it normally first, and then build it with |
That's why I emphasized |
I completely managed to read over that, oops. |
Expanding the macro actually works fine with I'm trying to trace the cause. It seems to start at https://github.com/dtolnay/proc-macro2/blob/master/build.rs#L32 , where DOCS_RS being set causes different configuration variables to be set in proc_macro2. One of those configuration variables probably breaks things. To be specific, if semver_exempt && proc_macro_span {
// Implement the semver exempt API in terms of the nightly-only
// proc_macro API.
println!("cargo:rustc-cfg=super_unstable");
} Indicating that it now might use unstable, nightly-only APIs for proc-macro processing. Doing this on a stable compiler probably has some issues, which you are probably encountering. Based on this, I don't think this is a dynasm-rs issue. Setting the Although I am not quite sure where this is actually causing the breakage. I couldn't immediately find out where these flags being set would change the behaviour of the proc_macro2 crate as I shouldn't be using any semver exempt APIs. |
This corresponds to my investigation here: GnomedDev/proc-macro-error-2#12 (comment) I'm also not sure the root cause and dtolnay seems ignored my PR and related issues, unfortunately. Is it possible to skip related macros in |
The thing that is breaking is the hygiene of the initial argument to the dynasm! macro, which is kind of the point of the entire crate. I could disable its contents when it is called with DOCS_RS=1, but then the entire test suite would be nop'd. I suppose we could just not build the |
That is enough for dynasm-rs but not for the crates which depends on it. The culprit is dynasm! macro breaking. Maybe just a dumb implementation for dynasm! macro when DOCS_RS=1?
…________________________________
From: CensoredUsername ***@***.***>
Sent: Thursday, May 22, 2025 12:47:57 AM
To: CensoredUsername/dynasm-rs ***@***.***>
Cc: lazymio ***@***.***>; Author ***@***.***>
Subject: Re: [CensoredUsername/dynasm-rs] `DOCS_RS=1 cargo build` fails, even with a patch to `proc-macro2` (Issue #114)
[https://avatars.githubusercontent.com/u/3411575?s=20&v=4]CensoredUsername left a comment (CensoredUsername/dynasm-rs#114)<#114 (comment)>
The thing that is breaking is the hygiene of the initial argument to the dynasm! macro, which is kind of the point of the entire crate. I could disable its contents when it is called with DOCS_RS=1, but then the entire test suite would be nop'd.
I suppose we could just not build the testing crate when DOCS_RS=1? It shouldn't need to be documented anyway.
—
Reply to this email directly, view it on GitHub<#114 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHJULOZWF7DTDQA5E2LMZF327SU33AVCNFSM6AAAAAB5LVNABOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQOJYGYYDQNZUGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I'm unsure of this, it'd be nicer if the actual issue could be resolved instead of adding hacks around more hacks. proc_macro2 behaving differently on a DOCS_RS=1 build is a pretty significant issue to begin with. |
DOCS_RS=1 cargo build
fails with (note acargo clean
is crucial to reproduce):I have a PR to fix
proc-macro-error2
: dtolnay/proc-macro2#501 but even with that,dynasm
gives new errors. To reproduce, add these lines to Cargo.toml:This passes
DOCS_RS=1 cargo build
but unfortunately any users (including us, LibAFL) usingdynasmrt::dynasm!
will still gets an error. This looks a fault indynasm
crate and thus I reported it here.To reproduce, build a simple test
DOCS_RS=1 cargo build --test aarch64_immediate_checking
would reproduce. Notecargo clean
is still necessary to reproduce this.Related issue: GnomedDev/proc-macro-error-2#12
The text was updated successfully, but these errors were encountered: