Auto merge of #82756 - JohnTitor:rollup-e4ij7h6, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #80527 (Make rustdoc lints a tool lint instead of built-in) - #82310 (Load rustdoc's JS search index on-demand.) - #82315 (Improve page load performance in rustdoc) - #82564 (Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation) - #82697 (Fix stabilization version of move_ref_pattern) - #82717 (Account for macros when suggesting adding lifetime) - #82740 (Fix commit detected when using `download-rustc`) - #82744 (Pass `CrateNum` by value instead of by reference) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
ec7f258d54
100 changed files with 685 additions and 420 deletions
|
@ -34,7 +34,7 @@ impl MarkedAttrs {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_known_lint_tool(m_item: Ident) -> bool {
|
pub fn is_known_lint_tool(m_item: Ident) -> bool {
|
||||||
[sym::clippy, sym::rustc].contains(&m_item.name)
|
[sym::clippy, sym::rustc, sym::rustdoc].contains(&m_item.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NestedMetaItem {
|
impl NestedMetaItem {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![deny(invalid_codeblock_attributes)]
|
#![cfg_attr(bootstrap, deny(invalid_codeblock_attributes))]
|
||||||
|
#![cfg_attr(not(bootstrap), deny(rustdoc::invalid_codeblock_attributes))]
|
||||||
//! This library is used to gather all error codes into one place,
|
//! This library is used to gather all error codes into one place,
|
||||||
//! the goal being to make their maintenance easier.
|
//! the goal being to make their maintenance easier.
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ declare_features! (
|
||||||
(accepted, doc_alias, "1.48.0", Some(50146), None),
|
(accepted, doc_alias, "1.48.0", Some(50146), None),
|
||||||
/// Allows patterns with concurrent by-move and by-ref bindings.
|
/// Allows patterns with concurrent by-move and by-ref bindings.
|
||||||
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
|
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
|
||||||
(accepted, move_ref_pattern, "1.48.0", Some(68354), None),
|
(accepted, move_ref_pattern, "1.49.0", Some(68354), None),
|
||||||
/// The smallest useful subset of `const_generics`.
|
/// The smallest useful subset of `const_generics`.
|
||||||
(accepted, min_const_generics, "1.51.0", Some(74878), None),
|
(accepted, min_const_generics, "1.51.0", Some(74878), None),
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ impl SessionLintStore for LintStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The target of the `by_name` map, which accounts for renaming/deprecation.
|
/// The target of the `by_name` map, which accounts for renaming/deprecation.
|
||||||
|
#[derive(Debug)]
|
||||||
enum TargetLint {
|
enum TargetLint {
|
||||||
/// A direct lint target
|
/// A direct lint target
|
||||||
Id(LintId),
|
Id(LintId),
|
||||||
|
@ -470,7 +471,10 @@ impl LintStore {
|
||||||
Some(&Id(ref id)) => {
|
Some(&Id(ref id)) => {
|
||||||
CheckLintNameResult::Tool(Err((Some(slice::from_ref(id)), complete_name)))
|
CheckLintNameResult::Tool(Err((Some(slice::from_ref(id)), complete_name)))
|
||||||
}
|
}
|
||||||
_ => CheckLintNameResult::NoLint(None),
|
Some(other) => {
|
||||||
|
tracing::debug!("got renamed lint {:?}", other);
|
||||||
|
CheckLintNameResult::NoLint(None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,7 @@ use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::lint::builtin::{
|
use rustc_session::lint::builtin::{
|
||||||
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
|
BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS,
|
||||||
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, INVALID_HTML_TAGS,
|
|
||||||
MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
|
|
||||||
};
|
};
|
||||||
use rustc_span::symbol::{Ident, Symbol};
|
use rustc_span::symbol::{Ident, Symbol};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
@ -314,17 +312,6 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||||
// MACRO_USE_EXTERN_CRATE
|
// MACRO_USE_EXTERN_CRATE
|
||||||
);
|
);
|
||||||
|
|
||||||
add_lint_group!(
|
|
||||||
"rustdoc",
|
|
||||||
NON_AUTOLINKS,
|
|
||||||
BROKEN_INTRA_DOC_LINKS,
|
|
||||||
PRIVATE_INTRA_DOC_LINKS,
|
|
||||||
INVALID_CODEBLOCK_ATTRIBUTES,
|
|
||||||
MISSING_DOC_CODE_EXAMPLES,
|
|
||||||
PRIVATE_DOC_TESTS,
|
|
||||||
INVALID_HTML_TAGS
|
|
||||||
);
|
|
||||||
|
|
||||||
// Register renamed and removed lints.
|
// Register renamed and removed lints.
|
||||||
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
|
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
|
||||||
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
|
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
|
||||||
|
@ -334,8 +321,29 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||||
store.register_renamed("async_idents", "keyword_idents");
|
store.register_renamed("async_idents", "keyword_idents");
|
||||||
store.register_renamed("exceeding_bitshifts", "arithmetic_overflow");
|
store.register_renamed("exceeding_bitshifts", "arithmetic_overflow");
|
||||||
store.register_renamed("redundant_semicolon", "redundant_semicolons");
|
store.register_renamed("redundant_semicolon", "redundant_semicolons");
|
||||||
store.register_renamed("intra_doc_link_resolution_failure", "broken_intra_doc_links");
|
|
||||||
store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
|
store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
|
||||||
|
|
||||||
|
// These were moved to tool lints, but rustc still sees them when compiling normally, before
|
||||||
|
// tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use
|
||||||
|
// `register_removed` explicitly.
|
||||||
|
const RUSTDOC_LINTS: &[&str] = &[
|
||||||
|
"broken_intra_doc_links",
|
||||||
|
"private_intra_doc_links",
|
||||||
|
"missing_crate_level_docs",
|
||||||
|
"missing_doc_code_examples",
|
||||||
|
"private_doc_tests",
|
||||||
|
"invalid_codeblock_attributes",
|
||||||
|
"invalid_html_tags",
|
||||||
|
"non_autolinks",
|
||||||
|
];
|
||||||
|
for rustdoc_lint in RUSTDOC_LINTS {
|
||||||
|
store.register_removed(rustdoc_lint, &format!("use `rustdoc::{}` instead", rustdoc_lint));
|
||||||
|
}
|
||||||
|
store.register_removed(
|
||||||
|
"intra_doc_link_resolution_failure",
|
||||||
|
"use `rustdoc::broken_intra_doc_links` instead",
|
||||||
|
);
|
||||||
|
|
||||||
store.register_removed("unknown_features", "replaced by an error");
|
store.register_removed("unknown_features", "replaced by an error");
|
||||||
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
|
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
|
||||||
store.register_removed("negate_unsigned", "cast a signed value instead");
|
store.register_removed("negate_unsigned", "cast a signed value instead");
|
||||||
|
|
|
@ -1875,93 +1875,6 @@ declare_lint! {
|
||||||
"detects labels that are never used"
|
"detects labels that are never used"
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `broken_intra_doc_links` lint detects failures in resolving
|
|
||||||
/// intra-doc link targets. This is a `rustdoc` only lint, see the
|
|
||||||
/// documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#broken_intra_doc_links
|
|
||||||
pub BROKEN_INTRA_DOC_LINKS,
|
|
||||||
Warn,
|
|
||||||
"failures in resolving intra-doc link targets"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// This is a subset of `broken_intra_doc_links` that warns when linking from
|
|
||||||
/// a public item to a private one. This is a `rustdoc` only lint, see the
|
|
||||||
/// documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#private_intra_doc_links
|
|
||||||
pub PRIVATE_INTRA_DOC_LINKS,
|
|
||||||
Warn,
|
|
||||||
"linking from a public item to a private one"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `invalid_codeblock_attributes` lint detects code block attributes
|
|
||||||
/// in documentation examples that have potentially mis-typed values. This
|
|
||||||
/// is a `rustdoc` only lint, see the documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_codeblock_attributes
|
|
||||||
pub INVALID_CODEBLOCK_ATTRIBUTES,
|
|
||||||
Warn,
|
|
||||||
"codeblock attribute looks a lot like a known one"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `missing_crate_level_docs` lint detects if documentation is
|
|
||||||
/// missing at the crate root. This is a `rustdoc` only lint, see the
|
|
||||||
/// documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#missing_crate_level_docs
|
|
||||||
pub MISSING_CRATE_LEVEL_DOCS,
|
|
||||||
Allow,
|
|
||||||
"detects crates with no crate-level documentation"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `missing_doc_code_examples` lint detects publicly-exported items
|
|
||||||
/// without code samples in their documentation. This is a `rustdoc` only
|
|
||||||
/// lint, see the documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#missing_doc_code_examples
|
|
||||||
pub MISSING_DOC_CODE_EXAMPLES,
|
|
||||||
Allow,
|
|
||||||
"detects publicly-exported items without code samples in their documentation"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `private_doc_tests` lint detects code samples in docs of private
|
|
||||||
/// items not documented by `rustdoc`. This is a `rustdoc` only lint, see
|
|
||||||
/// the documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#private_doc_tests
|
|
||||||
pub PRIVATE_DOC_TESTS,
|
|
||||||
Allow,
|
|
||||||
"detects code samples in docs of private items not documented by rustdoc"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `invalid_html_tags` lint detects invalid HTML tags. This is a
|
|
||||||
/// `rustdoc` only lint, see the documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
|
|
||||||
pub INVALID_HTML_TAGS,
|
|
||||||
Allow,
|
|
||||||
"detects invalid HTML tags in doc comments"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
|
||||||
/// The `non_autolinks` lint detects when a URL could be written using
|
|
||||||
/// only angle brackets. This is a `rustdoc` only lint, see the
|
|
||||||
/// documentation in the [rustdoc book].
|
|
||||||
///
|
|
||||||
/// [rustdoc book]: ../../../rustdoc/lints.html#non_autolinks
|
|
||||||
pub NON_AUTOLINKS,
|
|
||||||
Warn,
|
|
||||||
"detects URLs that could be written using only angle brackets"
|
|
||||||
}
|
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `where_clauses_object_safety` lint detects for [object safety] of
|
/// The `where_clauses_object_safety` lint detects for [object safety] of
|
||||||
/// [where clauses].
|
/// [where clauses].
|
||||||
|
@ -3020,14 +2933,6 @@ declare_lint_pass! {
|
||||||
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
|
||||||
UNSTABLE_NAME_COLLISIONS,
|
UNSTABLE_NAME_COLLISIONS,
|
||||||
IRREFUTABLE_LET_PATTERNS,
|
IRREFUTABLE_LET_PATTERNS,
|
||||||
BROKEN_INTRA_DOC_LINKS,
|
|
||||||
PRIVATE_INTRA_DOC_LINKS,
|
|
||||||
INVALID_CODEBLOCK_ATTRIBUTES,
|
|
||||||
MISSING_CRATE_LEVEL_DOCS,
|
|
||||||
MISSING_DOC_CODE_EXAMPLES,
|
|
||||||
INVALID_HTML_TAGS,
|
|
||||||
PRIVATE_DOC_TESTS,
|
|
||||||
NON_AUTOLINKS,
|
|
||||||
WHERE_CLAUSES_OBJECT_SAFETY,
|
WHERE_CLAUSES_OBJECT_SAFETY,
|
||||||
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
|
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
|
||||||
MACRO_USE_EXTERN_CRATE,
|
MACRO_USE_EXTERN_CRATE,
|
||||||
|
|
|
@ -1645,6 +1645,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
);
|
);
|
||||||
err.span_label(lifetime_ref.span, "undeclared lifetime");
|
err.span_label(lifetime_ref.span, "undeclared lifetime");
|
||||||
let mut suggests_in_band = false;
|
let mut suggests_in_band = false;
|
||||||
|
let mut suggest_note = true;
|
||||||
for missing in &self.missing_named_lifetime_spots {
|
for missing in &self.missing_named_lifetime_spots {
|
||||||
match missing {
|
match missing {
|
||||||
MissingLifetimeSpot::Generics(generics) => {
|
MissingLifetimeSpot::Generics(generics) => {
|
||||||
|
@ -1664,12 +1665,24 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
suggests_in_band = true;
|
suggests_in_band = true;
|
||||||
(generics.span, format!("<{}>", lifetime_ref))
|
(generics.span, format!("<{}>", lifetime_ref))
|
||||||
};
|
};
|
||||||
err.span_suggestion(
|
if !span.from_expansion() {
|
||||||
span,
|
err.span_suggestion(
|
||||||
&format!("consider introducing lifetime `{}` here", lifetime_ref),
|
span,
|
||||||
sugg,
|
&format!("consider introducing lifetime `{}` here", lifetime_ref),
|
||||||
Applicability::MaybeIncorrect,
|
sugg,
|
||||||
);
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
} else if suggest_note {
|
||||||
|
suggest_note = false; // Avoid displaying the same help multiple times.
|
||||||
|
err.span_label(
|
||||||
|
span,
|
||||||
|
&format!(
|
||||||
|
"lifetime `{}` is missing in item created through this procedural \
|
||||||
|
macro",
|
||||||
|
lifetime_ref,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MissingLifetimeSpot::HigherRanked { span, span_type } => {
|
MissingLifetimeSpot::HigherRanked { span, span_type } => {
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
|
@ -1684,7 +1697,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
);
|
);
|
||||||
err.note(
|
err.note(
|
||||||
"for more information on higher-ranked polymorphism, visit \
|
"for more information on higher-ranked polymorphism, visit \
|
||||||
https://doc.rust-lang.org/nomicon/hrtb.html",
|
https://doc.rust-lang.org/nomicon/hrtb.html",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -1696,7 +1709,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
{
|
{
|
||||||
err.help(
|
err.help(
|
||||||
"if you want to experiment with in-band lifetime bindings, \
|
"if you want to experiment with in-band lifetime bindings, \
|
||||||
add `#![feature(in_band_lifetimes)]` to the crate attributes",
|
add `#![feature(in_band_lifetimes)]` to the crate attributes",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
|
|
|
@ -1021,6 +1021,7 @@ symbols! {
|
||||||
rustc_then_this_would_need,
|
rustc_then_this_would_need,
|
||||||
rustc_unsafe_specialization_marker,
|
rustc_unsafe_specialization_marker,
|
||||||
rustc_variance,
|
rustc_variance,
|
||||||
|
rustdoc,
|
||||||
rustfmt,
|
rustfmt,
|
||||||
rvalue_static_promotion,
|
rvalue_static_promotion,
|
||||||
sanitize,
|
sanitize,
|
||||||
|
|
|
@ -1877,7 +1877,15 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||||
#[unstable(feature = "vec_spare_capacity", issue = "75017")]
|
#[unstable(feature = "vec_spare_capacity", issue = "75017")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>] {
|
pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>] {
|
||||||
self.split_at_spare_mut().1
|
// Note:
|
||||||
|
// This method is not implemented in terms of `split_at_spare_mut`,
|
||||||
|
// to prevent invalidation of pointers to the buffer.
|
||||||
|
unsafe {
|
||||||
|
slice::from_raw_parts_mut(
|
||||||
|
self.as_mut_ptr().add(self.len) as *mut MaybeUninit<T>,
|
||||||
|
self.buf.capacity() - self.len,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns vector content as a slice of `T`, along with the remaining spare
|
/// Returns vector content as a slice of `T`, along with the remaining spare
|
||||||
|
@ -1934,20 +1942,16 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||||
#[unstable(feature = "vec_split_at_spare", issue = "81944")]
|
#[unstable(feature = "vec_split_at_spare", issue = "81944")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {
|
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {
|
||||||
let ptr = self.as_mut_ptr();
|
let Range { start: ptr, end: spare_ptr } = self.as_mut_ptr_range();
|
||||||
|
let spare_ptr = spare_ptr.cast::<MaybeUninit<T>>();
|
||||||
// SAFETY:
|
let spare_len = self.buf.capacity() - self.len;
|
||||||
// - `ptr` is guaranteed to be in bounds for `capacity` elements
|
|
||||||
// - `len` is guaranteed to less or equal to `capacity`
|
|
||||||
// - `MaybeUninit<T>` has the same layout as `T`
|
|
||||||
let spare_ptr = unsafe { ptr.cast::<MaybeUninit<T>>().add(self.len) };
|
|
||||||
|
|
||||||
// SAFETY:
|
// SAFETY:
|
||||||
// - `ptr` is guaranteed to be valid for `len` elements
|
// - `ptr` is guaranteed to be valid for `len` elements
|
||||||
// - `spare_ptr` is offseted from `ptr` by `len`, so it doesn't overlap `initialized` slice
|
// - `spare_ptr` is pointing one element past the buffer, so it doesn't overlap with `initialized`
|
||||||
unsafe {
|
unsafe {
|
||||||
let initialized = slice::from_raw_parts_mut(ptr, self.len);
|
let initialized = slice::from_raw_parts_mut(ptr, self.len);
|
||||||
let spare = slice::from_raw_parts_mut(spare_ptr, self.buf.capacity() - self.len);
|
let spare = slice::from_raw_parts_mut(spare_ptr, spare_len);
|
||||||
|
|
||||||
(initialized, spare)
|
(initialized, spare)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#![feature(vecdeque_binary_search)]
|
#![feature(vecdeque_binary_search)]
|
||||||
#![feature(slice_group_by)]
|
#![feature(slice_group_by)]
|
||||||
#![feature(vec_extend_from_within)]
|
#![feature(vec_extend_from_within)]
|
||||||
|
#![feature(vec_spare_capacity)]
|
||||||
|
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
|
@ -1691,6 +1691,10 @@ fn test_stable_pointers() {
|
||||||
next_then_drop(v.splice(5..6, vec![1; 10].into_iter().filter(|_| true))); // lower bound not exact
|
next_then_drop(v.splice(5..6, vec![1; 10].into_iter().filter(|_| true))); // lower bound not exact
|
||||||
assert_eq!(*v0, 13);
|
assert_eq!(*v0, 13);
|
||||||
|
|
||||||
|
// spare_capacity_mut
|
||||||
|
v.spare_capacity_mut();
|
||||||
|
assert_eq!(*v0, 13);
|
||||||
|
|
||||||
// Smoke test that would fire even outside Miri if an actual relocation happened.
|
// Smoke test that would fire even outside Miri if an actual relocation happened.
|
||||||
*v0 -= 13;
|
*v0 -= 13;
|
||||||
assert_eq!(v[0], 0);
|
assert_eq!(v[0], 0);
|
||||||
|
|
|
@ -297,7 +297,8 @@ pub mod primitive;
|
||||||
unused_imports,
|
unused_imports,
|
||||||
unsafe_op_in_unsafe_fn
|
unsafe_op_in_unsafe_fn
|
||||||
)]
|
)]
|
||||||
#[allow(non_autolinks)]
|
#[cfg_attr(bootstrap, allow(non_autolinks))]
|
||||||
|
#[cfg_attr(not(bootstrap), allow(rustdoc::non_autolinks))]
|
||||||
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
|
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
|
||||||
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
|
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
|
||||||
#[allow(clashing_extern_declarations)]
|
#[allow(clashing_extern_declarations)]
|
||||||
|
|
|
@ -647,9 +647,8 @@ class RustBuild(object):
|
||||||
compiler = "{}/compiler/".format(top_level)
|
compiler = "{}/compiler/".format(top_level)
|
||||||
|
|
||||||
# Look for a version to compare to based on the current commit.
|
# Look for a version to compare to based on the current commit.
|
||||||
# Ideally this would just use `merge-base`, but on beta and stable branches that wouldn't
|
# Only commits merged by bors will have CI artifacts.
|
||||||
# come up with any commits, so hack it and use `author=bors` instead.
|
merge_base = ["git", "log", "--author=bors", "--pretty=%H", "-n1"]
|
||||||
merge_base = ["git", "log", "--author=bors", "--pretty=%H", "-n1", "--", compiler]
|
|
||||||
commit = subprocess.check_output(merge_base, universal_newlines=True).strip()
|
commit = subprocess.check_output(merge_base, universal_newlines=True).strip()
|
||||||
|
|
||||||
# Warn if there were changes to the compiler since the ancestor commit.
|
# Warn if there were changes to the compiler since the ancestor commit.
|
||||||
|
|
|
@ -735,8 +735,15 @@ impl<'a> Builder<'a> {
|
||||||
.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler))
|
.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler))
|
||||||
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
|
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
|
||||||
.env("RUSTDOC_REAL", self.rustdoc(compiler))
|
.env("RUSTDOC_REAL", self.rustdoc(compiler))
|
||||||
.env("RUSTC_BOOTSTRAP", "1")
|
.env("RUSTC_BOOTSTRAP", "1");
|
||||||
.arg("-Winvalid_codeblock_attributes");
|
|
||||||
|
// cfg(bootstrap), can be removed on the next beta bump
|
||||||
|
if compiler.stage == 0 {
|
||||||
|
cmd.arg("-Winvalid_codeblock_attributes");
|
||||||
|
} else {
|
||||||
|
cmd.arg("-Wrustdoc::invalid_codeblock_attributes");
|
||||||
|
}
|
||||||
|
|
||||||
if self.config.deny_warnings {
|
if self.config.deny_warnings {
|
||||||
cmd.arg("-Dwarnings");
|
cmd.arg("-Dwarnings");
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1299,12 @@ impl<'a> Builder<'a> {
|
||||||
// fixed via better support from Cargo.
|
// fixed via better support from Cargo.
|
||||||
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));
|
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));
|
||||||
|
|
||||||
rustdocflags.arg("-Winvalid_codeblock_attributes");
|
// cfg(bootstrap), can be removed on the next beta bump
|
||||||
|
if compiler.stage == 0 {
|
||||||
|
rustdocflags.arg("-Winvalid_codeblock_attributes");
|
||||||
|
} else {
|
||||||
|
rustdocflags.arg("-Wrustdoc::invalid_codeblock_attributes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if mode == Mode::Rustc {
|
if mode == Mode::Rustc {
|
||||||
|
|
|
@ -3,30 +3,35 @@
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
|
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Fira Sans';
|
font-family: 'Fira Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
|
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url("SourceSerifPro-It.ttf.woff") format('woff');
|
src: url("SourceSerifPro-It.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Code Pro';
|
font-family: 'Source Code Pro';
|
||||||
|
@ -35,6 +40,7 @@
|
||||||
/* Avoid using locally installed font because bad versions are in circulation:
|
/* Avoid using locally installed font because bad versions are in circulation:
|
||||||
* see https://github.com/rust-lang/rust/issues/24355 */
|
* see https://github.com/rust-lang/rust/issues/24355 */
|
||||||
src: url("SourceCodePro-Regular.woff") format('woff');
|
src: url("SourceCodePro-Regular.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
*:not(body) {
|
*:not(body) {
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
can use them like any other lints by doing this:
|
can use them like any other lints by doing this:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![allow(missing_docs)] // allows the lint, no diagnostics will be reported
|
#![allow(rustdoc::broken_intra_doc_links)] // allows the lint, no diagnostics will be reported
|
||||||
#![warn(missing_docs)] // warn if there are missing docs
|
#![warn(rustdoc::broken_intra_doc_links)] // warn if there are broken intra-doc links
|
||||||
#![deny(missing_docs)] // error if there are missing docs
|
#![deny(rustdoc::broken_intra_doc_links)] // error if there are broken intra-doc links
|
||||||
# //! Crate docs.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that, except for `missing_docs`, these lints are only available when running `rustdoc`, not `rustc`.
|
||||||
|
|
||||||
Here is the list of the lints provided by `rustdoc`:
|
Here is the list of the lints provided by `rustdoc`:
|
||||||
|
|
||||||
## broken_intra_doc_links
|
## broken_intra_doc_links
|
||||||
|
@ -51,7 +52,7 @@ warning: `Foo` is both an enum and a function
|
||||||
1 | /// [`Foo`]
|
1 | /// [`Foo`]
|
||||||
| ^^^^^ ambiguous link
|
| ^^^^^ ambiguous link
|
||||||
|
|
|
|
||||||
= note: `#[warn(broken_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||||
help: to link to the enum, prefix with the item type
|
help: to link to the enum, prefix with the item type
|
||||||
|
|
|
|
||||||
1 | /// [`enum@Foo`]
|
1 | /// [`enum@Foo`]
|
||||||
|
@ -83,7 +84,7 @@ warning: public documentation for `public` links to private item `private`
|
||||||
1 | /// [private]
|
1 | /// [private]
|
||||||
| ^^^^^^^ this item is private
|
| ^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link will resolve properly if you pass `--document-private-items`
|
= note: this link will resolve properly if you pass `--document-private-items`
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ warning: public documentation for `public` links to private item `private`
|
||||||
1 | /// [private]
|
1 | /// [private]
|
||||||
| ^^^^^^^ this item is private
|
| ^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -125,13 +126,15 @@ warning: missing documentation for a function
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that unlike other rustdoc lints, this lint is also available from `rustc` directly.
|
||||||
|
|
||||||
## missing_crate_level_docs
|
## missing_crate_level_docs
|
||||||
|
|
||||||
This lint is **allowed by default**. It detects if there is no documentation
|
This lint is **allowed by default**. It detects if there is no documentation
|
||||||
at the crate root. For example:
|
at the crate root. For example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![warn(missing_crate_level_docs)]
|
#![warn(rustdoc::missing_crate_level_docs)]
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate the following warning:
|
This will generate the following warning:
|
||||||
|
@ -155,7 +158,7 @@ This lint is **allowed by default** and is **nightly-only**. It detects when a d
|
||||||
is missing a code example. For example:
|
is missing a code example. For example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![warn(missing_doc_code_examples)]
|
#![warn(rustdoc::missing_doc_code_examples)]
|
||||||
|
|
||||||
/// There is no code example!
|
/// There is no code example!
|
||||||
pub fn no_code_example() {}
|
pub fn no_code_example() {}
|
||||||
|
@ -191,7 +194,7 @@ This lint is **allowed by default**. It detects documentation tests when they
|
||||||
are on a private item. For example:
|
are on a private item. For example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![warn(private_doc_tests)]
|
#![warn(rustdoc::private_doc_tests)]
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
/// private doc test
|
/// private doc test
|
||||||
|
@ -245,7 +248,7 @@ warning: unknown attribute `should-panic`. Did you mean `should_panic`?
|
||||||
5 | | /// ```
|
5 | | /// ```
|
||||||
| |_______^
|
| |_______^
|
||||||
|
|
|
|
||||||
= note: `#[warn(invalid_codeblock_attributes)]` on by default
|
= note: `#[warn(rustdoc::invalid_codeblock_attributes)]` on by default
|
||||||
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
|
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -258,7 +261,7 @@ This lint is **allowed by default** and is **nightly-only**. It detects unclosed
|
||||||
or invalid HTML tags. For example:
|
or invalid HTML tags. For example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![warn(invalid_html_tags)]
|
#![warn(rustdoc::invalid_html_tags)]
|
||||||
|
|
||||||
/// <h1>
|
/// <h1>
|
||||||
/// </script>
|
/// </script>
|
||||||
|
@ -275,7 +278,11 @@ warning: unopened HTML tag `script`
|
||||||
2 | | /// </script>
|
2 | | /// </script>
|
||||||
| |_____________^
|
| |_____________^
|
||||||
|
|
|
|
||||||
= note: `#[warn(invalid_html_tags)]` on by default
|
note: the lint level is defined here
|
||||||
|
--> foo.rs:1:9
|
||||||
|
|
|
||||||
|
1 | #![warn(rustdoc::invalid_html_tags)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: unclosed HTML tag `h1`
|
warning: unclosed HTML tag `h1`
|
||||||
--> foo.rs:1:1
|
--> foo.rs:1:1
|
||||||
|
@ -310,7 +317,7 @@ warning: this URL is not a hyperlink
|
||||||
1 | /// http://example.org
|
1 | /// http://example.org
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://example.org>`
|
| ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://example.org>`
|
||||||
|
|
|
|
||||||
= note: `#[warn(non_autolinks)]` on by default
|
= note: `#[warn(rustdoc::non_autolinks)]` on by default
|
||||||
|
|
||||||
warning: unneeded long form for URL
|
warning: unneeded long form for URL
|
||||||
--> foo.rs:2:5
|
--> foo.rs:2:5
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn links(&self, cache: &Cache) -> Vec<RenderedLink> {
|
crate fn links(&self, cache: &Cache) -> Vec<RenderedLink> {
|
||||||
self.attrs.links(&self.def_id.krate, cache)
|
self.attrs.links(self.def_id.krate, cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn is_crate(&self) -> bool {
|
crate fn is_crate(&self) -> bool {
|
||||||
|
@ -844,7 +844,7 @@ impl Attributes {
|
||||||
/// Gets links as a vector
|
/// Gets links as a vector
|
||||||
///
|
///
|
||||||
/// Cache must be populated before call
|
/// Cache must be populated before call
|
||||||
crate fn links(&self, krate: &CrateNum, cache: &Cache) -> Vec<RenderedLink> {
|
crate fn links(&self, krate: CrateNum, cache: &Cache) -> Vec<RenderedLink> {
|
||||||
use crate::html::format::href;
|
use crate::html::format::href;
|
||||||
use crate::html::render::CURRENT_DEPTH;
|
use crate::html::render::CURRENT_DEPTH;
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ impl Attributes {
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
if let Some(ref fragment) = *fragment {
|
if let Some(ref fragment) = *fragment {
|
||||||
let url = match cache.extern_locations.get(krate) {
|
let url = match cache.extern_locations.get(&krate) {
|
||||||
Some(&(_, _, ExternalLocation::Local)) => {
|
Some(&(_, _, ExternalLocation::Local)) => {
|
||||||
let depth = CURRENT_DEPTH.with(|l| l.get());
|
let depth = CURRENT_DEPTH.with(|l| l.get());
|
||||||
"../".repeat(depth)
|
"../".repeat(depth)
|
||||||
|
|
|
@ -24,9 +24,10 @@ use rustc_span::source_map;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
use rustc_span::DUMMY_SP;
|
use rustc_span::DUMMY_SP;
|
||||||
|
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::collections::hash_map::Entry;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{cell::RefCell, collections::hash_map::Entry};
|
|
||||||
|
|
||||||
use crate::clean;
|
use crate::clean;
|
||||||
use crate::clean::inline::build_external_trait;
|
use crate::clean::inline::build_external_trait;
|
||||||
|
@ -227,64 +228,6 @@ crate fn new_handler(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to setup the lint initialization. By default, in rustdoc, everything
|
|
||||||
/// is "allowed". Depending if we run in test mode or not, we want some of them to be at their
|
|
||||||
/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTES" lint is activated in both
|
|
||||||
/// modes.
|
|
||||||
///
|
|
||||||
/// A little detail easy to forget is that there is a way to set the lint level for all lints
|
|
||||||
/// through the "WARNINGS" lint. To prevent this to happen, we set it back to its "normal" level
|
|
||||||
/// inside this function.
|
|
||||||
///
|
|
||||||
/// It returns a tuple containing:
|
|
||||||
/// * Vector of tuples of lints' name and their associated "max" level
|
|
||||||
/// * HashMap of lint id with their associated "max" level
|
|
||||||
pub(crate) fn init_lints<F>(
|
|
||||||
mut allowed_lints: Vec<String>,
|
|
||||||
lint_opts: Vec<(String, lint::Level)>,
|
|
||||||
filter_call: F,
|
|
||||||
) -> (Vec<(String, lint::Level)>, FxHashMap<lint::LintId, lint::Level>)
|
|
||||||
where
|
|
||||||
F: Fn(&lint::Lint) -> Option<(String, lint::Level)>,
|
|
||||||
{
|
|
||||||
let warnings_lint_name = lint::builtin::WARNINGS.name;
|
|
||||||
|
|
||||||
allowed_lints.push(warnings_lint_name.to_owned());
|
|
||||||
allowed_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
|
|
||||||
|
|
||||||
let lints = || {
|
|
||||||
lint::builtin::HardwiredLints::get_lints()
|
|
||||||
.into_iter()
|
|
||||||
.chain(rustc_lint::SoftLints::get_lints().into_iter())
|
|
||||||
};
|
|
||||||
|
|
||||||
let lint_opts = lints()
|
|
||||||
.filter_map(|lint| {
|
|
||||||
// Permit feature-gated lints to avoid feature errors when trying to
|
|
||||||
// allow all lints.
|
|
||||||
if lint.feature_gate.is_some() || allowed_lints.iter().any(|l| lint.name == l) {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
filter_call(lint)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.chain(lint_opts.into_iter())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
let lint_caps = lints()
|
|
||||||
.filter_map(|lint| {
|
|
||||||
// We don't want to allow *all* lints so let's ignore
|
|
||||||
// those ones.
|
|
||||||
if allowed_lints.iter().any(|l| lint.name == l) {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some((lint::LintId::of(lint), lint::Allow))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
(lint_opts, lint_caps)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parse, resolve, and typecheck the given crate.
|
/// Parse, resolve, and typecheck the given crate.
|
||||||
crate fn create_config(
|
crate fn create_config(
|
||||||
RustdocOptions {
|
RustdocOptions {
|
||||||
|
@ -313,37 +256,22 @@ crate fn create_config(
|
||||||
let cpath = Some(input.clone());
|
let cpath = Some(input.clone());
|
||||||
let input = Input::File(input);
|
let input = Input::File(input);
|
||||||
|
|
||||||
let broken_intra_doc_links = lint::builtin::BROKEN_INTRA_DOC_LINKS.name;
|
// By default, rustdoc ignores all lints.
|
||||||
let private_intra_doc_links = lint::builtin::PRIVATE_INTRA_DOC_LINKS.name;
|
// Specifically unblock lints relevant to documentation or the lint machinery itself.
|
||||||
let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
|
let mut lints_to_show = vec![
|
||||||
let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name;
|
// it's unclear whether this should be part of rustdoc directly (#77364)
|
||||||
let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name;
|
rustc_lint::builtin::MISSING_DOCS.name.to_string(),
|
||||||
let no_crate_level_docs = rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS.name;
|
// these are definitely not part of rustdoc, but we want to warn on them anyway.
|
||||||
let invalid_codeblock_attributes_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name;
|
rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_string(),
|
||||||
let invalid_html_tags = rustc_lint::builtin::INVALID_HTML_TAGS.name;
|
rustc_lint::builtin::UNKNOWN_LINTS.name.to_string(),
|
||||||
let renamed_and_removed_lints = rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name;
|
|
||||||
let non_autolinks = rustc_lint::builtin::NON_AUTOLINKS.name;
|
|
||||||
let unknown_lints = rustc_lint::builtin::UNKNOWN_LINTS.name;
|
|
||||||
|
|
||||||
// In addition to those specific lints, we also need to allow those given through
|
|
||||||
// command line, otherwise they'll get ignored and we don't want that.
|
|
||||||
let lints_to_show = vec![
|
|
||||||
broken_intra_doc_links.to_owned(),
|
|
||||||
private_intra_doc_links.to_owned(),
|
|
||||||
missing_docs.to_owned(),
|
|
||||||
missing_doc_example.to_owned(),
|
|
||||||
private_doc_tests.to_owned(),
|
|
||||||
no_crate_level_docs.to_owned(),
|
|
||||||
invalid_codeblock_attributes_name.to_owned(),
|
|
||||||
invalid_html_tags.to_owned(),
|
|
||||||
renamed_and_removed_lints.to_owned(),
|
|
||||||
unknown_lints.to_owned(),
|
|
||||||
non_autolinks.to_owned(),
|
|
||||||
];
|
];
|
||||||
|
lints_to_show.extend(crate::lint::RUSTDOC_LINTS.iter().map(|lint| lint.name.to_string()));
|
||||||
|
|
||||||
let (lint_opts, lint_caps) = init_lints(lints_to_show, lint_opts, |lint| {
|
let (lint_opts, lint_caps) = crate::lint::init_lints(lints_to_show, lint_opts, |lint| {
|
||||||
// FIXME: why is this necessary?
|
// FIXME: why is this necessary?
|
||||||
if lint.name == broken_intra_doc_links || lint.name == invalid_codeblock_attributes_name {
|
if lint.name == crate::lint::BROKEN_INTRA_DOC_LINKS.name
|
||||||
|
|| lint.name == crate::lint::INVALID_CODEBLOCK_ATTRIBUTES.name
|
||||||
|
{
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some((lint.name_lower(), lint::Allow))
|
Some((lint.name_lower(), lint::Allow))
|
||||||
|
@ -383,7 +311,7 @@ crate fn create_config(
|
||||||
diagnostic_output: DiagnosticOutput::Default,
|
diagnostic_output: DiagnosticOutput::Default,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
lint_caps,
|
lint_caps,
|
||||||
register_lints: None,
|
register_lints: Some(box crate::lint::register_lints),
|
||||||
override_queries: Some(|_sess, providers, _external_providers| {
|
override_queries: Some(|_sess, providers, _external_providers| {
|
||||||
// Most lints will require typechecking, so just don't run them.
|
// Most lints will require typechecking, so just don't run them.
|
||||||
providers.lint_mod = |_, _| {};
|
providers.lint_mod = |_, _| {};
|
||||||
|
@ -550,7 +478,7 @@ crate fn run_global_ctxt(
|
||||||
let help = "The following guide may be of use:\n\
|
let help = "The following guide may be of use:\n\
|
||||||
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
|
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
|
||||||
tcx.struct_lint_node(
|
tcx.struct_lint_node(
|
||||||
rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS,
|
crate::lint::MISSING_CRATE_LEVEL_DOCS,
|
||||||
ctxt.as_local_hir_id(m.def_id).unwrap(),
|
ctxt.as_local_hir_id(m.def_id).unwrap(),
|
||||||
|lint| {
|
|lint| {
|
||||||
let mut diag =
|
let mut diag =
|
||||||
|
|
|
@ -26,8 +26,8 @@ use std::str;
|
||||||
|
|
||||||
use crate::clean::Attributes;
|
use crate::clean::Attributes;
|
||||||
use crate::config::Options;
|
use crate::config::Options;
|
||||||
use crate::core::init_lints;
|
|
||||||
use crate::html::markdown::{self, ErrorCodes, Ignore, LangString};
|
use crate::html::markdown::{self, ErrorCodes, Ignore, LangString};
|
||||||
|
use crate::lint::init_lints;
|
||||||
use crate::passes::span_of_attrs;
|
use crate::passes::span_of_attrs;
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
|
@ -44,11 +44,14 @@ crate struct TestOptions {
|
||||||
crate fn run(options: Options) -> Result<(), ErrorReported> {
|
crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||||
let input = config::Input::File(options.input.clone());
|
let input = config::Input::File(options.input.clone());
|
||||||
|
|
||||||
let invalid_codeblock_attributes_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name;
|
let invalid_codeblock_attributes_name = crate::lint::INVALID_CODEBLOCK_ATTRIBUTES.name;
|
||||||
|
|
||||||
// In addition to those specific lints, we also need to allow those given through
|
// See core::create_config for what's going on here.
|
||||||
// command line, otherwise they'll get ignored and we don't want that.
|
let allowed_lints = vec![
|
||||||
let allowed_lints = vec![invalid_codeblock_attributes_name.to_owned()];
|
invalid_codeblock_attributes_name.to_owned(),
|
||||||
|
lint::builtin::UNKNOWN_LINTS.name.to_owned(),
|
||||||
|
lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_owned(),
|
||||||
|
];
|
||||||
|
|
||||||
let (lint_opts, lint_caps) = init_lints(allowed_lints, options.lint_opts.clone(), |lint| {
|
let (lint_opts, lint_caps) = init_lints(allowed_lints, options.lint_opts.clone(), |lint| {
|
||||||
if lint.name == invalid_codeblock_attributes_name {
|
if lint.name == invalid_codeblock_attributes_name {
|
||||||
|
@ -92,7 +95,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||||
diagnostic_output: DiagnosticOutput::Default,
|
diagnostic_output: DiagnosticOutput::Default,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
lint_caps,
|
lint_caps,
|
||||||
register_lints: None,
|
register_lints: Some(box crate::lint::register_lints),
|
||||||
override_queries: None,
|
override_queries: None,
|
||||||
make_codegen_backend: None,
|
make_codegen_backend: None,
|
||||||
registry: rustc_driver::diagnostics_registry(),
|
registry: rustc_driver::diagnostics_registry(),
|
||||||
|
|
|
@ -58,6 +58,7 @@ crate fn render<T: Print, S: Print>(
|
||||||
{style_files}\
|
{style_files}\
|
||||||
<script id=\"default-settings\"{default_settings}></script>\
|
<script id=\"default-settings\"{default_settings}></script>\
|
||||||
<script src=\"{static_root_path}storage{suffix}.js\"></script>\
|
<script src=\"{static_root_path}storage{suffix}.js\"></script>\
|
||||||
|
<script src=\"{static_root_path}crates{suffix}.js\"></script>\
|
||||||
<noscript><link rel=\"stylesheet\" href=\"{static_root_path}noscript{suffix}.css\"></noscript>\
|
<noscript><link rel=\"stylesheet\" href=\"{static_root_path}noscript{suffix}.css\"></noscript>\
|
||||||
{css_extension}\
|
{css_extension}\
|
||||||
{favicon}\
|
{favicon}\
|
||||||
|
@ -82,7 +83,7 @@ crate fn render<T: Print, S: Print>(
|
||||||
<div class=\"theme-picker\">\
|
<div class=\"theme-picker\">\
|
||||||
<button id=\"theme-picker\" aria-label=\"Pick another theme!\" aria-haspopup=\"menu\">\
|
<button id=\"theme-picker\" aria-label=\"Pick another theme!\" aria-haspopup=\"menu\">\
|
||||||
<img src=\"{static_root_path}brush{suffix}.svg\" \
|
<img src=\"{static_root_path}brush{suffix}.svg\" \
|
||||||
width=\"18\" \
|
width=\"18\" height=\"18\" \
|
||||||
alt=\"Pick another theme!\">\
|
alt=\"Pick another theme!\">\
|
||||||
</button>\
|
</button>\
|
||||||
<div id=\"theme-choices\" role=\"menu\"></div>\
|
<div id=\"theme-choices\" role=\"menu\"></div>\
|
||||||
|
@ -102,7 +103,7 @@ crate fn render<T: Print, S: Print>(
|
||||||
<button type=\"button\" class=\"help-button\">?</button>
|
<button type=\"button\" class=\"help-button\">?</button>
|
||||||
<a id=\"settings-menu\" href=\"{root_path}settings.html\">\
|
<a id=\"settings-menu\" href=\"{root_path}settings.html\">\
|
||||||
<img src=\"{static_root_path}wheel{suffix}.svg\" \
|
<img src=\"{static_root_path}wheel{suffix}.svg\" \
|
||||||
width=\"18\" \
|
width=\"18\" height=\"18\" \
|
||||||
alt=\"Change settings\">\
|
alt=\"Change settings\">\
|
||||||
</a>\
|
</a>\
|
||||||
</div>\
|
</div>\
|
||||||
|
@ -112,10 +113,10 @@ crate fn render<T: Print, S: Print>(
|
||||||
<section id=\"search\" class=\"content hidden\"></section>\
|
<section id=\"search\" class=\"content hidden\"></section>\
|
||||||
<section class=\"footer\"></section>\
|
<section class=\"footer\"></section>\
|
||||||
{after_content}\
|
{after_content}\
|
||||||
<div id=\"rustdoc-vars\" data-root-path=\"{root_path}\" data-current-crate=\"{krate}\"></div>
|
<div id=\"rustdoc-vars\" data-root-path=\"{root_path}\" data-current-crate=\"{krate}\" \
|
||||||
|
data-search-js=\"{root_path}search-index{suffix}.js\"></div>
|
||||||
<script src=\"{static_root_path}main{suffix}.js\"></script>\
|
<script src=\"{static_root_path}main{suffix}.js\"></script>\
|
||||||
{extra_scripts}\
|
{extra_scripts}\
|
||||||
<script defer src=\"{root_path}search-index{suffix}.js\"></script>\
|
|
||||||
</body>\
|
</body>\
|
||||||
</html>",
|
</html>",
|
||||||
css_extension = if layout.css_file_extension.is_some() {
|
css_extension = if layout.css_file_extension.is_some() {
|
||||||
|
|
|
@ -21,7 +21,6 @@ use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::lint;
|
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -721,7 +720,7 @@ impl<'tcx> ExtraInfo<'tcx> {
|
||||||
(None, None) => return,
|
(None, None) => return,
|
||||||
};
|
};
|
||||||
self.tcx.struct_span_lint_hir(
|
self.tcx.struct_span_lint_hir(
|
||||||
lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES,
|
crate::lint::INVALID_CODEBLOCK_ATTRIBUTES,
|
||||||
hir_id,
|
hir_id,
|
||||||
self.sp,
|
self.sp,
|
||||||
|lint| {
|
|lint| {
|
||||||
|
|
|
@ -1061,10 +1061,12 @@ themePicker.onblur = handleThemeButtonsBlur;
|
||||||
cx.shared.fs.write(&dst, v.as_bytes())?;
|
cx.shared.fs.write(&dst, v.as_bytes())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the search index
|
// Update the search index and crate list.
|
||||||
let dst = cx.dst.join(&format!("search-index{}.js", cx.shared.resource_suffix));
|
let dst = cx.dst.join(&format!("search-index{}.js", cx.shared.resource_suffix));
|
||||||
let (mut all_indexes, mut krates) = try_err!(collect_json(&dst, &krate.name.as_str()), &dst);
|
let (mut all_indexes, mut krates) = try_err!(collect_json(&dst, &krate.name.as_str()), &dst);
|
||||||
all_indexes.push(search_index);
|
all_indexes.push(search_index);
|
||||||
|
krates.push(krate.name.to_string());
|
||||||
|
krates.sort();
|
||||||
|
|
||||||
// Sort the indexes by crate so the file will be generated identically even
|
// Sort the indexes by crate so the file will be generated identically even
|
||||||
// with rustdoc running in parallel.
|
// with rustdoc running in parallel.
|
||||||
|
@ -1072,11 +1074,15 @@ themePicker.onblur = handleThemeButtonsBlur;
|
||||||
{
|
{
|
||||||
let mut v = String::from("var searchIndex = JSON.parse('{\\\n");
|
let mut v = String::from("var searchIndex = JSON.parse('{\\\n");
|
||||||
v.push_str(&all_indexes.join(",\\\n"));
|
v.push_str(&all_indexes.join(",\\\n"));
|
||||||
// "addSearchOptions" has to be called first so the crate filtering can be set before the
|
v.push_str("\\\n}');\ninitSearch(searchIndex);");
|
||||||
// search might start (if it's set into the URL for example).
|
|
||||||
v.push_str("\\\n}');\naddSearchOptions(searchIndex);initSearch(searchIndex);");
|
|
||||||
cx.shared.fs.write(&dst, &v)?;
|
cx.shared.fs.write(&dst, &v)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let crate_list_dst = cx.dst.join(&format!("crates{}.js", cx.shared.resource_suffix));
|
||||||
|
let crate_list =
|
||||||
|
format!("window.ALL_CRATES = [{}];", krates.iter().map(|k| format!("\"{}\"", k)).join(","));
|
||||||
|
cx.shared.fs.write(&crate_list_dst, &crate_list)?;
|
||||||
|
|
||||||
if options.enable_index_page {
|
if options.enable_index_page {
|
||||||
if let Some(index_page) = options.index_page.clone() {
|
if let Some(index_page) = options.index_page.clone() {
|
||||||
let mut md_opts = options.clone();
|
let mut md_opts = options.clone();
|
||||||
|
@ -1098,9 +1104,6 @@ themePicker.onblur = handleThemeButtonsBlur;
|
||||||
extra_scripts: &[],
|
extra_scripts: &[],
|
||||||
static_extra_scripts: &[],
|
static_extra_scripts: &[],
|
||||||
};
|
};
|
||||||
krates.push(krate.name.to_string());
|
|
||||||
krates.sort();
|
|
||||||
krates.dedup();
|
|
||||||
|
|
||||||
let content = format!(
|
let content = format!(
|
||||||
"<h1 class=\"fqn\">\
|
"<h1 class=\"fqn\">\
|
||||||
|
|
|
@ -42,6 +42,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
if (rustdocVars) {
|
if (rustdocVars) {
|
||||||
window.rootPath = rustdocVars.attributes["data-root-path"].value;
|
window.rootPath = rustdocVars.attributes["data-root-path"].value;
|
||||||
window.currentCrate = rustdocVars.attributes["data-current-crate"].value;
|
window.currentCrate = rustdocVars.attributes["data-current-crate"].value;
|
||||||
|
window.searchJS = rustdocVars.attributes["data-search-js"].value;
|
||||||
}
|
}
|
||||||
var sidebarVars = document.getElementById("sidebar-vars");
|
var sidebarVars = document.getElementById("sidebar-vars");
|
||||||
if (sidebarVars) {
|
if (sidebarVars) {
|
||||||
|
@ -1922,8 +1923,8 @@ function defocusSearchBar() {
|
||||||
return searchWords;
|
return searchWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
function startSearch() {
|
function registerSearchEvents() {
|
||||||
var callback = function() {
|
var searchAfter500ms = function() {
|
||||||
clearInputTimeout();
|
clearInputTimeout();
|
||||||
if (search_input.value.length === 0) {
|
if (search_input.value.length === 0) {
|
||||||
if (browserSupportsHistoryApi()) {
|
if (browserSupportsHistoryApi()) {
|
||||||
|
@ -1935,8 +1936,8 @@ function defocusSearchBar() {
|
||||||
searchTimeout = setTimeout(search, 500);
|
searchTimeout = setTimeout(search, 500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
search_input.onkeyup = callback;
|
search_input.onkeyup = searchAfter500ms;
|
||||||
search_input.oninput = callback;
|
search_input.oninput = searchAfter500ms;
|
||||||
document.getElementsByClassName("search-form")[0].onsubmit = function(e) {
|
document.getElementsByClassName("search-form")[0].onsubmit = function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
clearInputTimeout();
|
clearInputTimeout();
|
||||||
|
@ -1999,7 +2000,6 @@ function defocusSearchBar() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
search();
|
|
||||||
|
|
||||||
// This is required in firefox to avoid this problem: Navigating to a search result
|
// This is required in firefox to avoid this problem: Navigating to a search result
|
||||||
// with the keyboard, hitting enter, and then hitting back would take you back to
|
// with the keyboard, hitting enter, and then hitting back would take you back to
|
||||||
|
@ -2017,8 +2017,14 @@ function defocusSearchBar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
index = buildIndex(rawSearchIndex);
|
index = buildIndex(rawSearchIndex);
|
||||||
startSearch();
|
registerSearchEvents();
|
||||||
|
// If there's a search term in the URL, execute the search now.
|
||||||
|
if (getQueryStringParams().search) {
|
||||||
|
search();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function addSidebarCrates(crates) {
|
||||||
// Draw a convenient sidebar of known crates if we have a listing
|
// Draw a convenient sidebar of known crates if we have a listing
|
||||||
if (window.rootPath === "../" || window.rootPath === "./") {
|
if (window.rootPath === "../" || window.rootPath === "./") {
|
||||||
var sidebar = document.getElementsByClassName("sidebar-elems")[0];
|
var sidebar = document.getElementsByClassName("sidebar-elems")[0];
|
||||||
|
@ -2029,14 +2035,6 @@ function defocusSearchBar() {
|
||||||
var ul = document.createElement("ul");
|
var ul = document.createElement("ul");
|
||||||
div.appendChild(ul);
|
div.appendChild(ul);
|
||||||
|
|
||||||
var crates = [];
|
|
||||||
for (var crate in rawSearchIndex) {
|
|
||||||
if (!hasOwnProperty(rawSearchIndex, crate)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
crates.push(crate);
|
|
||||||
}
|
|
||||||
crates.sort();
|
|
||||||
for (var i = 0; i < crates.length; ++i) {
|
for (var i = 0; i < crates.length; ++i) {
|
||||||
var klass = "crate";
|
var klass = "crate";
|
||||||
if (window.rootPath !== "./" && crates[i] === window.currentCrate) {
|
if (window.rootPath !== "./" && crates[i] === window.currentCrate) {
|
||||||
|
@ -2044,9 +2042,6 @@ function defocusSearchBar() {
|
||||||
}
|
}
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.href = window.rootPath + crates[i] + "/index.html";
|
link.href = window.rootPath + crates[i] + "/index.html";
|
||||||
// The summary in the search index has HTML, so we need to
|
|
||||||
// dynamically render it as plaintext.
|
|
||||||
link.title = convertHTMLToPlaintext(rawSearchIndex[crates[i]].doc);
|
|
||||||
link.className = klass;
|
link.className = klass;
|
||||||
link.textContent = crates[i];
|
link.textContent = crates[i];
|
||||||
|
|
||||||
|
@ -2057,7 +2052,7 @@ function defocusSearchBar() {
|
||||||
sidebar.appendChild(div);
|
sidebar.appendChild(div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert HTML to plaintext:
|
* Convert HTML to plaintext:
|
||||||
|
@ -2862,37 +2857,18 @@ function defocusSearchBar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addSearchOptions = function(crates) {
|
function addSearchOptions(crates) {
|
||||||
var elem = document.getElementById("crate-search");
|
var elem = document.getElementById("crate-search");
|
||||||
|
|
||||||
if (!elem) {
|
if (!elem) {
|
||||||
enableSearchInput();
|
enableSearchInput();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var crates_text = [];
|
|
||||||
if (Object.keys(crates).length > 1) {
|
|
||||||
for (var crate in crates) {
|
|
||||||
if (hasOwnProperty(crates, crate)) {
|
|
||||||
crates_text.push(crate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
crates_text.sort(function(a, b) {
|
|
||||||
var lower_a = a.toLowerCase();
|
|
||||||
var lower_b = b.toLowerCase();
|
|
||||||
|
|
||||||
if (lower_a < lower_b) {
|
|
||||||
return -1;
|
|
||||||
} else if (lower_a > lower_b) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
var savedCrate = getSettingValue("saved-filter-crate");
|
var savedCrate = getSettingValue("saved-filter-crate");
|
||||||
for (var i = 0, len = crates_text.length; i < len; ++i) {
|
for (var i = 0, len = crates.length; i < len; ++i) {
|
||||||
var option = document.createElement("option");
|
var option = document.createElement("option");
|
||||||
option.value = crates_text[i];
|
option.value = crates[i];
|
||||||
option.innerText = crates_text[i];
|
option.innerText = crates[i];
|
||||||
elem.appendChild(option);
|
elem.appendChild(option);
|
||||||
// Set the crate filter from saved storage, if the current page has the saved crate
|
// Set the crate filter from saved storage, if the current page has the saved crate
|
||||||
// filter.
|
// filter.
|
||||||
|
@ -2900,7 +2876,7 @@ function defocusSearchBar() {
|
||||||
// If not, ignore the crate filter -- we want to support filtering for crates on sites
|
// If not, ignore the crate filter -- we want to support filtering for crates on sites
|
||||||
// like doc.rust-lang.org where the crates may differ from page to page while on the
|
// like doc.rust-lang.org where the crates may differ from page to page while on the
|
||||||
// same domain.
|
// same domain.
|
||||||
if (crates_text[i] === savedCrate) {
|
if (crates[i] === savedCrate) {
|
||||||
elem.value = savedCrate;
|
elem.value = savedCrate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2969,6 +2945,44 @@ function defocusSearchBar() {
|
||||||
buildHelperPopup = function() {};
|
buildHelperPopup = function() {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadScript(url) {
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.src = url;
|
||||||
|
document.head.append(script);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupSearchLoader() {
|
||||||
|
var searchLoaded = false;
|
||||||
|
function loadSearch() {
|
||||||
|
if (!searchLoaded) {
|
||||||
|
searchLoaded = true;
|
||||||
|
loadScript(window.searchJS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// `crates{version}.js` should always be loaded before this script, so we can use it safely.
|
||||||
|
addSearchOptions(window.ALL_CRATES);
|
||||||
|
addSidebarCrates(window.ALL_CRATES);
|
||||||
|
|
||||||
|
search_input.addEventListener("focus", function() {
|
||||||
|
search_input.origPlaceholder = search_input.placeholder;
|
||||||
|
search_input.placeholder = "Type your search here.";
|
||||||
|
loadSearch();
|
||||||
|
});
|
||||||
|
search_input.addEventListener("blur", function() {
|
||||||
|
search_input.placeholder = search_input.origPlaceholder;
|
||||||
|
});
|
||||||
|
enableSearchInput();
|
||||||
|
|
||||||
|
var crateSearchDropDown = document.getElementById("crate-search");
|
||||||
|
crateSearchDropDown.addEventListener("focus", loadSearch);
|
||||||
|
var params = getQueryStringParams();
|
||||||
|
if (params.search !== undefined) {
|
||||||
|
loadSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onHashChange(null);
|
onHashChange(null);
|
||||||
window.onhashchange = onHashChange;
|
window.onhashchange = onHashChange;
|
||||||
|
setupSearchLoader();
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
src: local('Fira Sans'),
|
src: local('Fira Sans'),
|
||||||
url("FiraSans-Regular.woff2") format("woff2"),
|
url("FiraSans-Regular.woff2") format("woff2"),
|
||||||
url("FiraSans-Regular.woff") format('woff');
|
url("FiraSans-Regular.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Fira Sans';
|
font-family: 'Fira Sans';
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
src: local('Fira Sans Medium'),
|
src: local('Fira Sans Medium'),
|
||||||
url("FiraSans-Medium.woff2") format("woff2"),
|
url("FiraSans-Medium.woff2") format("woff2"),
|
||||||
url("FiraSans-Medium.woff") format('woff');
|
url("FiraSans-Medium.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See SourceSerifPro-LICENSE.txt for the Source Serif Pro license. */
|
/* See SourceSerifPro-LICENSE.txt for the Source Serif Pro license. */
|
||||||
|
@ -22,18 +24,21 @@
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Source Serif Pro Italic'), url("SourceSerifPro-It.ttf.woff") format('woff');
|
src: local('Source Serif Pro Italic'), url("SourceSerifPro-It.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Serif Pro';
|
font-family: 'Source Serif Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.ttf.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
|
/* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
|
||||||
|
@ -44,12 +49,14 @@
|
||||||
/* Avoid using locally installed font because bad versions are in circulation:
|
/* Avoid using locally installed font because bad versions are in circulation:
|
||||||
* see https://github.com/rust-lang/rust/issues/24355 */
|
* see https://github.com/rust-lang/rust/issues/24355 */
|
||||||
src: url("SourceCodePro-Regular.woff") format('woff');
|
src: url("SourceCodePro-Regular.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Source Code Pro';
|
font-family: 'Source Code Pro';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
src: url("SourceCodePro-Semibold.woff") format('woff');
|
src: url("SourceCodePro-Semibold.woff") format('woff');
|
||||||
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
@ -129,7 +136,7 @@ h1, h2, h3, h4,
|
||||||
#source-sidebar, #sidebar-toggle,
|
#source-sidebar, #sidebar-toggle,
|
||||||
/* This selector is for the items listed in the "all items" page. */
|
/* This selector is for the items listed in the "all items" page. */
|
||||||
#main > ul.docblock > li > a {
|
#main > ul.docblock > li > a {
|
||||||
font-family: "Fira Sans", sans-serif;
|
font-family: "Fira Sans", Arial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content ul.crate a.crate {
|
.content ul.crate a.crate {
|
||||||
|
@ -475,7 +482,7 @@ h4 > code, h3 > code, .invisible > code {
|
||||||
}
|
}
|
||||||
#main > .since {
|
#main > .since {
|
||||||
top: inherit;
|
top: inherit;
|
||||||
font-family: "Fira Sans", sans-serif;
|
font-family: "Fira Sans", Arial;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content table:not(.table-display) {
|
.content table:not(.table-display) {
|
||||||
|
@ -684,6 +691,7 @@ a {
|
||||||
width: calc(100% - 63px);
|
width: calc(100% - 63px);
|
||||||
}
|
}
|
||||||
#crate-search {
|
#crate-search {
|
||||||
|
min-width: 115px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
padding-right: 19px;
|
padding-right: 19px;
|
||||||
|
@ -1293,7 +1301,7 @@ h4 > .notable-traits {
|
||||||
|
|
||||||
.help-button {
|
.help-button {
|
||||||
right: 30px;
|
right: 30px;
|
||||||
font-family: "Fira Sans",sans-serif;
|
font-family: "Fira Sans", Arial;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ extern crate rustc_infer;
|
||||||
extern crate rustc_interface;
|
extern crate rustc_interface;
|
||||||
extern crate rustc_lexer;
|
extern crate rustc_lexer;
|
||||||
extern crate rustc_lint;
|
extern crate rustc_lint;
|
||||||
|
extern crate rustc_lint_defs;
|
||||||
extern crate rustc_metadata;
|
extern crate rustc_metadata;
|
||||||
extern crate rustc_middle;
|
extern crate rustc_middle;
|
||||||
extern crate rustc_mir;
|
extern crate rustc_mir;
|
||||||
|
@ -86,6 +87,7 @@ mod formats;
|
||||||
// used by the error-index generator, so it needs to be public
|
// used by the error-index generator, so it needs to be public
|
||||||
pub mod html;
|
pub mod html;
|
||||||
mod json;
|
mod json;
|
||||||
|
crate mod lint;
|
||||||
mod markdown;
|
mod markdown;
|
||||||
mod passes;
|
mod passes;
|
||||||
mod theme;
|
mod theme;
|
||||||
|
|
188
src/librustdoc/lint.rs
Normal file
188
src/librustdoc/lint.rs
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
|
use rustc_lint::LintStore;
|
||||||
|
use rustc_lint_defs::{declare_tool_lint, Lint, LintId};
|
||||||
|
use rustc_session::{lint, Session};
|
||||||
|
|
||||||
|
use std::lazy::SyncLazy as Lazy;
|
||||||
|
|
||||||
|
/// This function is used to setup the lint initialization. By default, in rustdoc, everything
|
||||||
|
/// is "allowed". Depending if we run in test mode or not, we want some of them to be at their
|
||||||
|
/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTES" lint is activated in both
|
||||||
|
/// modes.
|
||||||
|
///
|
||||||
|
/// A little detail easy to forget is that there is a way to set the lint level for all lints
|
||||||
|
/// through the "WARNINGS" lint. To prevent this to happen, we set it back to its "normal" level
|
||||||
|
/// inside this function.
|
||||||
|
///
|
||||||
|
/// It returns a tuple containing:
|
||||||
|
/// * Vector of tuples of lints' name and their associated "max" level
|
||||||
|
/// * HashMap of lint id with their associated "max" level
|
||||||
|
pub(crate) fn init_lints<F>(
|
||||||
|
mut allowed_lints: Vec<String>,
|
||||||
|
lint_opts: Vec<(String, lint::Level)>,
|
||||||
|
filter_call: F,
|
||||||
|
) -> (Vec<(String, lint::Level)>, FxHashMap<lint::LintId, lint::Level>)
|
||||||
|
where
|
||||||
|
F: Fn(&lint::Lint) -> Option<(String, lint::Level)>,
|
||||||
|
{
|
||||||
|
let warnings_lint_name = lint::builtin::WARNINGS.name;
|
||||||
|
|
||||||
|
allowed_lints.push(warnings_lint_name.to_owned());
|
||||||
|
allowed_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned());
|
||||||
|
|
||||||
|
let lints = || {
|
||||||
|
lint::builtin::HardwiredLints::get_lints()
|
||||||
|
.into_iter()
|
||||||
|
.chain(rustc_lint::SoftLints::get_lints().into_iter())
|
||||||
|
};
|
||||||
|
|
||||||
|
let lint_opts = lints()
|
||||||
|
.filter_map(|lint| {
|
||||||
|
// Permit feature-gated lints to avoid feature errors when trying to
|
||||||
|
// allow all lints.
|
||||||
|
if lint.feature_gate.is_some() || allowed_lints.iter().any(|l| lint.name == l) {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
filter_call(lint)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.chain(lint_opts.into_iter())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let lint_caps = lints()
|
||||||
|
.filter_map(|lint| {
|
||||||
|
// We don't want to allow *all* lints so let's ignore
|
||||||
|
// those ones.
|
||||||
|
if allowed_lints.iter().any(|l| lint.name == l) {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some((lint::LintId::of(lint), lint::Allow))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
(lint_opts, lint_caps)
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! declare_rustdoc_lint {
|
||||||
|
($(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?) => {
|
||||||
|
declare_tool_lint! {
|
||||||
|
$(#[$attr])* pub rustdoc::$name, $level, $descr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `broken_intra_doc_links` lint detects failures in resolving
|
||||||
|
/// intra-doc link targets. This is a `rustdoc` only lint, see the
|
||||||
|
/// documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#broken_intra_doc_links
|
||||||
|
BROKEN_INTRA_DOC_LINKS,
|
||||||
|
Warn,
|
||||||
|
"failures in resolving intra-doc link targets"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// This is a subset of `broken_intra_doc_links` that warns when linking from
|
||||||
|
/// a public item to a private one. This is a `rustdoc` only lint, see the
|
||||||
|
/// documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#private_intra_doc_links
|
||||||
|
PRIVATE_INTRA_DOC_LINKS,
|
||||||
|
Warn,
|
||||||
|
"linking from a public item to a private one"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `invalid_codeblock_attributes` lint detects code block attributes
|
||||||
|
/// in documentation examples that have potentially mis-typed values. This
|
||||||
|
/// is a `rustdoc` only lint, see the documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_codeblock_attributes
|
||||||
|
INVALID_CODEBLOCK_ATTRIBUTES,
|
||||||
|
Warn,
|
||||||
|
"codeblock attribute looks a lot like a known one"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `missing_crate_level_docs` lint detects if documentation is
|
||||||
|
/// missing at the crate root. This is a `rustdoc` only lint, see the
|
||||||
|
/// documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#missing_crate_level_docs
|
||||||
|
MISSING_CRATE_LEVEL_DOCS,
|
||||||
|
Allow,
|
||||||
|
"detects crates with no crate-level documentation"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `missing_doc_code_examples` lint detects publicly-exported items
|
||||||
|
/// without code samples in their documentation. This is a `rustdoc` only
|
||||||
|
/// lint, see the documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#missing_doc_code_examples
|
||||||
|
MISSING_DOC_CODE_EXAMPLES,
|
||||||
|
Allow,
|
||||||
|
"detects publicly-exported items without code samples in their documentation"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `private_doc_tests` lint detects code samples in docs of private
|
||||||
|
/// items not documented by `rustdoc`. This is a `rustdoc` only lint, see
|
||||||
|
/// the documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#private_doc_tests
|
||||||
|
PRIVATE_DOC_TESTS,
|
||||||
|
Allow,
|
||||||
|
"detects code samples in docs of private items not documented by rustdoc"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `invalid_html_tags` lint detects invalid HTML tags. This is a
|
||||||
|
/// `rustdoc` only lint, see the documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#invalid_html_tags
|
||||||
|
INVALID_HTML_TAGS,
|
||||||
|
Allow,
|
||||||
|
"detects invalid HTML tags in doc comments"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_rustdoc_lint! {
|
||||||
|
/// The `non_autolinks` lint detects when a URL could be written using
|
||||||
|
/// only angle brackets. This is a `rustdoc` only lint, see the
|
||||||
|
/// documentation in the [rustdoc book].
|
||||||
|
///
|
||||||
|
/// [rustdoc book]: ../../../rustdoc/lints.html#non_autolinks
|
||||||
|
NON_AUTOLINKS,
|
||||||
|
Warn,
|
||||||
|
"detects URLs that could be written using only angle brackets"
|
||||||
|
}
|
||||||
|
|
||||||
|
crate static RUSTDOC_LINTS: Lazy<Vec<&'static Lint>> = Lazy::new(|| {
|
||||||
|
vec![
|
||||||
|
BROKEN_INTRA_DOC_LINKS,
|
||||||
|
PRIVATE_INTRA_DOC_LINKS,
|
||||||
|
MISSING_DOC_CODE_EXAMPLES,
|
||||||
|
PRIVATE_DOC_TESTS,
|
||||||
|
INVALID_CODEBLOCK_ATTRIBUTES,
|
||||||
|
INVALID_HTML_TAGS,
|
||||||
|
NON_AUTOLINKS,
|
||||||
|
MISSING_CRATE_LEVEL_DOCS,
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
crate fn register_lints(_sess: &Session, lint_store: &mut LintStore) {
|
||||||
|
lint_store.register_lints(&**RUSTDOC_LINTS);
|
||||||
|
lint_store.register_group(
|
||||||
|
true,
|
||||||
|
"rustdoc",
|
||||||
|
None,
|
||||||
|
RUSTDOC_LINTS.iter().map(|&lint| LintId::of(lint)).collect(),
|
||||||
|
);
|
||||||
|
for lint in &*RUSTDOC_LINTS {
|
||||||
|
let name = lint.name_lower();
|
||||||
|
lint_store.register_renamed(&name.replace("rustdoc::", ""), &name);
|
||||||
|
}
|
||||||
|
lint_store
|
||||||
|
.register_renamed("intra_doc_link_resolution_failure", "rustdoc::broken_intra_doc_links");
|
||||||
|
}
|
|
@ -16,10 +16,7 @@ use rustc_hir::def_id::{CrateNum, DefId};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_middle::{bug, ty};
|
use rustc_middle::{bug, ty};
|
||||||
use rustc_resolve::ParentScope;
|
use rustc_resolve::ParentScope;
|
||||||
use rustc_session::lint::{
|
use rustc_session::lint::Lint;
|
||||||
builtin::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS},
|
|
||||||
Lint,
|
|
||||||
};
|
|
||||||
use rustc_span::hygiene::{MacroKind, SyntaxContext};
|
use rustc_span::hygiene::{MacroKind, SyntaxContext};
|
||||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||||
use rustc_span::DUMMY_SP;
|
use rustc_span::DUMMY_SP;
|
||||||
|
@ -37,6 +34,7 @@ use crate::clean::{self, utils::find_nearest_parent_module, Crate, Item, ItemLin
|
||||||
use crate::core::DocContext;
|
use crate::core::DocContext;
|
||||||
use crate::fold::DocFolder;
|
use crate::fold::DocFolder;
|
||||||
use crate::html::markdown::{markdown_links, MarkdownLink};
|
use crate::html::markdown::{markdown_links, MarkdownLink};
|
||||||
|
use crate::lint::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS};
|
||||||
use crate::passes::Pass;
|
use crate::passes::Pass;
|
||||||
|
|
||||||
use super::span_of_attrs;
|
use super::span_of_attrs;
|
||||||
|
|
|
@ -68,8 +68,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_local());
|
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_local());
|
||||||
let (level, source) =
|
let (level, source) = cx.tcx.lint_level_at_node(crate::lint::MISSING_DOC_CODE_EXAMPLES, hir_id);
|
||||||
cx.tcx.lint_level_at_node(lint::builtin::MISSING_DOC_CODE_EXAMPLES, hir_id);
|
|
||||||
level != lint::Level::Allow || matches!(source, LintLevelSource::Default)
|
level != lint::Level::Allow || matches!(source, LintLevelSource::Default)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ crate fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
|
||||||
debug!("reporting error for {:?} (hir_id={:?})", item, hir_id);
|
debug!("reporting error for {:?} (hir_id={:?})", item, hir_id);
|
||||||
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
|
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
|
||||||
cx.tcx.struct_span_lint_hir(
|
cx.tcx.struct_span_lint_hir(
|
||||||
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
|
crate::lint::MISSING_DOC_CODE_EXAMPLES,
|
||||||
hir_id,
|
hir_id,
|
||||||
sp,
|
sp,
|
||||||
|lint| lint.build("missing code example in this documentation").emit(),
|
|lint| lint.build("missing code example in this documentation").emit(),
|
||||||
|
@ -99,7 +98,7 @@ crate fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
|
||||||
}
|
}
|
||||||
} else if tests.found_tests > 0 && !cx.cache.access_levels.is_public(item.def_id) {
|
} else if tests.found_tests > 0 && !cx.cache.access_levels.is_public(item.def_id) {
|
||||||
cx.tcx.struct_span_lint_hir(
|
cx.tcx.struct_span_lint_hir(
|
||||||
lint::builtin::PRIVATE_DOC_TESTS,
|
crate::lint::PRIVATE_DOC_TESTS,
|
||||||
hir_id,
|
hir_id,
|
||||||
span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
|
span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
|
||||||
|lint| lint.build("documentation test in private item").emit(),
|
|lint| lint.build("documentation test in private item").emit(),
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crate::fold::DocFolder;
|
||||||
use crate::html::markdown::opts;
|
use crate::html::markdown::opts;
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
use pulldown_cmark::{Event, Parser, Tag};
|
use pulldown_cmark::{Event, Parser, Tag};
|
||||||
use rustc_session::lint;
|
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::str::CharIndices;
|
use std::str::CharIndices;
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ impl<'a, 'tcx> DocFolder for InvalidHtmlTagsLinter<'a, 'tcx> {
|
||||||
Some(sp) => sp,
|
Some(sp) => sp,
|
||||||
None => span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
|
None => span_of_attrs(&item.attrs).unwrap_or(item.source.span()),
|
||||||
};
|
};
|
||||||
cx.tcx.struct_span_lint_hir(lint::builtin::INVALID_HTML_TAGS, hir_id, sp, |lint| {
|
cx.tcx.struct_span_lint_hir(crate::lint::INVALID_HTML_TAGS, hir_id, sp, |lint| {
|
||||||
lint.build(msg).emit()
|
lint.build(msg).emit()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,6 @@ use core::ops::Range;
|
||||||
use pulldown_cmark::{Event, LinkType, Parser, Tag};
|
use pulldown_cmark::{Event, LinkType, Parser, Tag};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_session::lint;
|
|
||||||
|
|
||||||
crate const CHECK_NON_AUTOLINKS: Pass = Pass {
|
crate const CHECK_NON_AUTOLINKS: Pass = Pass {
|
||||||
name: "check-non-autolinks",
|
name: "check-non-autolinks",
|
||||||
|
@ -74,7 +73,7 @@ impl<'a, 'tcx> DocFolder for NonAutolinksLinter<'a, 'tcx> {
|
||||||
let sp = super::source_span_for_markdown_range(cx, &dox, &range, &item.attrs)
|
let sp = super::source_span_for_markdown_range(cx, &dox, &range, &item.attrs)
|
||||||
.or_else(|| span_of_attrs(&item.attrs))
|
.or_else(|| span_of_attrs(&item.attrs))
|
||||||
.unwrap_or(item.source.span());
|
.unwrap_or(item.source.span());
|
||||||
cx.tcx.struct_span_lint_hir(lint::builtin::NON_AUTOLINKS, hir_id, sp, |lint| {
|
cx.tcx.struct_span_lint_hir(crate::lint::NON_AUTOLINKS, hir_id, sp, |lint| {
|
||||||
lint.build(msg)
|
lint.build(msg)
|
||||||
.span_suggestion(
|
.span_suggestion(
|
||||||
sp,
|
sp,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
/// Link to [`S::fmt`]
|
/// Link to [`S::fmt`]
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// Link to [`S::fmt`]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/assoc-item-not-in-scope.rs:1:9
|
--> $DIR/assoc-item-not-in-scope.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// compile-flags:--test
|
// compile-flags:--test
|
||||||
|
|
||||||
#![deny(invalid_codeblock_attributes)]
|
#![deny(rustdoc::invalid_codeblock_attributes)]
|
||||||
|
|
||||||
/// foo
|
/// foo
|
||||||
///
|
///
|
||||||
|
|
|
@ -11,8 +11,8 @@ error: unknown attribute `compile-fail`. Did you mean `compile_fail`?
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/check-attr-test.rs:3:9
|
--> $DIR/check-attr-test.rs:3:9
|
||||||
|
|
|
|
||||||
3 | #![deny(invalid_codeblock_attributes)]
|
3 | #![deny(rustdoc::invalid_codeblock_attributes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
|
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
|
||||||
|
|
||||||
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
|
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(invalid_codeblock_attributes)]
|
#![deny(rustdoc::invalid_codeblock_attributes)]
|
||||||
|
|
||||||
/// foo
|
/// foo
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
|
|
|
@ -13,8 +13,8 @@ LL | | /// ```
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/check-attr.rs:1:9
|
--> $DIR/check-attr.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(invalid_codeblock_attributes)]
|
LL | #![deny(rustdoc::invalid_codeblock_attributes)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
|
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
|
||||||
|
|
||||||
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
|
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
|
||||||
|
|
|
@ -21,7 +21,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
|
||||||
|
|
||||||
error: unknown attribute `testharness`. Did you mean `test_harness`?
|
error: unknown attribute `testharness`. Did you mean `test_harness`?
|
||||||
--> $DIR/check-fail.rs:6:1
|
--> $DIR/check-fail.rs:6:1
|
||||||
|
@ -37,7 +37,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(invalid_codeblock_attributes)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc)]`
|
||||||
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
|
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
|
||||||
|
|
||||||
error: unknown attribute `testharness`. Did you mean `test_harness`?
|
error: unknown attribute `testharness`. Did you mean `test_harness`?
|
||||||
|
|
|
@ -21,6 +21,17 @@ warning: missing documentation for a function
|
||||||
LL | pub fn foo() {}
|
LL | pub fn foo() {}
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
warning: no documentation found for this crate's top-level module
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/check.rs:7:9
|
||||||
|
|
|
||||||
|
LL | #![warn(rustdoc)]
|
||||||
|
| ^^^^^^^
|
||||||
|
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc)]`
|
||||||
|
= help: The following guide may be of use:
|
||||||
|
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
|
||||||
|
|
||||||
warning: missing code example in this documentation
|
warning: missing code example in this documentation
|
||||||
--> $DIR/check.rs:4:1
|
--> $DIR/check.rs:4:1
|
||||||
|
|
|
|
||||||
|
@ -37,7 +48,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![warn(rustdoc)]
|
LL | #![warn(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[warn(missing_doc_code_examples)]` implied by `#[warn(rustdoc)]`
|
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc)]`
|
||||||
|
|
||||||
warning: missing code example in this documentation
|
warning: missing code example in this documentation
|
||||||
--> $DIR/check.rs:9:1
|
--> $DIR/check.rs:9:1
|
||||||
|
@ -45,5 +56,5 @@ warning: missing code example in this documentation
|
||||||
LL | pub fn foo() {}
|
LL | pub fn foo() {}
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: 4 warnings emitted
|
warning: 5 warnings emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
/// [v2] //~ ERROR
|
/// [v2] //~ ERROR
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [v2]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/deny-intra-link-resolution-failure.rs:1:9
|
--> $DIR/deny-intra-link-resolution-failure.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(missing_doc_code_examples)] //~ ERROR missing code example in this documentation
|
#![deny(rustdoc::missing_doc_code_examples)] //~ ERROR missing code example in this documentation
|
||||||
|
|
||||||
/// Some docs.
|
/// Some docs.
|
||||||
//~^ ERROR missing code example in this documentation
|
//~^ ERROR missing code example in this documentation
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error: missing code example in this documentation
|
error: missing code example in this documentation
|
||||||
--> $DIR/doc-without-codeblock.rs:1:1
|
--> $DIR/doc-without-codeblock.rs:1:1
|
||||||
|
|
|
|
||||||
LL | / #![deny(missing_doc_code_examples)]
|
LL | / #![deny(rustdoc::missing_doc_code_examples)]
|
||||||
LL | |
|
LL | |
|
||||||
LL | | /// Some docs.
|
LL | | /// Some docs.
|
||||||
LL | |
|
LL | |
|
||||||
|
@ -13,8 +13,8 @@ LL | | }
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/doc-without-codeblock.rs:1:9
|
--> $DIR/doc-without-codeblock.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(missing_doc_code_examples)]
|
LL | #![deny(rustdoc::missing_doc_code_examples)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing code example in this documentation
|
error: missing code example in this documentation
|
||||||
--> $DIR/doc-without-codeblock.rs:7:1
|
--> $DIR/doc-without-codeblock.rs:7:1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
pub type TypeAlias = usize;
|
pub type TypeAlias = usize;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [broken cross-reference](TypeAlias::hoge)
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/alias-ice.rs:1:9
|
--> $DIR/alias-ice.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [true]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/ambiguity.rs:1:9
|
--> $DIR/ambiguity.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
help: to link to the module, prefix with `mod@`
|
help: to link to the module, prefix with `mod@`
|
||||||
|
|
|
|
||||||
LL | /// [mod@true]
|
LL | /// [mod@true]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
// A few tests on anchors.
|
// A few tests on anchors.
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// Or maybe [Foo::f#hola].
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/anchors.rs:1:9
|
--> $DIR/anchors.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `hello#people#!` contains multiple anchors
|
error: `hello#people#!` contains multiple anchors
|
||||||
--> $DIR/anchors.rs:31:28
|
--> $DIR/anchors.rs:31:28
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// aux-build:intra-doc-broken.rs
|
// aux-build:intra-doc-broken.rs
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
extern crate intra_doc_broken;
|
extern crate intra_doc_broken;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//~^ NOTE lint level is defined
|
//~^ NOTE lint level is defined
|
||||||
pub enum S {}
|
pub enum S {}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// Link to [struct@S]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/disambiguator-mismatch.rs:1:9
|
--> $DIR/disambiguator-mismatch.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: this link resolved to an enum, which is not a struct
|
= note: this link resolved to an enum, which is not a struct
|
||||||
|
|
||||||
error: incompatible link kind for `S`
|
error: incompatible link kind for `S`
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: `with#anchor#error` contains multiple anchors
|
||||||
LL | /// docs [label][with#anchor#error]
|
LL | /// docs [label][with#anchor#error]
|
||||||
| ^^^^^^^^^^^^^^^^^ contains invalid anchor
|
| ^^^^^^^^^^^^^^^^^ contains invalid anchor
|
||||||
|
|
|
|
||||||
= note: `#[warn(broken_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//~^ NOTE lint level is defined
|
//~^ NOTE lint level is defined
|
||||||
|
|
||||||
// FIXME: this should say that it was skipped (maybe an allowed by default lint?)
|
// FIXME: this should say that it was skipped (maybe an allowed by default lint?)
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [path::to::nonexistent::module]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/errors.rs:1:9
|
--> $DIR/errors.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unresolved link to `path::to::nonexistent::macro`
|
error: unresolved link to `path::to::nonexistent::macro`
|
||||||
--> $DIR/errors.rs:11:6
|
--> $DIR/errors.rs:11:6
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//! [static@u8::MIN]
|
//! [static@u8::MIN]
|
||||||
//~^ ERROR incompatible link kind
|
//~^ ERROR incompatible link kind
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | //! [static@u8::MIN]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/incompatible-primitive-disambiguator.rs:1:9
|
--> $DIR/incompatible-primitive-disambiguator.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: this link resolved to an associated constant, which is not a static
|
= note: this link resolved to an associated constant, which is not a static
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
//! [Vec<] //~ ERROR
|
//! [Vec<] //~ ERROR
|
||||||
//! [Vec<Box<T] //~ ERROR
|
//! [Vec<Box<T] //~ ERROR
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | //! [Vec<]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/malformed-generics.rs:1:9
|
--> $DIR/malformed-generics.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unresolved link to `Vec<Box<T`
|
error: unresolved link to `Vec<Box<T`
|
||||||
--> $DIR/malformed-generics.rs:4:6
|
--> $DIR/malformed-generics.rs:4:6
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
#![feature(intra_doc_pointers)]
|
#![feature(intra_doc_pointers)]
|
||||||
// These are links that could reasonably expected to work, but don't.
|
// These are links that could reasonably expected to work, but don't.
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | //! [[T]::rotate_left]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/non-path-primitives.rs:1:9
|
--> $DIR/non-path-primitives.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: unresolved link to `Z`
|
error: unresolved link to `Z`
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//~^ NOTE lint level is defined
|
//~^ NOTE lint level is defined
|
||||||
|
|
||||||
/// [char]
|
/// [char]
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [char]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/prim-conflict.rs:1:9
|
--> $DIR/prim-conflict.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
help: to link to the module, prefix with `mod@`
|
help: to link to the module, prefix with `mod@`
|
||||||
|
|
|
|
||||||
LL | /// [mod@char]
|
LL | /// [mod@char]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: public documentation for `DocMe` links to private item `DontDocMe`
|
||||||
LL | /// docs [DontDocMe] [DontDocMe::f]
|
LL | /// docs [DontDocMe] [DontDocMe::f]
|
||||||
| ^^^^^^^^^ this item is private
|
| ^^^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
||||||
|
|
||||||
warning: public documentation for `DocMe` links to private item `DontDocMe::f`
|
warning: public documentation for `DocMe` links to private item `DontDocMe::f`
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: public documentation for `DocMe` links to private item `DontDocMe`
|
||||||
LL | /// docs [DontDocMe] [DontDocMe::f]
|
LL | /// docs [DontDocMe] [DontDocMe::f]
|
||||||
| ^^^^^^^^^ this item is private
|
| ^^^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link will resolve properly if you pass `--document-private-items`
|
= note: this link will resolve properly if you pass `--document-private-items`
|
||||||
|
|
||||||
warning: public documentation for `DocMe` links to private item `DontDocMe::f`
|
warning: public documentation for `DocMe` links to private item `DontDocMe::f`
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
// An error in calculating spans while reporting intra-doc link resolution errors caused rustdoc to
|
// An error in calculating spans while reporting intra-doc link resolution errors caused rustdoc to
|
||||||
// attempt to slice in the middle of a multibyte character. See
|
// attempt to slice in the middle of a multibyte character. See
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// (arr[i])
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/span-ice-55723.rs:1:9
|
--> $DIR/span-ice-55723.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// compile-flags: --extern zip=whatever.rlib
|
// compile-flags: --extern zip=whatever.rlib
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
/// See [zip] crate.
|
/// See [zip] crate.
|
||||||
//~^ ERROR unresolved
|
//~^ ERROR unresolved
|
||||||
pub struct ArrayZip;
|
pub struct ArrayZip;
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// See [zip] crate.
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/unused-extern-crate.rs:2:9
|
--> $DIR/unused-extern-crate.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: unresolved link to `error`
|
||||||
LL | /// [error]
|
LL | /// [error]
|
||||||
| ^^^^^ no item named `error` in scope
|
| ^^^^^ no item named `error` in scope
|
||||||
|
|
|
|
||||||
= note: `#[warn(broken_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
warning: unresolved link to `error1`
|
warning: unresolved link to `error1`
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: unresolved link to `Foo::baz`
|
||||||
LL | //! Test with [Foo::baz], [Bar::foo], ...
|
LL | //! Test with [Foo::baz], [Bar::foo], ...
|
||||||
| ^^^^^^^^ the struct `Foo` has no field or associated item named `baz`
|
| ^^^^^^^^ the struct `Foo` has no field or associated item named `baz`
|
||||||
|
|
|
|
||||||
= note: `#[warn(broken_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||||
|
|
||||||
warning: unresolved link to `Bar::foo`
|
warning: unresolved link to `Bar::foo`
|
||||||
--> $DIR/warning.rs:3:35
|
--> $DIR/warning.rs:3:35
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(invalid_html_tags)]
|
#![deny(rustdoc::invalid_html_tags)]
|
||||||
|
|
||||||
//! <p>💩<p>
|
//! <p>💩<p>
|
||||||
//~^ ERROR unclosed HTML tag `p`
|
//~^ ERROR unclosed HTML tag `p`
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | //! <p>💩<p>
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/invalid-html-tags.rs:1:9
|
--> $DIR/invalid-html-tags.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(invalid_html_tags)]
|
LL | #![deny(rustdoc::invalid_html_tags)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unclosed HTML tag `p`
|
error: unclosed HTML tag `p`
|
||||||
--> $DIR/invalid-html-tags.rs:3:9
|
--> $DIR/invalid-html-tags.rs:3:9
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![deny(private_doc_tests)]
|
#![deny(rustdoc::private_doc_tests)]
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: public documentation for `public_item` links to private item `PrivateTy
|
||||||
LL | /// [`PrivateType`]
|
LL | /// [`PrivateType`]
|
||||||
| ^^^^^^^^^^^^^ this item is private
|
| ^^^^^^^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
= note: this link resolves only because you passed `--document-private-items`, but will break without
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: public documentation for `public_item` links to private item `PrivateTy
|
||||||
LL | /// [`PrivateType`]
|
LL | /// [`PrivateType`]
|
||||||
| ^^^^^^^^^^^^^ this item is private
|
| ^^^^^^^^^^^^^ this item is private
|
||||||
|
|
|
|
||||||
= note: `#[warn(private_intra_doc_links)]` on by default
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
|
||||||
= note: this link will resolve properly if you pass `--document-private-items`
|
= note: this link will resolve properly if you pass `--document-private-items`
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
|
@ -9,7 +9,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
|
||||||
|
|
||||||
error: documentation test in private item
|
error: documentation test in private item
|
||||||
--> $DIR/lint-group.rs:19:1
|
--> $DIR/lint-group.rs:19:1
|
||||||
|
@ -26,7 +26,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(private_doc_tests)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc)]`
|
||||||
|
|
||||||
error: missing code example in this documentation
|
error: missing code example in this documentation
|
||||||
--> $DIR/lint-group.rs:26:1
|
--> $DIR/lint-group.rs:26:1
|
||||||
|
@ -45,7 +45,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: unclosed HTML tag `unknown`
|
error: unclosed HTML tag `unknown`
|
||||||
|
@ -59,7 +59,7 @@ note: the lint level is defined here
|
||||||
|
|
|
|
||||||
LL | #![deny(rustdoc)]
|
LL | #![deny(rustdoc)]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
= note: `#[deny(invalid_html_tags)]` implied by `#[deny(rustdoc)]`
|
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc)]`
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(missing_doc_code_examples)]
|
#![deny(rustdoc::missing_doc_code_examples)]
|
||||||
|
|
||||||
//! crate level doc
|
//! crate level doc
|
||||||
//! ```
|
//! ```
|
||||||
|
@ -19,7 +19,7 @@ fn test() {
|
||||||
mod module1 { //~ ERROR
|
mod module1 { //~ ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(missing_doc_code_examples)]
|
#[allow(rustdoc::missing_doc_code_examples)]
|
||||||
/// doc
|
/// doc
|
||||||
mod module2 {
|
mod module2 {
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ LL | | }
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/lint-missing-doc-code-example.rs:2:9
|
--> $DIR/lint-missing-doc-code-example.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(missing_doc_code_examples)]
|
LL | #![deny(rustdoc::missing_doc_code_examples)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing code example in this documentation
|
error: missing code example in this documentation
|
||||||
--> $DIR/lint-missing-doc-code-example.rs:37:3
|
--> $DIR/lint-missing-doc-code-example.rs:37:3
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#![deny(missing_crate_level_docs)]
|
// error-pattern: no documentation found
|
||||||
|
#![deny(rustdoc::missing_crate_level_docs)]
|
||||||
|
//^~ NOTE defined here
|
||||||
|
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
error: no documentation found for this crate's top-level module
|
error: no documentation found for this crate's top-level module
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/no-crate-level-doc-lint.rs:1:9
|
--> $DIR/no-crate-level-doc-lint.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(missing_crate_level_docs)]
|
LL | #![deny(rustdoc::missing_crate_level_docs)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: The following guide may be of use:
|
= help: The following guide may be of use:
|
||||||
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
|
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![deny(private_doc_tests)]
|
#![deny(rustdoc::private_doc_tests)]
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
/// private doc test
|
/// private doc test
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(private_doc_tests)]
|
#![deny(rustdoc::private_doc_tests)]
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
/// private doc test
|
/// private doc test
|
||||||
|
|
|
@ -11,8 +11,8 @@ LL | | /// ```
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/private-item-doc-test.rs:1:9
|
--> $DIR/private-item-doc-test.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(private_doc_tests)]
|
LL | #![deny(rustdoc::private_doc_tests)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
/// [aloha]
|
/// [aloha]
|
||||||
//~^ ERROR unresolved link to `aloha`
|
//~^ ERROR unresolved link to `aloha`
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [aloha]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/pub-export-lint.rs:1:9
|
--> $DIR/pub-export-lint.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
/// Links to [a] [link][a]
|
/// Links to [a] [link][a]
|
||||||
/// And also a [third link][a]
|
/// And also a [third link][a]
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [a]: ref
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/reference-link-reports-error-once.rs:1:9
|
--> $DIR/reference-link-reports-error-once.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
error: unresolved link to `ref2`
|
error: unresolved link to `ref2`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Test that errors point to the reference, not to the title text.
|
// Test that errors point to the reference, not to the title text.
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
//! Links to [a] [link][a]
|
//! Links to [a] [link][a]
|
||||||
//!
|
//!
|
||||||
//! [a]: std::process::Comman
|
//! [a]: std::process::Comman
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | //! [a]: std::process::Comman
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/reference-links.rs:2:9
|
--> $DIR/reference-links.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(broken_intra_doc_links)]
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
5
src/test/rustdoc-ui/renamed-lint-still-applies.rs
Normal file
5
src/test/rustdoc-ui/renamed-lint-still-applies.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// compile-args: --crate-type lib
|
||||||
|
#![deny(broken_intra_doc_links)]
|
||||||
|
//~^ WARNING renamed
|
||||||
|
//! [x]
|
||||||
|
//~^ ERROR unresolved link
|
23
src/test/rustdoc-ui/renamed-lint-still-applies.stderr
Normal file
23
src/test/rustdoc-ui/renamed-lint-still-applies.stderr
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
|
||||||
|
--> $DIR/renamed-lint-still-applies.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(broken_intra_doc_links)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
|
||||||
|
|
|
||||||
|
= note: `#[warn(renamed_and_removed_lints)]` on by default
|
||||||
|
|
||||||
|
error: unresolved link to `x`
|
||||||
|
--> $DIR/renamed-lint-still-applies.rs:4:6
|
||||||
|
|
|
||||||
|
LL | //! [x]
|
||||||
|
| ^ no item named `x` in scope
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/renamed-lint-still-applies.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(broken_intra_doc_links)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||||
|
|
||||||
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
|
@ -4,5 +4,14 @@
|
||||||
//~^ NOTE lint level is defined
|
//~^ NOTE lint level is defined
|
||||||
#![deny(x)]
|
#![deny(x)]
|
||||||
//~^ ERROR unknown lint
|
//~^ ERROR unknown lint
|
||||||
|
#![deny(rustdoc::x)]
|
||||||
|
//~^ ERROR unknown lint: `rustdoc::x`
|
||||||
#![deny(intra_doc_link_resolution_failure)]
|
#![deny(intra_doc_link_resolution_failure)]
|
||||||
//~^ ERROR lint `intra_doc_link_resolution_failure` has been renamed
|
//~^ ERROR renamed to `rustdoc::broken_intra_doc_links`
|
||||||
|
|
||||||
|
#![deny(non_autolinks)]
|
||||||
|
//~^ ERROR renamed to `rustdoc::non_autolinks`
|
||||||
|
|
||||||
|
// Explicitly don't try to handle this case, it was never valid
|
||||||
|
#![deny(rustdoc::intra_doc_link_resolution_failure)]
|
||||||
|
//~^ ERROR unknown lint
|
||||||
|
|
|
@ -10,11 +10,17 @@ note: the lint level is defined here
|
||||||
LL | #![deny(unknown_lints)]
|
LL | #![deny(unknown_lints)]
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: lint `intra_doc_link_resolution_failure` has been renamed to `broken_intra_doc_links`
|
error: unknown lint: `rustdoc::x`
|
||||||
--> $DIR/unknown-renamed-lints.rs:7:9
|
--> $DIR/unknown-renamed-lints.rs:7:9
|
||||||
|
|
|
|
||||||
|
LL | #![deny(rustdoc::x)]
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
|
error: lint `intra_doc_link_resolution_failure` has been renamed to `rustdoc::broken_intra_doc_links`
|
||||||
|
--> $DIR/unknown-renamed-lints.rs:9:9
|
||||||
|
|
|
||||||
LL | #![deny(intra_doc_link_resolution_failure)]
|
LL | #![deny(intra_doc_link_resolution_failure)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `broken_intra_doc_links`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/unknown-renamed-lints.rs:3:9
|
--> $DIR/unknown-renamed-lints.rs:3:9
|
||||||
|
@ -22,7 +28,19 @@ note: the lint level is defined here
|
||||||
LL | #![deny(renamed_and_removed_lints)]
|
LL | #![deny(renamed_and_removed_lints)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: lint `non_autolinks` has been renamed to `rustdoc::non_autolinks`
|
||||||
|
--> $DIR/unknown-renamed-lints.rs:12:9
|
||||||
|
|
|
||||||
|
LL | #![deny(non_autolinks)]
|
||||||
|
| ^^^^^^^^^^^^^ help: use the new name: `rustdoc::non_autolinks`
|
||||||
|
|
||||||
|
error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
|
||||||
|
--> $DIR/unknown-renamed-lints.rs:16:9
|
||||||
|
|
|
||||||
|
LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: Compilation failed, aborting rustdoc
|
error: Compilation failed, aborting rustdoc
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![deny(non_autolinks)]
|
#![deny(rustdoc::non_autolinks)]
|
||||||
|
|
||||||
/// [http://aa.com](http://aa.com)
|
/// [http://aa.com](http://aa.com)
|
||||||
//~^ ERROR unneeded long form for URL
|
//~^ ERROR unneeded long form for URL
|
||||||
|
@ -59,7 +59,7 @@ pub fn c() {}
|
||||||
/// [should_not.lint](should_not.lint)
|
/// [should_not.lint](should_not.lint)
|
||||||
pub fn everything_is_fine_here() {}
|
pub fn everything_is_fine_here() {}
|
||||||
|
|
||||||
#[allow(non_autolinks)]
|
#[allow(rustdoc::non_autolinks)]
|
||||||
pub mod foo {
|
pub mod foo {
|
||||||
/// https://somewhere.com/a?hello=12&bye=11#xyz
|
/// https://somewhere.com/a?hello=12&bye=11#xyz
|
||||||
pub fn bar() {}
|
pub fn bar() {}
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | /// [http://aa.com](http://aa.com)
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/url-improvements.rs:1:9
|
--> $DIR/url-improvements.rs:1:9
|
||||||
|
|
|
|
||||||
LL | #![deny(non_autolinks)]
|
LL | #![deny(rustdoc::non_autolinks)]
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: unneeded long form for URL
|
error: unneeded long form for URL
|
||||||
--> $DIR/url-improvements.rs:5:5
|
--> $DIR/url-improvements.rs:5:5
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
#![feature(intra_doc_pointers)]
|
#![feature(intra_doc_pointers)]
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(rustdoc::broken_intra_doc_links)]
|
||||||
|
|
||||||
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.rotate_left"]' 'slice::rotate_left'
|
// @has foo/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.rotate_left"]' 'slice::rotate_left'
|
||||||
//! [slice::rotate_left]
|
//! [slice::rotate_left]
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#[derive(Eq, PartialEq)]
|
||||||
|
struct Test {
|
||||||
|
a: &'b str,
|
||||||
|
//~^ ERROR use of undeclared lifetime name `'b`
|
||||||
|
//~| ERROR use of undeclared lifetime name `'b`
|
||||||
|
}
|
||||||
|
|
||||||
|
trait T {
|
||||||
|
fn foo(&'static self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl T for Test {
|
||||||
|
fn foo(&'b self) {} //~ ERROR use of undeclared lifetime name `'b`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,40 @@
|
||||||
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
|
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13
|
||||||
|
|
|
||||||
|
LL | fn foo(&'b self) {}
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
|
||||||
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
|
||||||
|
help: consider introducing lifetime `'b` here
|
||||||
|
|
|
||||||
|
LL | impl<'b> T for Test {
|
||||||
|
| ^^^^
|
||||||
|
help: consider introducing lifetime `'b` here
|
||||||
|
|
|
||||||
|
LL | fn foo<'b>(&'b self) {}
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
|
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
|
||||||
|
|
|
||||||
|
LL | struct Test {
|
||||||
|
| - help: consider introducing lifetime `'b` here: `<'b>`
|
||||||
|
LL | a: &'b str,
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
|
||||||
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
|
||||||
|
|
||||||
|
error[E0261]: use of undeclared lifetime name `'b`
|
||||||
|
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
|
||||||
|
|
|
||||||
|
LL | #[derive(Eq, PartialEq)]
|
||||||
|
| -- lifetime `'b` is missing in item created through this procedural macro
|
||||||
|
LL | struct Test {
|
||||||
|
LL | a: &'b str,
|
||||||
|
| ^^ undeclared lifetime
|
||||||
|
|
|
||||||
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0261`.
|
14
src/test/ui/lint/rustdoc-renamed.rs
Normal file
14
src/test/ui/lint/rustdoc-renamed.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
#![deny(unknown_lints)]
|
||||||
|
#![deny(renamed_and_removed_lints)]
|
||||||
|
//~^ NOTE lint level is defined
|
||||||
|
|
||||||
|
// both allowed, since the compiler doesn't yet know what rustdoc lints are valid
|
||||||
|
#![deny(rustdoc::x)]
|
||||||
|
#![deny(rustdoc::intra_doc_link_resolution_failure)]
|
||||||
|
|
||||||
|
#![deny(intra_doc_link_resolution_failure)]
|
||||||
|
//~^ ERROR removed: use `rustdoc::broken_intra_doc_links`
|
||||||
|
#![deny(non_autolinks)]
|
||||||
|
//~^ ERROR removed: use `rustdoc::non_autolinks`
|
20
src/test/ui/lint/rustdoc-renamed.stderr
Normal file
20
src/test/ui/lint/rustdoc-renamed.stderr
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
error: lint `intra_doc_link_resolution_failure` has been removed: use `rustdoc::broken_intra_doc_links` instead
|
||||||
|
--> $DIR/rustdoc-renamed.rs:11:9
|
||||||
|
|
|
||||||
|
LL | #![deny(intra_doc_link_resolution_failure)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/rustdoc-renamed.rs:4:9
|
||||||
|
|
|
||||||
|
LL | #![deny(renamed_and_removed_lints)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: lint `non_autolinks` has been removed: use `rustdoc::non_autolinks` instead
|
||||||
|
--> $DIR/rustdoc-renamed.rs:13:9
|
||||||
|
|
|
||||||
|
LL | #![deny(non_autolinks)]
|
||||||
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
Loading…
Add table
Reference in a new issue