Closed
Description
This is a tracking issue for the RFC "dyn Trait
Syntax for Trait Objects: Take 2 " (rust-lang/rfcs#2113).
Implementation plan:
- In Rust 2015, accept
dyn Foo
but we parsedyn ::Foo
asdyn::Foo
- 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)
- In Rust 2018, we parse
dyn
only as adyn Trait
, and hencedyn ::Foo
- We have a rustfix-compatible lint that suggests rewriting
Trait
todyn Trait
; if the pathTrait
is absolute (::Trait
), then we suggestdyn (::Trait)
- This is an "idiom shift" lint, in @Manishearth's terminology from Provide a way to distinguish between "breakage" and "idiom" epoch lints? #48796
- It is opt-in via the use of
#[warn(rust_2018_idioms)]
(Tracking issue for warning for rust_2018_idioms by default #54910)
- Use
dyn Trait
in error messages (usedyn
syntax in error messages #49277)
Steps to stabilize:
- Adjust documentation (
dyn
Trait (RFC 2113) reference#279) (see instructions on forge) - Stabilization PR (see instructions on forge)