Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6641c2d

Browse files
authoredOct 10, 2018
Rollup merge of rust-lang#54870 - flip1995:stabilize_tool_lints, r=Manishearth
Stabilize tool lints cc rust-lang#44690 This stabilizes the `tool_lints` feature. This is my first stabilization PR, let me know if I missed something. I followed the guide on https://forge.rust-lang.org. Should the documentation of the `tool_lints` be moved to `rust-lang-nursery/reference`? r? @Manishearth @nrc
2 parents 1e7d0dd + ffe1527 commit 6641c2d

13 files changed

+11
-117
lines changed
 

‎src/doc/unstable-book/src/language-features/tool-lints.md

-35
This file was deleted.

‎src/librustc/lint/levels.rs

+3-24
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ use lint::context::CheckLintNameResult;
1818
use lint::{self, Lint, LintId, Level, LintSource};
1919
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
2020
StableHasher, StableHasherResult};
21-
use session::{config::nightly_options, Session};
21+
use session::Session;
2222
use syntax::ast;
2323
use syntax::attr;
2424
use syntax::source_map::MultiSpan;
25-
use syntax::feature_gate;
2625
use syntax::symbol::Symbol;
2726
use util::nodemap::FxHashMap;
2827

@@ -228,28 +227,14 @@ impl<'a> LintLevelsBuilder<'a> {
228227
}
229228
};
230229
let tool_name = if let Some(lint_tool) = word.is_scoped() {
231-
let gate_feature = !self.sess.features_untracked().tool_lints;
232-
let known_tool = attr::is_known_lint_tool(lint_tool);
233-
if gate_feature {
234-
feature_gate::emit_feature_err(
235-
&sess.parse_sess,
236-
"tool_lints",
237-
word.span,
238-
feature_gate::GateIssue::Language,
239-
&format!("scoped lint `{}` is experimental", word.ident),
240-
);
241-
}
242-
if !known_tool {
230+
if !attr::is_known_lint_tool(lint_tool) {
243231
span_err!(
244232
sess,
245233
lint_tool.span,
246234
E0710,
247235
"an unknown tool name found in scoped lint: `{}`",
248236
word.ident
249237
);
250-
}
251-
252-
if gate_feature || !known_tool {
253238
continue;
254239
}
255240

@@ -299,13 +284,7 @@ impl<'a> LintLevelsBuilder<'a> {
299284
"change it to",
300285
new_lint_name.to_string(),
301286
Applicability::MachineApplicable,
302-
);
303-
304-
if nightly_options::is_nightly_build() {
305-
err.emit();
306-
} else {
307-
err.cancel();
308-
}
287+
).emit();
309288

310289
let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
311290
for id in ids {

‎src/libsyntax/feature_gate.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,6 @@ declare_features! (
433433
// #[doc(alias = "...")]
434434
(active, doc_alias, "1.27.0", Some(50146), None),
435435

436-
// Scoped lints
437-
(active, tool_lints, "1.28.0", Some(44690), None),
438-
439436
// Allows irrefutable patterns in if-let and while-let statements (RFC 2086)
440437
(active, irrefutable_let_patterns, "1.27.0", Some(44495), None),
441438

@@ -679,6 +676,8 @@ declare_features! (
679676
(accepted, pattern_parentheses, "1.31.0", Some(51087), None),
680677
// Allows the definition of `const fn` functions.
681678
(accepted, min_const_fn, "1.31.0", Some(53555), None),
679+
// Scoped lints
680+
(accepted, tool_lints, "1.31.0", Some(44690), None),
682681
);
683682

684683
// If you change this, please modify src/doc/unstable-book as well. You must

‎src/test/run-pass/tool_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(tool_lints)]
11+
1212
#![deny(unknown_lints)]
1313

1414
#[allow(clippy::almost_swapped)]

‎src/test/run-pass/tool_lints_2018_preview.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(tool_lints)]
11+
1212
#![feature(rust_2018_preview)]
1313
#![deny(unknown_lints)]
1414

‎src/test/ui-fulldeps/lint_tool_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// aux-build:lint_tool_test.rs
1212
// ignore-stage1
1313
// compile-flags: --cfg foo
14+
1415
#![feature(plugin)]
15-
#![feature(tool_lints)]
1616
#![plugin(lint_tool_test)]
1717
#![allow(dead_code)]
1818
#![cfg_attr(foo, warn(test_lint))]

‎src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs

-12
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr

-11
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-tool_lints.rs

-15
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-tool_lints.stderr

-11
This file was deleted.

‎src/test/ui/tool_lints-fail.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

13-
#![feature(tool_lints)]
13+
1414
#![deny(unknown_lints)]
1515

1616
#![deny(clippy)] //~ ERROR: unknown lint: `clippy`

‎src/test/ui/tool_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(tool_lints)]
11+
1212

1313
#[warn(foo::bar)]
1414
//~^ ERROR an unknown tool name found in scoped lint: `foo::bar`

‎src/test/ui/unknown-lint-tool-name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(tool_lints)]
11+
1212

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

0 commit comments

Comments
 (0)
Please sign in to comment.