mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Duplicate lint specifications are always bug!
Replace early_error and sess.err with bug!, in all cases. If the compiler we're running with, including plugins, is registering something twice, that's a (compiler/plugin) programmer error -- we should not try to be nice at the cost of developer ergononomics (hiding the stacktrace of the second registration is bad). This also is basically a static bug in ~all cases so it should not be a detriment to users, including with plugins.
This commit is contained in:
parent
fa0f7d0080
commit
47a443c50d
@ -218,16 +218,7 @@ impl LintStore {
|
||||
|
||||
let id = LintId::of(lint);
|
||||
if self.by_name.insert(lint.name_lower(), Id(id)).is_some() {
|
||||
let msg = format!("duplicate specification of lint {}", lint.name_lower());
|
||||
match (sess, from_plugin) {
|
||||
// We load builtin lints first, so a duplicate is a compiler bug.
|
||||
// Use early_error when handling -W help with no crate.
|
||||
(None, _) => early_error(config::ErrorOutputType::default(), &msg[..]),
|
||||
(Some(_), false) => bug!("{}", msg),
|
||||
|
||||
// A duplicate name from a plugin is a user error.
|
||||
(Some(sess), true) => sess.err(&msg[..]),
|
||||
}
|
||||
bug!("duplicate specification of lint {}", lint.name_lower())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -300,16 +291,7 @@ impl LintStore {
|
||||
}
|
||||
|
||||
if !new {
|
||||
let msg = format!("duplicate specification of lint group {}", name);
|
||||
match (sess, from_plugin) {
|
||||
// We load builtin lints first, so a duplicate is a compiler bug.
|
||||
// Use early_error when handling -W help with no crate.
|
||||
(None, _) => early_error(config::ErrorOutputType::default(), &msg[..]),
|
||||
(Some(_), false) => bug!("{}", msg),
|
||||
|
||||
// A duplicate name from a plugin is a user error.
|
||||
(Some(sess), true) => sess.err(&msg[..]),
|
||||
}
|
||||
bug!("duplicate specification of lint group {}", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user