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
This commit is contained in:
commit
4ed2291624
5 changed files with 29 additions and 1 deletions
|
@ -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()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue