Skip to content

Commit 7cc1ab4

Browse files
Add E0602
1 parent 4ed2eda commit 7cc1ab4

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

src/librustc/diagnostics.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,19 @@ If you don't know the basics of Rust, you can go look to the Rust Book to get
19001900
started: https://doc.rust-lang.org/book/
19011901
"##,
19021902

1903+
E0602: r##"
1904+
An unknown lint was used on the command line.
1905+
1906+
Erroneous example:
1907+
1908+
```ignore
1909+
rustc -D bogus omse_file.rs
1910+
```
1911+
1912+
Maybe you just misspelled the lint name or the lint doesn't exist anymore.
1913+
Either way, try to update/remove it in order to fix the error.
1914+
"##,
1915+
19031916
}
19041917

19051918

src/librustc/lint/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ pub trait LintContext<'tcx>: Sized {
746746
continue;
747747
}
748748
}
749-
},
750-
Err(FindLintError::Removed) => { continue; }
749+
}
750+
Err(FindLintError::Removed) => continue,
751751
}
752752
}
753753
};
@@ -1298,7 +1298,7 @@ fn check_lint_name_cmdline(sess: &Session, lint_cx: &LintStore,
12981298
Some(sess.struct_warn(msg))
12991299
},
13001300
CheckLintNameResult::NoLint => {
1301-
Some(sess.struct_err(&format!("unknown lint: `{}`", lint_name)))
1301+
Some(struct_err!(sess, E0602, "unknown lint: `{}`", lint_name))
13021302
}
13031303
};
13041304

src/test/compile-fail/E0602.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:-D bogus
12+
13+
// error-pattern:E0602
14+
// error-pattern:requested on the command line with `-D bogus`
15+
16+
fn main() {}

0 commit comments

Comments
 (0)