This is a tracking issue for the RFC "`dyn Trait` Syntax for Trait Objects: Take 2 " (rust-lang/rfcs#2113). **Implementation plan:** - [x] In Rust 2015, accept `dyn Foo` but we parse `dyn ::Foo` as `dyn::Foo` - [x] We lint against uses of `dyn` as an identifier - This is a "breakage" lint, so it warns by default in Rust 2015 (and is inapplicable in Rust 2018) - [x] In Rust 2018, we parse `dyn` **only** as a `dyn Trait`, and hence `dyn ::Foo` - [x] We have a rustfix-compatible lint that suggests rewriting `Trait` to `dyn Trait`; if the path `Trait` is absolute (`::Trait`), then we suggest `dyn (::Trait)` - This is an "idiom shift" lint, in @Manishearth's terminology from https://github.com/rust-lang/rust/issues/48796 - It is opt-in via the use of `#[warn(rust_2018_idioms)]` (#54910) - [x] Use `dyn Trait` in error messages (https://github.com/rust-lang/rust/issues/49277) **Steps to stabilize:** - [x] Adjust documentation (https://github.com/rust-lang-nursery/reference/issues/279) ([see instructions on forge][doc-guide]) - [x] Stabilization PR ([see instructions on forge][stabilization-guide]) [stabilization-guide]: https://forge.rust-lang.org/stabilization-guide.html [doc-guide]: https://forge.rust-lang.org/stabilization-guide.html#updating-documentation
This is a tracking issue for the RFC "
dyn TraitSyntax for Trait Objects: Take 2 " (rust-lang/rfcs#2113).Implementation plan:
dyn Foobut we parsedyn ::Fooasdyn::Foodynas an identifierdynonly as adyn Trait, and hencedyn ::FooTraittodyn Trait; if the pathTraitis absolute (::Trait), then we suggestdyn (::Trait)#[warn(rust_2018_idioms)](Tracking issue for warning for rust_2018_idioms by default #54910)dyn Traitin error messages (usedynsyntax in error messages #49277)Steps to stabilize:
dynTrait (RFC 2113) reference#279) (see instructions on forge)