use {ast, attr};
use codemap::{self, CodeMap, Spanned, respan};
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, edition::Edition};
-use errors::{self, Applicability, DiagnosticBuilder};
+use errors::{self, Applicability, DiagnosticBuilder, DiagnosticId};
use parse::{self, SeqSep, classify, token};
use parse::lexer::TokenAndSpan;
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
match pat_arg {
Ok((pat, ty)) => {
- let mut err = self.diagnostic()
- .struct_span_err(pat.span, "patterns aren't allowed in trait methods");
+ let mut err = self.diagnostic().struct_span_err_with_code(
+ pat.span,
+ "patterns aren't allowed in trait methods",
+ DiagnosticId::Error("E0642".into()),
+ );
err.span_suggestion_short_with_applicability(
pat.span,
"give this argument a name or use an underscore to ignore it",
-error: patterns aren't allowed in trait methods
+error[E0642]: patterns aren't allowed in trait methods
--> $DIR/E0642.rs:12:12
|
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
| ^
-error: patterns aren't allowed in trait methods
+error[E0642]: patterns aren't allowed in trait methods
--> $DIR/E0642.rs:16:12
|
LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0642`.