Skip to content

Commit 5f07fd2

Browse files
committed
Add links w/r/t edition 2015 and dyn keyword
1 parent d9e6023 commit 5f07fd2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_lint/src/unused.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,10 @@ impl EarlyLintPass for UnusedParens {
13581358
false
13591359
};
13601360

1361+
// In edition 2015, dyn is a contextual keyword and `dyn::foo::Bar` is
1362+
// parsed as a path, so parens are necessary to disambiguate. See
1363+
// - tests/ui/lint/unused/unused-parens-trait-obj-e2015.rs and
1364+
// - https://doc.rust-lang.org/reference/types/trait-object.html#r-type.trait-object.syntax-edition2018
13611365
let dyn2015_exception = cx.sess().psess.edition == Edition2015
13621366
&& matches!(ty.kind, ast::TyKind::TraitObject(..))
13631367
&& i == 0

0 commit comments

Comments
 (0)