Skip to content

Commit 068f4e0

Browse files
petrochenkovpietroalbini
authored andcommitted
[beta] Fix naming conventions for new lints
1 parent 24815d3 commit 068f4e0

26 files changed

+54
-49
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 10 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 10 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)