Skip to content

Commit 52a3735

Browse files
petrochenkovpietroalbini
authored andcommitted
[beta] Fix naming conventions for new lints
1 parent 40d4676 commit 52a3735

26 files changed

+54
-49
lines changed

src/doc/rustc/src/lints/listing/allowed-by-default.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ To fix it, do as the help message suggests:
6464

6565
```rust
6666
#![feature(dyn_trait)]
67-
#![deny(bare_trait_object)]
67+
#![deny(bare_trait_objects)]
6868

6969
trait Trait { }
7070

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4122,7 +4122,7 @@ impl<'a> LoweringContext<'a> {
41224122

41234123
fn maybe_lint_bare_trait(&self, span: Span, id: NodeId, is_global: bool) {
41244124
self.sess.buffer_lint_with_diagnostic(
4125-
builtin::BARE_TRAIT_OBJECT,
4125+
builtin::BARE_TRAIT_OBJECTS,
41264126
id,
41274127
span,
41284128
"trait objects without an explicit `dyn` are deprecated",

src/librustc/lint/builtin.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ declare_lint! {
231231
}
232232

233233
declare_lint! {
234-
pub SINGLE_USE_LIFETIME,
234+
pub SINGLE_USE_LIFETIMES,
235235
Allow,
236236
"detects single use lifetimes"
237237
}
@@ -243,19 +243,19 @@ declare_lint! {
243243
}
244244

245245
declare_lint! {
246-
pub ELIDED_LIFETIME_IN_PATH,
246+
pub ELIDED_LIFETIMES_IN_PATHS,
247247
Allow,
248248
"hidden lifetime parameters are deprecated, try `Foo<'_>`"
249249
}
250250

251251
declare_lint! {
252-
pub BARE_TRAIT_OBJECT,
252+
pub BARE_TRAIT_OBJECTS,
253253
Allow,
254254
"suggest using `dyn Trait` for trait objects"
255255
}
256256

257257
declare_lint! {
258-
pub ABSOLUTE_PATH_STARTING_WITH_MODULE,
258+
pub ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
259259
Allow,
260260
"fully qualified paths that start with a module name \
261261
instead of `crate`, `self`, or an extern crate name"
@@ -268,7 +268,7 @@ declare_lint! {
268268
}
269269

270270
declare_lint! {
271-
pub UNSTABLE_NAME_COLLISION,
271+
pub UNSTABLE_NAME_COLLISIONS,
272272
Warn,
273273
"detects name collision with an existing but unstable method"
274274
}
@@ -317,12 +317,12 @@ impl LintPass for HardwiredLints {
317317
DEPRECATED,
318318
UNUSED_UNSAFE,
319319
UNUSED_MUT,
320-
SINGLE_USE_LIFETIME,
320+
SINGLE_USE_LIFETIMES,
321321
TYVAR_BEHIND_RAW_POINTER,
322-
ELIDED_LIFETIME_IN_PATH,
323-
BARE_TRAIT_OBJECT,
324-
ABSOLUTE_PATH_STARTING_WITH_MODULE,
325-
UNSTABLE_NAME_COLLISION,
322+
ELIDED_LIFETIMES_IN_PATHS,
323+
BARE_TRAIT_OBJECTS,
324+
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
325+
UNSTABLE_NAME_COLLISIONS,
326326
)
327327
}
328328
}

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
505505
"this was previously accepted by the compiler but is being phased out; \
506506
it will become a hard error";
507507

508-
let explanation = if lint_id == LintId::of(::lint::builtin::UNSTABLE_NAME_COLLISION) {
508+
let explanation = if lint_id == LintId::of(::lint::builtin::UNSTABLE_NAME_COLLISIONS) {
509509
"once this method is added to the standard library, \
510510
the ambiguity may cause an error or change in behavior!"
511511
.to_owned()

src/librustc/middle/resolve_lifetime.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
12901290

12911291
this.tcx
12921292
.struct_span_lint_node(
1293-
lint::builtin::SINGLE_USE_LIFETIME,
1293+
lint::builtin::SINGLE_USE_LIFETIMES,
12941294
id,
12951295
span,
12961296
&format!(
@@ -1901,7 +1901,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
19011901
if deprecated {
19021902
self.tcx
19031903
.struct_span_lint_node(
1904-
lint::builtin::ELIDED_LIFETIME_IN_PATH,
1904+
lint::builtin::ELIDED_LIFETIMES_IN_PATHS,
19051905
id,
19061906
span,
19071907
&format!("hidden lifetime parameters are deprecated, try `Foo<'_>`"),

src/librustc_lint/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ impl EarlyLintPass for DeprecatedAttr {
694694
}
695695

696696
declare_lint! {
697-
pub UNUSED_DOC_COMMENT,
697+
pub UNUSED_DOC_COMMENTS,
698698
Warn,
699699
"detects doc comments that aren't used by rustdoc"
700700
}
@@ -704,7 +704,7 @@ pub struct UnusedDocComment;
704704

705705
impl LintPass for UnusedDocComment {
706706
fn get_lints(&self) -> LintArray {
707-
lint_array![UNUSED_DOC_COMMENT]
707+
lint_array![UNUSED_DOC_COMMENTS]
708708
}
709709
}
710710

@@ -713,7 +713,7 @@ impl UnusedDocComment {
713713
I: Iterator<Item=&'a ast::Attribute>,
714714
C: LintContext<'tcx>>(&self, mut attrs: I, cx: &C) {
715715
if let Some(attr) = attrs.find(|a| a.is_value_str() && a.check_name("doc")) {
716-
cx.struct_span_lint(UNUSED_DOC_COMMENT, attr.span, "doc comment not used by rustdoc")
716+
cx.struct_span_lint(UNUSED_DOC_COMMENTS, attr.span, "doc comment not used by rustdoc")
717717
.emit();
718718
}
719719
}

src/librustc_lint/lib.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern crate rustc_target;
4040
extern crate syntax_pos;
4141

4242
use rustc::lint;
43-
use rustc::lint::builtin::{BARE_TRAIT_OBJECT, ABSOLUTE_PATH_STARTING_WITH_MODULE};
43+
use rustc::lint::builtin::{BARE_TRAIT_OBJECTS, ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE};
4444
use rustc::session;
4545
use rustc::util;
4646

@@ -172,14 +172,14 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
172172
UNUSED_ATTRIBUTES,
173173
UNUSED_MACROS,
174174
UNUSED_ALLOCATION,
175-
UNUSED_DOC_COMMENT,
175+
UNUSED_DOC_COMMENTS,
176176
UNUSED_EXTERN_CRATES,
177177
UNUSED_FEATURES,
178178
UNUSED_PARENS);
179179

180180
add_lint_group!(sess,
181181
"rust_2018_migration",
182-
BARE_TRAIT_OBJECT,
182+
BARE_TRAIT_OBJECTS,
183183
UNREACHABLE_PUB);
184184

185185
// Guidelines for creating a future incompatibility lint:
@@ -273,20 +273,25 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
273273
edition: Some(Edition::Edition2018),
274274
},
275275
FutureIncompatibleInfo {
276-
id: LintId::of(UNSTABLE_NAME_COLLISION),
276+
id: LintId::of(UNSTABLE_NAME_COLLISIONS),
277277
reference: "issue #48919 <https://github.com/rust-lang/rust/issues/48919>",
278278
edition: None,
279279
// Note: this item represents future incompatibility of all unstable functions in the
280280
// standard library, and thus should never be removed or changed to an error.
281281
},
282282
FutureIncompatibleInfo {
283-
id: LintId::of(ABSOLUTE_PATH_STARTING_WITH_MODULE),
283+
id: LintId::of(ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE),
284284
reference: "issue TBD",
285285
edition: Some(Edition::Edition2018),
286286
},
287287
]);
288288

289289
// Register renamed and removed lints
290+
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
291+
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
292+
store.register_renamed("bare_trait_object", "bare_trait_objects");
293+
store.register_renamed("unstable_name_collision", "unstable_name_collisions");
294+
store.register_renamed("unused_doc_comment", "unused_doc_comments");
290295
store.register_renamed("unknown_features", "unused_features");
291296
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
292297
store.register_removed("negate_unsigned", "cast a signed value instead");

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,7 @@ impl<'a> Resolver<'a> {
33673367
let diag = lint::builtin::BuiltinLintDiagnostics
33683368
::AbsPathWithModule(path_span);
33693369
self.session.buffer_lint_with_diagnostic(
3370-
lint::builtin::ABSOLUTE_PATH_STARTING_WITH_MODULE,
3370+
lint::builtin::ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
33713371
id, path_span,
33723372
"Absolute paths must start with `self`, `super`, \
33733373
`crate`, or an external crate name in the 2018 edition",

src/librustc_typeck/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
10561056
unstable_candidates: &[(&Candidate<'tcx>, Symbol)],
10571057
) {
10581058
let mut diag = self.tcx.struct_span_lint_node(
1059-
lint::builtin::UNSTABLE_NAME_COLLISION,
1059+
lint::builtin::UNSTABLE_NAME_COLLISIONS,
10601060
self.fcx.body_id,
10611061
self.span,
10621062
"a method with this name may be added to the standard library in the future",

src/test/compile-fail/trait-bounds-not-on-struct.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-
#![allow(bare_trait_object)]
11+
#![allow(bare_trait_objects)]
1212

1313
struct Foo;
1414

src/test/compile-fail/useless_comment.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-
#![deny(unused_doc_comment)]
11+
#![deny(unused_doc_comments)]
1212

1313
fn foo() {
1414
/// a //~ ERROR doc comment not used by rustdoc

src/test/ui/edition-lint-paths.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(crate_in_paths)]
12-
#![deny(absolute_path_starting_with_module)]
12+
#![deny(absolute_paths_not_starting_with_crate)]
1313
#![allow(unused)]
1414

1515
pub mod foo {

src/test/ui/edition-lint-paths.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | use ::bar::Bar;
77
note: lint level defined here
88
--> $DIR/edition-lint-paths.rs:12:9
99
|
10-
LL | #![deny(absolute_path_starting_with_module)]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(absolute_paths_not_starting_with_crate)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
1313
= note: for more information, see issue TBD
1414

src/test/ui/in-band-lifetimes/ellided-lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010
#![allow(warnings)]
1111
#![allow(unused_variables, dead_code, unused, bad_style)]
12-
#![deny(elided_lifetime_in_path)]
12+
#![deny(elided_lifetimes_in_paths)]
1313

1414
struct Foo<'a> { x: &'a u32 }
1515
fn foo(x: &Foo) {

src/test/ui/in-band-lifetimes/ellided-lifetimes.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | fn foo(x: &Foo) {
77
note: lint level defined here
88
--> $DIR/ellided-lifetimes.rs:12:9
99
|
10-
LL | #![deny(elided_lifetime_in_path)]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(elided_lifetimes_in_paths)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

src/test/ui/in-band-lifetimes/single_use_lifetimes-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![deny(single_use_lifetime)]
10+
#![deny(single_use_lifetimes)]
1111
// FIXME(#44752) -- this scenario should not be warned
1212
fn deref<'x>() -> &'x u32 { //~ ERROR lifetime name `'x` only used once
1313
22

src/test/ui/in-band-lifetimes/single_use_lifetimes-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | fn deref<'x>() -> &'x u32 { //~ ERROR lifetime name `'x` only used once
77
note: lint level defined here
88
--> $DIR/single_use_lifetimes-2.rs:10:9
99
|
10-
LL | #![deny(single_use_lifetime)]
11-
| ^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(single_use_lifetimes)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

src/test/ui/in-band-lifetimes/single_use_lifetimes-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![deny(single_use_lifetime)]
10+
#![deny(single_use_lifetimes)]
1111
struct Foo<'x> { //~ ERROR lifetime name `'x` only used once
1212
x: &'x u32 // no warning!
1313
}

src/test/ui/in-band-lifetimes/single_use_lifetimes-3.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | struct Foo<'x> { //~ ERROR lifetime name `'x` only used once
77
note: lint level defined here
88
--> $DIR/single_use_lifetimes-3.rs:10:9
99
|
10-
LL | #![deny(single_use_lifetime)]
11-
| ^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(single_use_lifetimes)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: lifetime name `'y` only used once
1414
--> $DIR/single_use_lifetimes-3.rs:16:6

src/test/ui/in-band-lifetimes/single_use_lifetimes-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![deny(single_use_lifetime)]
10+
#![deny(single_use_lifetimes)]
1111
// Neither should issue a warning, as explicit lifetimes are mandatory in this case
1212
struct Foo<'x> { //~ ERROR lifetime name `'x` only used once
1313
x: &'x u32

src/test/ui/in-band-lifetimes/single_use_lifetimes-4.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | struct Foo<'x> { //~ ERROR lifetime name `'x` only used once
77
note: lint level defined here
88
--> $DIR/single_use_lifetimes-4.rs:10:9
99
|
10-
LL | #![deny(single_use_lifetime)]
11-
| ^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(single_use_lifetimes)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: lifetime name `'x` only used once
1414
--> $DIR/single_use_lifetimes-4.rs:16:10

src/test/ui/in-band-lifetimes/single_use_lifetimes-5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![deny(single_use_lifetime)]
10+
#![deny(single_use_lifetimes)]
1111
// Should not issue a warning, as explicit lifetimes are mandatory in this case:
1212
trait Foo<'x> { //~ ERROR lifetime name `'x` only used once
1313
fn foo(&self, arg: &'x u32);

src/test/ui/in-band-lifetimes/single_use_lifetimes-5.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | trait Foo<'x> { //~ ERROR lifetime name `'x` only used once
77
note: lint level defined here
88
--> $DIR/single_use_lifetimes-5.rs:10:9
99
|
10-
LL | #![deny(single_use_lifetime)]
11-
| ^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(single_use_lifetimes)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

src/test/ui/in-band-lifetimes/single_use_lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![deny(single_use_lifetime)]
10+
#![deny(single_use_lifetimes)]
1111

1212
fn deref<'x>(v: &'x u32) -> u32 { //~ ERROR lifetime name `'x` only used once
1313
*v

src/test/ui/in-band-lifetimes/single_use_lifetimes.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | fn deref<'x>(v: &'x u32) -> u32 { //~ ERROR lifetime name `'x` only used on
77
note: lint level defined here
88
--> $DIR/single_use_lifetimes.rs:10:9
99
|
10-
LL | #![deny(single_use_lifetime)]
11-
| ^^^^^^^^^^^^^^^^^^^
10+
LL | #![deny(single_use_lifetimes)]
11+
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

src/test/ui/inference_unstable.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: a method with this name may be added to the standard library in the fut
44
LL | assert_eq!('x'.ipu_flatten(), 1);
55
| ^^^^^^^^^^^
66
|
7-
= note: #[warn(unstable_name_collision)] on by default
7+
= note: #[warn(unstable_name_collisions)] on by default
88
= warning: once this method is added to the standard library, the ambiguity may cause an error or change in behavior!
99
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
1010
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method

0 commit comments

Comments
 (0)