mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 17:26:12 +00:00
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`