-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Remove NtIdent hack for regressed crates #74616
Copy link
Copy link
Open
Labels
A-proc-macro-back-compatArea: Backwards compatibility hacks for proc macrosArea: Backwards compatibility hacks for proc macrosA-proc-macrosArea: Procedural macrosArea: Procedural macrosC-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-proc-macro-back-compatArea: Backwards compatibility hacks for proc macrosArea: Backwards compatibility hacks for proc macrosA-proc-macrosArea: Procedural macrosArea: Procedural macrosC-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What is this issue?
If you're a crate author who's been linked here, this issue tracks removing a backwards-compatibility hack in Rust.
Rust has a longstanding issue #43081, which causes procedural macros to lose location and hygiene information (known as a "Span") under certain circumstances. Recently, pull request #73084 was merged, which makes progress towards resolving #43081.
Unfortunately, older versions of certain procedural macro crates (such as
proc-macro-hack v0.5.15andjs-sys v0.3.39) cannot handle the changes in input caused by the Rust bugfix. To allow these crates to continue to compile, a backward-compatibility hack was added to adjust the input passed toproc-macro-hackandjs-sysspecifically.Eventually, we would like to remove this backwards-compatibility hack, since the compiler should not have hard-coded exceptions for certain crates. However, removing this hack will break any crates that depend on affected versions of
proc-macro-hackorjs-sys.To ensure that your crate continues to work, you'll want to ensure that your
Cargo.lockreferencesproc-macro-hackv0.5.16 or above, andjs-sysv0.3.40 or above. This can be done by runningcargo update -p proc-macro-hackandcargo update -p js-sys. If you maintain a library crate (without aCargo.lock, no action is needed on your part).Internal compiler details
In #73084 (comment), I added a hack to change the behavior of
NtIdents passed to certain proc-macros. This was done by special-casing certain identifiers, and should be eventually be removed in favor of a proper solution.If we decide to always wrap single identifiers in
None-delimited groups, then we will need to wait until enough of the ecosystem has bumpedproc-macro-hackandwasm-bindgen, to avoid breaking a large number of crates.Crater run: https://crater-reports.s3.amazonaws.com/pr-73084-1/index.html
Triage: https://hackmd.io/O7icbSylRP6uVZyAQ9EDeA