diff options
| author | David Wood <david@davidtw.co> | 2018-12-07 11:16:13 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2018-12-07 12:02:41 +0100 |
| commit | 7fcf31b181433cc67b17af550d87fca1e3394f90 (patch) | |
| tree | 97fdb66344f8c7ce96902dadeec4a9bf997a7f83 /src/libsyntax | |
| parent | e4dc15a96905217dbdf857159f67bfd79d5e4d7c (diff) | |
| download | rust-7fcf31b181433cc67b17af550d87fca1e3394f90.tar.gz rust-7fcf31b181433cc67b17af550d87fca1e3394f90.zip | |
Add suggestion for underscore binding fix.
This commit emits a suggestion for adding an underscore binding to arguments in trait methods that previously did not have a argument name specified.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index af63314b154..560078136eb 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1850,6 +1850,15 @@ impl<'a> Parser<'a> { Applicability::HasPlaceholders, ); } else if require_name && is_trait_item { + if let PatKind::Ident(_, ident, _) = pat.node { + err.span_suggestion_with_applicability( + pat.span, + "explicitly ignore parameter", + format!("_: {}", ident), + Applicability::MachineApplicable, + ); + } + err.note("anonymous parameters are removed in the 2018 edition (see RFC 1685)"); } |
