Description
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.15
and js-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 to proc-macro-hack
and js-sys
specifically.
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-hack
or js-sys
.
To ensure that your crate continues to work, you'll want to ensure that your Cargo.lock
references proc-macro-hack
v0.5.16 or above, and js-sys
v0.3.40 or above. This can be done by running cargo update -p proc-macro-hack
and cargo update -p js-sys
. If you maintain a library crate (without a Cargo.lock
, no action is needed on your part).
Internal compiler details
In #73084 (comment), I added a hack to change the behavior of NtIdent
s 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 bumped proc-macro-hack
and wasm-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