Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E0602 #42361

Merged
merged 1 commit into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,19 @@ If you don't know the basics of Rust, you can go look to the Rust Book to get
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.
"##,

}


Expand Down
6 changes: 3 additions & 3 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ pub trait LintContext<'tcx>: Sized {
continue;
}
}
},
Err(FindLintError::Removed) => { continue; }
}
Err(FindLintError::Removed) => continue,
}
}
};
Expand Down Expand Up @@ -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))
}
};

Expand Down
16 changes: 16 additions & 0 deletions src/test/compile-fail/E0602.rs
Original file line number Diff line number Diff line change
@@ -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() {}