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

Change syntax of auto traits #238

Closed
dtolnay opened this issue Nov 12, 2017 · 2 comments · Fixed by #252
Closed

Change syntax of auto traits #238

dtolnay opened this issue Nov 12, 2017 · 2 comments · Fixed by #252
Assignees
Labels

Comments

@dtolnay
Copy link
Owner

dtolnay commented Nov 12, 2017

The syntax has changed from:

trait Send {}
impl Send for .. {}

to:

auto trait Send {}
@mystor
Copy link
Collaborator

mystor commented Nov 18, 2017

Do we still want to parse the old-style auto trait syntax, or should we only support parsing the new style syntax?

EDIT: It looks like rustc still supports parsing the old syntax for now, with a deny-by-default lint, so we should probably leave it in.

@dtolnay
Copy link
Owner Author

dtolnay commented Nov 18, 2017

From the discussion in rust-lang/rust#45247 it sounds like they intend to remove usage of the old form in rust-lang/rust as soon as stage0 is able to parse the new form, which may or may not happen before syn 0.12 is done. I would definitely prefer to remove the old form from the AST. The round trip test still needs to deal with the old form, so I leave it up to you whether we blacklist all the files containing impl for .. or parse it into some sentinel Item::Macro which is recognized and treated specially by ToTokens for ItemMacro.

// input tokens
impl Send for .. {}

// parsed into Item::Macro as if they had been this
syn::verbatim! {
    impl Send for .. {}
}

// printed by ToTokens
impl Send for .. {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants