Switch the primary diagnostic to unknown_lints

This also affects the `non_exhaustive_omitted_patterns` and
`must_not_suspend` lints as they are not stable. This also changes the
diagnostic level to pull from `unknown_lints` instead of always being
allow or deny.
This commit is contained in:
David Koloski 2022-02-28 20:29:06 +00:00
parent 8852752078
commit 2677eca237
21 changed files with 310 additions and 142 deletions

View File

@ -17,7 +17,7 @@ use rustc_session::lint::{
builtin::{self, FORBIDDEN_LINT_GROUPS},
Level, Lint, LintExpectationId, LintId,
};
use rustc_session::parse::feature_err;
use rustc_session::parse::{add_feature_diagnostics, feature_err};
use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{source_map::MultiSpan, Span, DUMMY_SP};
@ -104,10 +104,8 @@ impl<'s> LintLevelsBuilder<'s> {
fn process_command_line(&mut self, sess: &Session, store: &LintStore) {
self.sets.lint_cap = sess.opts.lint_cap.unwrap_or(Level::Forbid);
self.cur = self.sets.list.push(LintSet {
specs: FxHashMap::default(),
parent: COMMAND_LINE,
});
self.cur =
self.sets.list.push(LintSet { specs: FxHashMap::default(), parent: COMMAND_LINE });
for &(ref lint_name, level) in &sess.opts.lint_opts {
store.check_lint_name_cmdline(sess, &lint_name, level, self.registered_tools);
let orig_level = level;
@ -134,11 +132,7 @@ impl<'s> LintLevelsBuilder<'s> {
/// Attempts to insert the `id` to `level_src` map entry. If unsuccessful
/// (e.g. if a forbid was already inserted on the same scope), then emits a
/// diagnostic with no change to `specs`.
fn insert_spec(
&mut self,
id: LintId,
(level, src): LevelAndSource,
) {
fn insert_spec(&mut self, id: LintId, (level, src): LevelAndSource) {
let (old_level, old_src) =
self.sets.get_lint_level(id.lint, self.cur, Some(self.current_specs()), &self.sess);
// Setting to a non-forbid level is an error if the lint previously had
@ -163,7 +157,10 @@ impl<'s> LintLevelsBuilder<'s> {
};
debug!(
"fcw_warning={:?}, specs.get(&id) = {:?}, old_src={:?}, id_name={:?}",
fcw_warning, self.current_specs(), old_src, id_name
fcw_warning,
self.current_specs(),
old_src,
id_name
);
let decorate_diag = |diag: &mut Diagnostic| {
@ -249,10 +246,8 @@ impl<'s> LintLevelsBuilder<'s> {
source_hir_id: Option<HirId>,
) -> BuilderPush {
let prev = self.cur;
self.cur = self.sets.list.push(LintSet {
specs: FxHashMap::default(),
parent: prev,
});
self.cur = self.sets.list.push(LintSet { specs: FxHashMap::default(), parent: prev });
let sess = self.sess;
let bad_attr = |span| struct_span_err!(sess, span, E0452, "malformed lint attribute input");
for (attr_index, attr) in attrs.iter().enumerate() {
@ -391,8 +386,12 @@ impl<'s> LintLevelsBuilder<'s> {
}
Err((Some(ids), ref new_lint_name)) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (lvl, src) =
self.sets.get_lint_level(lint, self.cur, Some(self.current_specs()), &sess);
let (lvl, src) = self.sets.get_lint_level(
lint,
self.cur,
Some(self.current_specs()),
&sess,
);
struct_lint_level(
self.sess,
lint,
@ -462,8 +461,12 @@ impl<'s> LintLevelsBuilder<'s> {
CheckLintNameResult::Warning(msg, renamed) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (renamed_lint_level, src) =
self.sets.get_lint_level(lint, self.cur, Some(self.current_specs()), &sess);
let (renamed_lint_level, src) = self.sets.get_lint_level(
lint,
self.cur,
Some(self.current_specs()),
&sess,
);
struct_lint_level(
self.sess,
lint,
@ -486,8 +489,12 @@ impl<'s> LintLevelsBuilder<'s> {
}
CheckLintNameResult::NoLint(suggestion) => {
let lint = builtin::UNKNOWN_LINTS;
let (level, src) =
self.sets.get_lint_level(lint, self.cur, Some(self.current_specs()), self.sess);
let (level, src) = self.sets.get_lint_level(
lint,
self.cur,
Some(self.current_specs()),
self.sess,
);
struct_lint_level(self.sess, lint, level, src, Some(sp.into()), |lint| {
let name = if let Some(tool_ident) = tool_ident {
format!("{}::{}", tool_ident.name, name)
@ -594,16 +601,14 @@ impl<'s> LintLevelsBuilder<'s> {
fn check_gated_lint(&self, lint_id: LintId, span: Span) -> bool {
if let Some(feature) = lint_id.lint.feature_gate {
if !self.sess.features_untracked().enabled(feature) {
let (unknown_lints_level, _) = self.lint_level(builtin::UNKNOWN_LINTS);
if unknown_lints_level != Level::Allow {
feature_err(
&self.sess.parse_sess,
feature,
span,
&format!("the `{}` lint is unstable", lint_id.lint.name_lower()),
)
.emit();
}
let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
struct_lint_level(self.sess, lint_id.lint, level, src, Some(span.into()), |lint| {
let mut db =
lint.build(&format!("unknown lint: `{}`", lint_id.lint.name_lower()));
db.note(&format!("the `{}` lint is unstable", lint_id.lint.name_lower(),));
add_feature_diagnostics(&mut db, &self.sess.parse_sess, feature);
db.emit();
});
return false;
}
}

View File

@ -3775,6 +3775,7 @@ declare_lint! {
declare_lint! {
#[doc(hidden)]
/// Added for testing unsable lints; perma-unstable.
pub TEST_UNSTABLE_LINT,
Deny,
"this unstable lint is only for testing",

View File

@ -98,7 +98,26 @@ pub fn feature_err_issue<'a>(
explain: &str,
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut err = sess.span_diagnostic.struct_span_err_with_code(span, explain, error_code!(E0658));
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue);
err
}
/// Adds the diagnostics for a feature to an existing error.
pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, feature: Symbol) {
add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language);
}
/// Adds the diagnostics for a feature to an existing error.
///
/// This variant allows you to control whether it is a library or language feature.
/// Almost always, you want to use this for a language feature. If so, prefer
/// `add_feature_diagnostics`.
pub fn add_feature_diagnostics_for_issue<'a>(
err: &mut Diagnostic,
sess: &'a ParseSess,
feature: Symbol,
issue: GateIssue,
) {
if let Some(n) = find_feature_issue(feature, issue) {
err.note(&format!(
"see issue #{} <https://github.com/rust-lang/rust/issues/{}> for more information",
@ -110,8 +129,6 @@ pub fn feature_err_issue<'a>(
if sess.unstable_features.is_nightly_build() {
err.help(&format!("add `#![feature({})]` to the crate attributes to enable", feature));
}
err
}
/// Info about a parsing session.

View File

@ -1,9 +1,11 @@
// check-fail
#![deny(non_exhaustive_omitted_patterns)]
//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
#![allow(non_exhaustive_omitted_patterns)]
//~^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
fn main() {
enum Foo {
@ -11,14 +13,15 @@ fn main() {
}
#[allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
Foo::A => {}
Foo::B => {}
}
//~^^^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~^^^^ ERROR non-exhaustive patterns: `C` not covered
match Foo::A {
Foo::A => {}
@ -26,6 +29,6 @@ fn main() {
#[warn(non_exhaustive_omitted_patterns)]
_ => {}
}
//~^^^ ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~| ERROR the `non_exhaustive_omitted_patterns` lint is unstable
//~^^^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
}

View File

@ -1,93 +1,119 @@
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
|
LL | #![deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(non_exhaustive_omitted_patterns)]` on by default
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:1:1
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
|
LL | #![deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:4:1
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:5
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error[E0658]: the `non_exhaustive_omitted_patterns` lint is unstable
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:26:9
warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
error: aborting due to 10 previous errors
error[E0004]: non-exhaustive patterns: `C` not covered
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11
|
LL | / enum Foo {
LL | | A, B, C,
| | - not covered
LL | | }
| |_____- `Foo` defined here
...
LL | match Foo::A {
| ^^^^^^ pattern `C` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `Foo`
For more information about this error, try `rustc --explain E0658`.
error: aborting due to previous error; 10 warnings emitted
For more information about this error, try `rustc --explain E0004`.

View File

@ -0,0 +1,9 @@
// check-pass
// `test_unstable_lint` is for testing and should never be stabilized.
#![allow(test_unstable_lint)]
//~^ WARNING unknown lint: `test_unstable_lint`
//~| WARNING unknown lint: `test_unstable_lint`
//~| WARNING unknown lint: `test_unstable_lint`
fn main() {}

View File

@ -0,0 +1,30 @@
warning: unknown lint: `test_unstable_lint`
--> $DIR/feature-gate-test_unstable_lint.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(test_unstable_lint)]` on by default
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
--> $DIR/feature-gate-test_unstable_lint.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
--> $DIR/feature-gate-test_unstable_lint.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: 3 warnings emitted

View File

@ -1,12 +1,15 @@
// check-pass
// edition:2018
#![deny(must_not_suspend)] //~ ERROR the `must_not_suspend`
//~| ERROR the `must_not_suspend`
//~| ERROR the `must_not_suspend`
#![deny(must_not_suspend)]
//~^ WARNING unknown lint: `must_not_suspend`
//~| WARNING unknown lint: `must_not_suspend`
//~| WARNING unknown lint: `must_not_suspend`
async fn other() {}
pub async fn uhoh(m: std::sync::Mutex<()>) {
let _guard = m.lock().unwrap(); //~ ERROR `MutexGuard` held across
let _guard = m.lock().unwrap();
other().await;
}

View File

@ -1,54 +1,33 @@
error[E0658]: the `must_not_suspend` lint is unstable
--> $DIR/gated.rs:2:1
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(must_not_suspend)]` on by default
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
error[E0658]: the `must_not_suspend` lint is unstable
--> $DIR/gated.rs:2:1
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
error[E0658]: the `must_not_suspend` lint is unstable
--> $DIR/gated.rs:2:1
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
error: `MutexGuard` held across a suspend point, but should not be
--> $DIR/gated.rs:9:9
|
LL | let _guard = m.lock().unwrap();
| ^^^^^^
LL | other().await;
| ------ the value is held across this suspend point
|
note: the lint level is defined here
--> $DIR/gated.rs:2:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
note: holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Futures to not implement `Send`
--> $DIR/gated.rs:9:9
|
LL | let _guard = m.lock().unwrap();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/gated.rs:9:9
|
LL | let _guard = m.lock().unwrap();
| ^^^^^^
warning: 3 warnings emitted
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -0,0 +1,6 @@
// check-fail
// compile-flags: -Dunknown_lints -Atest_unstable_lint
// error-pattern: unknown lint: `test_unstable_lint`
// error-pattern: the `test_unstable_lint` lint is unstable
fn main() {}

View File

@ -0,0 +1,18 @@
error: unknown lint: `test_unstable_lint`
|
= note: `-D test-unstable-lint` implied by `-D unknown-lints`
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: aborting due to 3 previous errors

View File

@ -0,0 +1,9 @@
// check-fail
#![deny(unknown_lints)]
#![allow(test_unstable_lint)]
//~^ ERROR unknown lint: `test_unstable_lint`
//~| ERROR unknown lint: `test_unstable_lint`
//~| ERROR unknown lint: `test_unstable_lint`
fn main() {}

View File

@ -0,0 +1,35 @@
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/deny-unstable-lint-inline.rs:3:9
|
LL | #![deny(unknown_lints)]
| ^^^^^^^^^^^^^
= note: `#[deny(test_unstable_lint)]` implied by `#[deny(unknown_lints)]`
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: aborting due to 3 previous errors

View File

@ -1,5 +0,0 @@
// check-fail
// compile-flags: -Atest_unstable_lint
// error-pattern: the `test_unstable_lint` lint is unstable
fn main() {}

View File

@ -1,11 +0,0 @@
error[E0658]: the `test_unstable_lint` lint is unstable
|
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error[E0658]: the `test_unstable_lint` lint is unstable
|
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,6 +0,0 @@
// check-fail
// error-pattern: the `test_unstable_lint` lint is unstable
#![allow(test_unstable_lint)]
fn main() {}

View File

@ -1,19 +0,0 @@
error[E0658]: the `test_unstable_lint` lint is unstable
--> $DIR/unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error[E0658]: the `test_unstable_lint` lint is unstable
--> $DIR/unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -0,0 +1,6 @@
// check-pass
// compile-flags: -Wunknown_lints -Atest_unstable_lint
// error-pattern: unknown lint: `test_unstable_lint`
// error-pattern: the `test_unstable_lint` lint is unstable
fn main() {}

View File

@ -0,0 +1,18 @@
warning: unknown lint: `test_unstable_lint`
|
= note: `-W test-unstable-lint` implied by `-W unknown-lints`
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: 3 warnings emitted

View File

@ -0,0 +1,9 @@
// check-pass
#![warn(unknown_lints)]
#![allow(test_unstable_lint)]
//~^ WARNING unknown lint: `test_unstable_lint`
//~| WARNING unknown lint: `test_unstable_lint`
//~| WARNING unknown lint: `test_unstable_lint`
fn main() {}

View File

@ -0,0 +1,35 @@
warning: unknown lint: `test_unstable_lint`
--> $DIR/warn-unknown-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/warn-unknown-unstable-lint-inline.rs:3:9
|
LL | #![warn(unknown_lints)]
| ^^^^^^^^^^^^^
= note: `#[warn(test_unstable_lint)]` implied by `#[warn(unknown_lints)]`
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
--> $DIR/warn-unknown-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: unknown lint: `test_unstable_lint`
--> $DIR/warn-unknown-unstable-lint-inline.rs:4:1
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
warning: 3 warnings emitted