diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-04 05:02:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-04 05:02:07 +0200 |
| commit | 4ed2291624d227b105754a87a5f74cd9f884839e (patch) | |
| tree | 4a763263ebcb58764cdb1bff5c4a8f49957ba1fb /compiler/rustc_parse/src/parser | |
| parent | 3e293634e2e500153d5d8b4b609539b69af9951d (diff) | |
| parent | 7815641be0751ea3e2ac034585207632035af2ee (diff) | |
| download | rust-4ed2291624d227b105754a87a5f74cd9f884839e.tar.gz rust-4ed2291624d227b105754a87a5f74cd9f884839e.zip | |
Rollup merge of #116393 - compiler-errors:auto-bad, r=WaffleLapkin
Emit feature gate *warning* for `auto` traits pre-expansion Auto traits were introduced before we were more careful about not stabilizing new syntax pre-expansion. This is a more conservative step in the general direction we want to go in https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Removal.20of.20.60auto.20trait.60.20syntax. Fixes #116121
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index aad4edaba90..cc54cc5bebb 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -813,7 +813,12 @@ impl<'a> Parser<'a> { fn parse_item_trait(&mut self, attrs: &mut AttrVec, lo: Span) -> PResult<'a, ItemInfo> { let unsafety = self.parse_unsafety(Case::Sensitive); // Parse optional `auto` prefix. - let is_auto = if self.eat_keyword(kw::Auto) { IsAuto::Yes } else { IsAuto::No }; + let is_auto = if self.eat_keyword(kw::Auto) { + self.sess.gated_spans.gate(sym::auto_traits, self.prev_token.span); + IsAuto::Yes + } else { + IsAuto::No + }; self.expect_keyword(kw::Trait)?; let ident = self.parse_ident()?; |
