Skip to content

Commit ffa80f0

Browse files
committed
Auto merge of #74926 - Manishearth:rename-lint, r=jyn514
Rename intra_doc_link_resolution_failure It should be plural to follow the conventions in https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
2 parents c058a8b + c17eb56 commit ffa80f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+89
-98
lines changed

library/alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
#![warn(deprecated_in_future)]
7070
#![warn(missing_docs)]
7171
#![warn(missing_debug_implementations)]
72-
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
7372
#![allow(explicit_outlives_requirements)]
7473
#![allow(incomplete_features)]
7574
#![deny(unsafe_op_in_unsafe_fn)]

library/core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#![warn(deprecated_in_future)]
6262
#![warn(missing_docs)]
6363
#![warn(missing_debug_implementations)]
64-
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
6564
#![allow(explicit_outlives_requirements)]
6665
#![allow(incomplete_features)]
6766
#![feature(allow_internal_unstable)]
@@ -151,7 +150,6 @@
151150
#![feature(slice_ptr_get)]
152151
#![feature(no_niche)] // rust-lang/rust#68303
153152
#![feature(unsafe_block_in_unsafe_fn)]
154-
#![deny(intra_doc_link_resolution_failure)]
155153
#![deny(unsafe_op_in_unsafe_fn)]
156154

157155
#[prelude_import]

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@
212212
#![warn(deprecated_in_future)]
213213
#![warn(missing_docs)]
214214
#![warn(missing_debug_implementations)]
215-
#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
216215
#![allow(explicit_outlives_requirements)]
217216
#![allow(unused_lifetimes)]
218217
// Tell the compiler to link to either panic_abort or panic_unwind

src/doc/rustdoc/src/lints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ can use them like any other lints by doing this:
1111

1212
Here is the list of the lints provided by `rustdoc`:
1313

14-
## intra_doc_link_resolution_failure
14+
## broken_intra_doc_links
1515

1616
This lint **warns by default** and is **nightly-only**. This lint detects when
1717
an intra-doc link fails to get resolved. For example:

src/librustc_lint/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ use rustc_hir::def_id::LocalDefId;
6161
use rustc_middle::ty::query::Providers;
6262
use rustc_middle::ty::TyCtxt;
6363
use rustc_session::lint::builtin::{
64-
BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS,
65-
INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES,
64+
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
65+
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES,
6666
PRIVATE_DOC_TESTS,
6767
};
6868
use rustc_span::symbol::{Ident, Symbol};
@@ -303,7 +303,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
303303

304304
add_lint_group!(
305305
"rustdoc",
306-
INTRA_DOC_LINK_RESOLUTION_FAILURE,
306+
BROKEN_INTRA_DOC_LINKS,
307307
INVALID_CODEBLOCK_ATTRIBUTES,
308308
MISSING_DOC_CODE_EXAMPLES,
309309
PRIVATE_DOC_TESTS
@@ -318,6 +318,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
318318
store.register_renamed("async_idents", "keyword_idents");
319319
store.register_renamed("exceeding_bitshifts", "arithmetic_overflow");
320320
store.register_renamed("redundant_semicolon", "redundant_semicolons");
321+
store.register_renamed("intra_doc_link_resolution_failure", "broken_intra_doc_links");
321322
store.register_removed("unknown_features", "replaced by an error");
322323
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
323324
store.register_removed("negate_unsigned", "cast a signed value instead");

src/librustc_session/lint/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ declare_lint! {
398398
}
399399

400400
declare_lint! {
401-
pub INTRA_DOC_LINK_RESOLUTION_FAILURE,
401+
pub BROKEN_INTRA_DOC_LINKS,
402402
Warn,
403403
"failures in resolving intra-doc link targets"
404404
}
@@ -601,7 +601,7 @@ declare_lint_pass! {
601601
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
602602
UNSTABLE_NAME_COLLISIONS,
603603
IRREFUTABLE_LET_PATTERNS,
604-
INTRA_DOC_LINK_RESOLUTION_FAILURE,
604+
BROKEN_INTRA_DOC_LINKS,
605605
INVALID_CODEBLOCK_ATTRIBUTES,
606606
MISSING_CRATE_LEVEL_DOCS,
607607
MISSING_DOC_CODE_EXAMPLES,

src/librustdoc/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
315315
let cpath = Some(input.clone());
316316
let input = Input::File(input);
317317

318-
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
318+
let intra_link_resolution_failure_name = lint::builtin::BROKEN_INTRA_DOC_LINKS.name;
319319
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
320320
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
321321
let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name;

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -867,46 +867,40 @@ fn report_diagnostic(
867867
let attrs = &item.attrs;
868868
let sp = span_of_attrs(attrs).unwrap_or(item.source.span());
869869

870-
cx.tcx.struct_span_lint_hir(
871-
lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
872-
hir_id,
873-
sp,
874-
|lint| {
875-
let mut diag = lint.build(msg);
876-
877-
let span = link_range
878-
.as_ref()
879-
.and_then(|range| super::source_span_for_markdown_range(cx, dox, range, attrs));
880-
881-
if let Some(link_range) = link_range {
882-
if let Some(sp) = span {
883-
diag.set_span(sp);
884-
} else {
885-
// blah blah blah\nblah\nblah [blah] blah blah\nblah blah
886-
// ^ ~~~~
887-
// | link_range
888-
// last_new_line_offset
889-
let last_new_line_offset =
890-
dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
891-
let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
892-
893-
// Print the line containing the `link_range` and manually mark it with '^'s.
894-
diag.note(&format!(
895-
"the link appears in this line:\n\n{line}\n\
870+
cx.tcx.struct_span_lint_hir(lint::builtin::BROKEN_INTRA_DOC_LINKS, hir_id, sp, |lint| {
871+
let mut diag = lint.build(msg);
872+
873+
let span = link_range
874+
.as_ref()
875+
.and_then(|range| super::source_span_for_markdown_range(cx, dox, range, attrs));
876+
877+
if let Some(link_range) = link_range {
878+
if let Some(sp) = span {
879+
diag.set_span(sp);
880+
} else {
881+
// blah blah blah\nblah\nblah [blah] blah blah\nblah blah
882+
// ^ ~~~~
883+
// | link_range
884+
// last_new_line_offset
885+
let last_new_line_offset = dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
886+
let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
887+
888+
// Print the line containing the `link_range` and manually mark it with '^'s.
889+
diag.note(&format!(
890+
"the link appears in this line:\n\n{line}\n\
896891
{indicator: <before$}{indicator:^<found$}",
897-
line = line,
898-
indicator = "",
899-
before = link_range.start - last_new_line_offset,
900-
found = link_range.len(),
901-
));
902-
}
892+
line = line,
893+
indicator = "",
894+
before = link_range.start - last_new_line_offset,
895+
found = link_range.len(),
896+
));
903897
}
898+
}
904899

905-
decorate(&mut diag, span);
900+
decorate(&mut diag, span);
906901

907-
diag.emit();
908-
},
909-
);
902+
diag.emit();
903+
});
910904
}
911905

912906
fn resolution_failure(

src/test/run-make-fulldeps/exit-code/lint-failure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(intra_doc_link_resolution_failure)]
1+
#![deny(broken_intra_doc_links)]
22

33
/// [intradoc::failure]
44
pub fn main() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(intra_doc_link_resolution_failure)]
1+
#![deny(broken_intra_doc_links)]
22

33
/// [v2] //~ ERROR
44
pub fn foo() {}

0 commit comments

Comments
 (0)