]> git.lizzy.rs Git - rust.git/commitdiff
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)
[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

1  2 
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_resolve/lib.rs

Simple merge
Simple merge
Simple merge