Rollup merge of #69423 - petrochenkov:nont, r=Centril

syntax: Remove `Nt(Impl,Trait,Foreign)Item`

Follow-up to https://github.com/rust-lang/rust/pull/69366.
r? @Centril
This commit is contained in:
Dylan DPC 2020-02-26 02:07:14 +01:00 committed by GitHub
commit 7603c2cfba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 47 deletions

View file

@ -314,9 +314,6 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
Nonterminal::NtItem(ref item) => {
prepend_attrs(sess, &item.attrs, item.tokens.as_ref(), span)
}
Nonterminal::NtTraitItem(ref item) | Nonterminal::NtImplItem(ref item) => {
prepend_attrs(sess, &item.attrs, item.tokens.as_ref(), span)
}
Nonterminal::NtIdent(ident, is_raw) => {
Some(tokenstream::TokenTree::token(token::Ident(ident.name, is_raw), ident.span).into())
}

View file

@ -632,16 +632,10 @@ impl<'a> Parser<'a> {
}
pub fn parse_impl_item(&mut self) -> PResult<'a, Option<Option<P<AssocItem>>>> {
maybe_whole!(self, NtImplItem, |x| Some(Some(x)));
self.parse_assoc_item(|_| true)
}
pub fn parse_trait_item(&mut self) -> PResult<'a, Option<Option<P<AssocItem>>>> {
maybe_whole!(self, NtTraitItem, |x| Some(Some(x)));
// This is somewhat dubious; We don't want to allow
// param names to be left off if there is a definition...
//
// We don't allow param names to be left off in edition 2018.
self.parse_assoc_item(|t| t.span.rust_2018())
}
@ -834,8 +828,6 @@ impl<'a> Parser<'a> {
/// Parses a foreign item (one in an `extern { ... }` block).
pub fn parse_foreign_item(&mut self) -> PResult<'a, Option<Option<P<ForeignItem>>>> {
maybe_whole!(self, NtForeignItem, |item| Some(Some(item)));
Ok(self.parse_item_(|_| true)?.map(|Item { attrs, id, span, vis, ident, kind, tokens }| {
let kind = match kind {
ItemKind::Mac(a) => ForeignItemKind::Macro(a),