Files
rust/compiler/rustc_parse/src
Jacob Pratt 0bd32c0e96 Rollup merge of #157577 - i-like-ICEs:fix-dyn-2015-parser, r=fmease
Fix parser error recovery treating 'dyn' as a strict keyword in Rust 2015 when used in `dyn + dyn`

Fixes: rust-lang/rust#157565

### Description
A diagnostics improvement rust-lang/rust#84896 in 2015 edition caused errors when `dyn + dyn` was used, even though `dyn` is a contextual keyword in the 2015 edition.

### Solution
A check was added in `rustc_parse/src/parser/ty.rs:1095`:
```rust
            if self.token.is_keyword(kw::Dyn) && self.token.span.edition().at_least_rust_2018() {
```
This checks that the version is not 2015 before throwing an error.
A regression test was also added, in `tests/ui/parser/dyn-2015-identifier.rs`
2026-06-11 00:34:16 -04:00
..
2026-05-10 21:05:36 +00:00