Skip to content

Commit

Permalink
Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth
Browse files Browse the repository at this point in the history
Fixes #47311.
r? @nrc
  • Loading branch information
Manishearth committed Oct 10, 2018
2 parents 8ebc6d6 + ffe1527 commit 50e410c
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 117 deletions.
35 changes: 0 additions & 35 deletions src/doc/unstable-book/src/language-features/tool-lints.md

This file was deleted.

27 changes: 3 additions & 24 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ use lint::context::CheckLintNameResult;
use lint::{self, Lint, LintId, Level, LintSource};
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
StableHasher, StableHasherResult};
use session::{config::nightly_options, Session};
use session::Session;
use syntax::ast;
use syntax::attr;
use syntax::source_map::MultiSpan;
use syntax::feature_gate;
use syntax::symbol::Symbol;
use util::nodemap::FxHashMap;

Expand Down Expand Up @@ -228,28 +227,14 @@ impl<'a> LintLevelsBuilder<'a> {
}
};
let tool_name = if let Some(lint_tool) = word.is_scoped() {
let gate_feature = !self.sess.features_untracked().tool_lints;
let known_tool = attr::is_known_lint_tool(lint_tool);
if gate_feature {
feature_gate::emit_feature_err(
&sess.parse_sess,
"tool_lints",
word.span,
feature_gate::GateIssue::Language,
&format!("scoped lint `{}` is experimental", word.ident),
);
}
if !known_tool {
if !attr::is_known_lint_tool(lint_tool) {
span_err!(
sess,
lint_tool.span,
E0710,
"an unknown tool name found in scoped lint: `{}`",
word.ident
);
}

if gate_feature || !known_tool {
continue;
}

Expand Down Expand Up @@ -299,13 +284,7 @@ impl<'a> LintLevelsBuilder<'a> {
"change it to",
new_lint_name.to_string(),
Applicability::MachineApplicable,
);

if nightly_options::is_nightly_build() {
err.emit();
} else {
err.cancel();
}
).emit();

let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
for id in ids {
Expand Down
5 changes: 2 additions & 3 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,6 @@ declare_features! (
// #[doc(alias = "...")]
(active, doc_alias, "1.27.0", Some(50146), None),

// Scoped lints
(active, tool_lints, "1.28.0", Some(44690), None),

// Allows irrefutable patterns in if-let and while-let statements (RFC 2086)
(active, irrefutable_let_patterns, "1.27.0", Some(44495), None),

Expand Down Expand Up @@ -682,6 +679,8 @@ declare_features! (
(accepted, pattern_parentheses, "1.31.0", Some(51087), None),
// Allows the definition of `const fn` functions.
(accepted, min_const_fn, "1.31.0", Some(53555), None),
// Scoped lints
(accepted, tool_lints, "1.31.0", Some(44690), None),
);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/tool_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(tool_lints)]

#![deny(unknown_lints)]

#[allow(clippy::almost_swapped)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/tool_lints_2018_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(tool_lints)]

#![feature(rust_2018_preview)]
#![deny(unknown_lints)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint_tool_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// aux-build:lint_tool_test.rs
// ignore-stage1
// compile-flags: --cfg foo

#![feature(plugin)]
#![feature(tool_lints)]
#![plugin(lint_tool_test)]
#![allow(dead_code)]
#![cfg_attr(foo, warn(test_lint))]
Expand Down
12 changes: 0 additions & 12 deletions src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/ui/feature-gates/feature-gate-tool_lints.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-tool_lints.stderr

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/ui/tool_lints-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// Don't allow tool_lints, which aren't scoped

#![feature(tool_lints)]

#![deny(unknown_lints)]

#![deny(clippy)] //~ ERROR: unknown lint: `clippy`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/tool_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(tool_lints)]


#[warn(foo::bar)]
//~^ ERROR an unknown tool name found in scoped lint: `foo::bar`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unknown-lint-tool-name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(tool_lints)]


#![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`

Expand Down

0 comments on commit 50e410c

Please sign in to comment.