]> git.lizzy.rs Git - rust.git/commit
Auto merge of #45247 - leodasvacas:implement-auto-trait-syntax, r=nikomatsakis
authorbors <bors@rust-lang.org>
Fri, 3 Nov 2017 19:07:45 +0000 (19:07 +0000)
committerbors <bors@rust-lang.org>
Fri, 3 Nov 2017 19:07:45 +0000 (19:07 +0000)
commit2278506f682062c7988c9e534a94366c56693981
tree8c86635bbe81ad87b766c5de883e3cca11b2e30d
parent59d484575a714291481563d13ad058b9a3d31fa8
parent5190abb941773ec54632c19c73d1f456831323b3
Auto merge of #45247 - leodasvacas:implement-auto-trait-syntax, r=nikomatsakis

[Syntax] Implement auto trait syntax

Implements `auto trait Send {}` as a substitute for `trait Send {} impl Send for .. {}`.

See the [internals thread](https://internals.rust-lang.org/t/pre-rfc-renaming-oibits-and-changing-their-declaration-syntax/3086) for motivation. Part of #13231.

The first commit is just a rename moving from "default trait" to "auto trait". The rest is parser->AST->HIR work and making it the same as the current syntax for everything below HIR. It's under the `optin_builtin_traits` feature gate.

When can we remove the old syntax? Do we need to wait for a new `stage0`? We also need to formally decide for the new form (even if the keyword is not settled yet).

Observations:
- If you `auto trait Auto {}` and then `impl Auto for .. {}` that's accepted even if it's redundant.
- The new syntax is simpler internally which will allow for a net removal of code, for example well-formedness checks are effectively moved to the parser.
- Rustfmt and clippy are broken, need to fix those.
- Rustdoc just ignores it for now.

ping @petrochenkov @nikomatsakis
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_resolve/lib.rs