about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-30 21:06:44 +0200
committerGitHub <noreply@github.com>2021-05-30 21:06:44 +0200
commitbdd70622e2a721b8b384df103e8514372fef1150 (patch)
tree79715300d98d178607204fa407c244bc56e7435e /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent9c873c1240c0b4f7e7a26e9b01a4591cc2b6bb0f (diff)
parentd874ecc84f84cb4b3e1675c560759bb5deccf8d2 (diff)
downloadrust-bdd70622e2a721b8b384df103e8514372fef1150.tar.gz
rust-bdd70622e2a721b8b384df103e8514372fef1150.zip
Rollup merge of #85709 - Aaron1011:fix-pat-crate-edition, r=petrochenkov
Use correct edition when parsing `:pat` matchers

As described in issue #85708, we currently do not properly decode
`SyntaxContext::root()` and `ExpnId::root()` from foreign crates. As a
result, when we decode a span from a foreign crate with
`SyntaxContext::root()`, we end up up considering it to have the edition
of the *current* crate, instead of the foreign crate where it was
originally created.

A full fix for this issue will be a fairly significant undertaking.
Fortunately, it's possible to implement a partial fix, which gives us
the correct edition-dependent behavior for `:pat` matchers when the
macro is loaded from another crate. Since we have the edition of the
macro's defining crate available, we can 'recover' from seeing a
`SyntaxContext::root()` and use the edition of the macro's defining
crate.

Any solution to issue #85708 must reproduce the behavior of this
targeted fix - properly preserving a foreign `SyntaxContext::root()`
means (among other things) preserving its edition, which by definition
is the edition of the foreign crate itself. Therefore, this fix moves us
closer to the correct overall solution, and does not expose any new
incorrect behavior to macros.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions