]> git.lizzy.rs Git - rust.git/commitdiff
Add E0602
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Thu, 1 Jun 2017 21:25:13 +0000 (23:25 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 2 Jun 2017 18:09:35 +0000 (20:09 +0200)
src/librustc/diagnostics.rs
src/librustc/lint/context.rs
src/test/compile-fail/E0602.rs [new file with mode: 0644]

index 2beb40d6b2f1ab34598a52849779be57a9ca4f72..800e678405aa9e953187bd504507356e76fe29ad 100644 (file)
@@ -1900,6 +1900,19 @@ fn main() {
 started: https://doc.rust-lang.org/book/
 "##,
 
+E0602: r##"
+An unknown lint was used on the command line.
+
+Erroneous example:
+
+```ignore
+rustc -D bogus omse_file.rs
+```
+
+Maybe you just misspelled the lint name or the lint doesn't exist anymore.
+Either way, try to update/remove it in order to fix the error.
+"##,
+
 }
 
 
index 4c25a455f292d4a9d62033e833c0957b48c19246..2022565d533bcc8fb3205de6589d89896a3d7638 100644 (file)
@@ -746,8 +746,8 @@ fn with_lint_attrs<F>(&mut self,
                                     continue;
                                 }
                             }
-                        },
-                        Err(FindLintError::Removed) => { continue; }
+                        }
+                        Err(FindLintError::Removed) => continue,
                     }
                 }
             };
@@ -1298,7 +1298,7 @@ fn check_lint_name_cmdline(sess: &Session, lint_cx: &LintStore,
             Some(sess.struct_warn(msg))
         },
         CheckLintNameResult::NoLint => {
-            Some(sess.struct_err(&format!("unknown lint: `{}`", lint_name)))
+            Some(struct_err!(sess, E0602, "unknown lint: `{}`", lint_name))
         }
     };
 
diff --git a/src/test/compile-fail/E0602.rs b/src/test/compile-fail/E0602.rs
new file mode 100644 (file)
index 0000000..cc3e436
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-D bogus
+
+// error-pattern:E0602
+// error-pattern:requested on the command line with `-D bogus`
+
+fn main() {}