Skip to content

Commit

Permalink
Merge pull request #1061 from dtolnay/existential
Browse files Browse the repository at this point in the history
Delete old 'existential type' provisional syntax
  • Loading branch information
dtolnay authored Sep 4, 2021
2 parents eb66f5a + e9caa80 commit cde1644
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
52 changes: 0 additions & 52 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@ pub mod parsing {
use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenTree};
use std::iter::{self, FromIterator};

crate::custom_keyword!(existential);
crate::custom_keyword!(macro_rules);

#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
Expand Down Expand Up @@ -1123,8 +1122,6 @@ pub mod parsing {
input.parse().map(Item::Mod)
} else if lookahead.peek(Token![type]) {
parse_item_type(begin, input)
} else if lookahead.peek(existential) {
input.call(item_existential).map(Item::Verbatim)
} else if lookahead.peek(Token![struct]) {
input.parse().map(Item::Struct)
} else if lookahead.peek(Token![enum]) {
Expand Down Expand Up @@ -1959,53 +1956,6 @@ pub mod parsing {
}
}

#[cfg(not(feature = "printing"))]
fn item_existential(input: ParseStream) -> Result<TokenStream> {
Err(input.error("existential type is not supported"))
}

#[cfg(feature = "printing")]
fn item_existential(input: ParseStream) -> Result<TokenStream> {
use crate::attr::FilterAttrs;
use quote::{ToTokens, TokenStreamExt};

let attrs = input.call(Attribute::parse_outer)?;
let vis: Visibility = input.parse()?;
let existential_token: existential = input.parse()?;
let type_token: Token![type] = input.parse()?;
let ident: Ident = input.parse()?;

let mut generics: Generics = input.parse()?;
generics.where_clause = input.parse()?;

let colon_token: Token![:] = input.parse()?;

let mut bounds = Punctuated::new();
while !input.peek(Token![;]) {
if !bounds.is_empty() {
bounds.push_punct(input.parse::<Token![+]>()?);
}
bounds.push_value(input.parse::<TypeParamBound>()?);
}

let semi_token: Token![;] = input.parse()?;

let mut tokens = TokenStream::new();
tokens.append_all(attrs.outer());
vis.to_tokens(&mut tokens);
existential_token.to_tokens(&mut tokens);
type_token.to_tokens(&mut tokens);
ident.to_tokens(&mut tokens);
generics.to_tokens(&mut tokens);
generics.where_clause.to_tokens(&mut tokens);
if !bounds.is_empty() {
colon_token.to_tokens(&mut tokens);
bounds.to_tokens(&mut tokens);
}
semi_token.to_tokens(&mut tokens);
Ok(tokens)
}

#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ItemStruct {
fn parse(input: ParseStream) -> Result<Self> {
Expand Down Expand Up @@ -2609,8 +2559,6 @@ pub mod parsing {
}
} else if lookahead.peek(Token![type]) {
parse_impl_item_type(begin, input)
} else if vis.is_inherited() && defaultness.is_none() && lookahead.peek(existential) {
input.call(item_existential).map(ImplItem::Verbatim)
} else if vis.is_inherited()
&& defaultness.is_none()
&& (lookahead.peek(Ident)
Expand Down
1 change: 0 additions & 1 deletion src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ pub mod parsing {
|| input.peek(Token![fn])
|| input.peek(Token![mod])
|| input.peek(Token![type])
|| input.peek(item::parsing::existential) && input.peek2(Token![type])
|| input.peek(Token![struct])
|| input.peek(Token![enum])
|| input.peek(Token![union]) && input.peek2(Ident)
Expand Down

0 comments on commit cde1644

Please sign in to comment.