Fix span edition for 2024 RPIT coming from an external macro
This fixes a problem where code generated by an external macro with an RPIT would end up using the call-site edition instead of the macro's edition for the RPIT. When used from a 2024 crate, this caused the code to change behavior to the 2024 capturing rules, which we don't want. This was caused by the impl-trait lowering code would replace the span with one marked with `DesugaringKind::OpaqueTy` desugaring. However, it was also overriding the edition of the span with the edition of the local crate. Instead it should be using the edition of the span itself. Fixes https://github.com/rust-lang/rust/issues/132917
This commit is contained in:
parent
d163541022
commit
03e2828e88
3 changed files with 2 additions and 94 deletions
|
@ -738,7 +738,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
allow_internal_unstable: Option<Lrc<[Symbol]>>,
|
||||
) -> Span {
|
||||
self.tcx.with_stable_hashing_context(|hcx| {
|
||||
span.mark_with_reason(allow_internal_unstable, reason, self.tcx.sess.edition(), hcx)
|
||||
span.mark_with_reason(allow_internal_unstable, reason, span.edition(), hcx)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue