Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete old 'existential type' provisional syntax #1061

Merged
merged 1 commit into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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