mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Error when warnings lint group is used with force-warn
This commit is contained in:
parent
0d2fd70dab
commit
d70056e30c
@ -1,4 +1,4 @@
|
||||
An unknown lint was used on the command line.
|
||||
An unknown or invalid lint was used on the command line.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
|
@ -332,7 +332,16 @@ impl LintStore {
|
||||
crate_attrs: &[ast::Attribute],
|
||||
) {
|
||||
let (tool_name, lint_name_only) = parse_lint_and_tool_name(lint_name);
|
||||
|
||||
if lint_name_only == crate::WARNINGS.name_lower() && level == Level::ForceWarn {
|
||||
return struct_span_err!(
|
||||
sess,
|
||||
DUMMY_SP,
|
||||
E0602,
|
||||
"`{}` lint group is not supported with ´--force-warn´",
|
||||
crate::WARNINGS.name_lower()
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
let db = match self.check_lint_name(sess, lint_name_only, tool_name, crate_attrs) {
|
||||
CheckLintNameResult::Ok(_) => None,
|
||||
CheckLintNameResult::Warning(ref msg, _) => Some(sess.struct_warn(msg)),
|
||||
|
5
src/test/ui/lint/force-warn/warnings-lint-group.rs
Normal file
5
src/test/ui/lint/force-warn/warnings-lint-group.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// --force-warn warnings is an error
|
||||
// compile-flags: --force-warn warnings -Zunstable-options
|
||||
// error-pattern: `warnings` lint group is not supported
|
||||
|
||||
fn main() {}
|
9
src/test/ui/lint/force-warn/warnings-lint-group.stderr
Normal file
9
src/test/ui/lint/force-warn/warnings-lint-group.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
|
||||
|
||||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
|
||||
|
||||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0602`.
|
Loading…
Reference in New Issue
Block a user