Skip to content

Commit 97cf378

Browse files
authored
Rollup merge of #71787 - tshepang:rustdoc-warnings, r=varkor
fix rustdoc warnings
2 parents 5a7b21f + 3be52b5 commit 97cf378

File tree

27 files changed

+56
-45
lines changed

27 files changed

+56
-45
lines changed

src/librustc_builtin_macros/deriving/generic/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub enum Ty<'a> {
9898
Self_,
9999
/// &/Box/ Ty
100100
Ptr(Box<Ty<'a>>, PtrTy),
101-
/// mod::mod::Type<[lifetime], [Params...]>, including a plain type
101+
/// `mod::mod::Type<[lifetime], [Params...]>`, including a plain type
102102
/// parameter, and things like `i32`
103103
Literal(Path<'a>),
104104
/// includes unit

src/librustc_builtin_macros/test_harness.rs

+2
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ fn generate_test_harness(
233233
///
234234
/// By default this expands to
235235
///
236+
/// ```
236237
/// #[main]
237238
/// pub fn main() {
238239
/// extern crate test;
@@ -242,6 +243,7 @@ fn generate_test_harness(
242243
/// &test_const3,
243244
/// ]);
244245
/// }
246+
/// ```
245247
///
246248
/// Most of the Ident have the usual def-site hygiene for the AST pass. The
247249
/// exception is the `test_const`s. These have a syntax context that has two

src/librustc_codegen_llvm/context.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ pub struct CodegenCx<'ll, 'tcx> {
4949
pub const_cstr_cache: RefCell<FxHashMap<Symbol, &'ll Value>>,
5050

5151
/// Reverse-direction for const ptrs cast from globals.
52-
/// Key is a Value holding a *T,
53-
/// Val is a Value holding a *[T].
52+
///
53+
/// Key is a Value holding a `*T`,
54+
/// Val is a Value holding a `*[T]`.
5455
///
5556
/// Needed because LLVM loses pointer->pointee association
5657
/// when we ptrcast, and we have to ptrcast during codegen
57-
/// of a [T] const because we form a slice, a (*T,usize) pair, not
58+
/// of a `[T]` const because we form a slice, a `(*T,usize)` pair, not
5859
/// a pointer to an LLVM array type. Similar for trait objects.
5960
pub const_unsized: RefCell<FxHashMap<&'ll Value, &'ll Value>>,
6061

src/librustc_codegen_ssa/traits/declare.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait DeclareMethods<'tcx>: BackendTypes {
3131
/// Use this function when you intend to define a global. This function will
3232
/// return `None` if the name already has a definition associated with it. In that
3333
/// case an error should be reported to the user, because it usually happens due
34-
/// to user’s fault (e.g., misuse of #[no_mangle] or #[export_name] attributes).
34+
/// to user’s fault (e.g., misuse of `#[no_mangle]` or `#[export_name]` attributes).
3535
fn define_global(&self, name: &str, ty: Self::Type) -> Option<Self::Value>;
3636

3737
/// Declare a private global

src/librustc_data_structures/obligation_forest/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ struct Node<O> {
173173
/// must all be in a non-pending state.
174174
dependents: Vec<usize>,
175175

176-
/// If true, dependents[0] points to a "parent" node, which requires
176+
/// If true, `dependents[0]` points to a "parent" node, which requires
177177
/// special treatment upon error but is otherwise treated the same.
178178
/// (It would be more idiomatic to store the parent node in a separate
179179
/// `Option<usize>` field, but that slows down the common case of

src/librustc_data_structures/transitive_relation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
289289
///
290290
/// - A != B
291291
/// - A R B is true
292-
/// - for each i, j: B[i] R B[j] does not hold
292+
/// - for each i, j: `B[i]` R `B[j]` does not hold
293293
///
294294
/// The intuition is that this moves "one step up" through a lattice
295295
/// (where the relation is encoding the `<=` relation for the lattice).

src/librustc_hir/arena.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
66
/// faster and more memory efficient if there is lots of allocations.
77
///
8-
/// Specifying the `decode` modifier will add decode impls for &T and &[T] where T is the type
9-
/// listed. These impls will appear in the implement_ty_decoder! macro.
8+
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`,
9+
/// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
1010
#[macro_export]
1111
macro_rules! arena_types {
1212
($macro:path, $args:tt, $tcx:lifetime) => (

src/librustc_infer/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
843843
///
844844
/// For the following code:
845845
///
846-
/// ```norun
846+
/// ```no_run
847847
/// let x: Foo<Bar<Qux>> = foo::<Bar<Qux>>();
848848
/// ```
849849
///

src/librustc_infer/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14821482
self.tcx.replace_bound_vars(value, fld_r, fld_t, fld_c)
14831483
}
14841484

1485-
/// See the [`region_constraints::verify_generic_bound`] method.
1485+
/// See the [`region_constraints::RegionConstraintCollector::verify_generic_bound`] method.
14861486
pub fn verify_generic_bound(
14871487
&self,
14881488
origin: SubregionOrigin<'tcx>,

src/librustc_infer/infer/region_constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
810810
)
811811
}
812812

813-
/// See [`RegionInference::region_constraints_added_in_snapshot`].
813+
/// See `InferCtxt::region_constraints_added_in_snapshot`.
814814
pub fn region_constraints_added_in_snapshot(&self, mark: &RegionSnapshot) -> Option<bool> {
815815
self.undo_log[mark.length..]
816816
.iter()

src/librustc_lint/levels.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ impl<'s> LintLevelsBuilder<'s> {
103103
/// * It'll validate all lint-related attributes in `attrs`
104104
/// * It'll mark all lint-related attributes as used
105105
/// * Lint levels will be updated based on the attributes provided
106-
/// * Lint attributes are validated, e.g., a #[forbid] can't be switched to
107-
/// #[allow]
106+
/// * Lint attributes are validated, e.g., a `#[forbid]` can't be switched to
107+
/// `#[allow]`
108108
///
109109
/// Don't forget to call `pop`!
110110
pub fn push(&mut self, attrs: &[ast::Attribute], store: &LintStore) -> BuilderPush {

src/librustc_middle/arena.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is
66
/// faster and more memory efficient if there is lots of allocations.
77
///
8-
/// Specifying the `decode` modifier will add decode impls for &T and &[T] where T is the type
8+
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type
99
/// listed. These impls will appear in the implement_ty_decoder! macro.
1010
#[macro_export]
1111
macro_rules! arena_types {

src/librustc_middle/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ pub struct Body<'tcx> {
158158
/// We hold in this field all the constants we are not able to evaluate yet.
159159
pub required_consts: Vec<Constant<'tcx>>,
160160

161-
/// The user may be writing e.g. &[(SOME_CELL, 42)][i].1 and this would get promoted, because
161+
/// The user may be writing e.g. `&[(SOME_CELL, 42)][i].1` and this would get promoted, because
162162
/// we'd statically know that no thing with interior mutability will ever be available to the
163163
/// user without some serious unsafe code. Now this means that our promoted is actually
164-
/// &[(SOME_CELL, 42)] and the MIR using it will do the &promoted[i].1 projection because the
164+
/// `&[(SOME_CELL, 42)]` and the MIR using it will do the `&promoted[i].1` projection because the
165165
/// index may be a runtime value. Such a promoted value is illegal because it has reachable
166166
/// interior mutability. This flag just makes this situation very obvious where the previous
167167
/// implementation without the flag hid this situation silently.
@@ -2124,7 +2124,7 @@ pub enum Rvalue<'tcx> {
21242124
/// or when casting a reference to a raw pointer.
21252125
AddressOf(Mutability, Place<'tcx>),
21262126

2127-
/// length of a [X] or [X;n] value
2127+
/// length of a `[X]` or `[X;n]` value
21282128
Len(Place<'tcx>),
21292129

21302130
Cast(CastKind, Operand<'tcx>, Ty<'tcx>),

src/librustc_middle/mir/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub struct ClosureOutlivesRequirement<'tcx> {
167167
/// are interesting (for error reporting). Order of variants indicates sort
168168
/// order of the category, thereby influencing diagnostic output.
169169
///
170-
/// See also [rustc_mir::borrow_check::nll::constraints].
170+
/// See also `rustc_mir::borrow_check::constraints`.
171171
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
172172
#[derive(RustcEncodable, RustcDecodable, HashStable)]
173173
pub enum ConstraintCategory {

src/librustc_middle/ty/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ impl IntegerExt for Integer {
7070
}
7171

7272
/// Finds the appropriate Integer type and signedness for the given
73-
/// signed discriminant range and #[repr] attribute.
74-
/// N.B.: u128 values above i128::MAX will be treated as signed, but
73+
/// signed discriminant range and `#[repr]` attribute.
74+
/// N.B.: `u128` values above `i128::MAX` will be treated as signed, but
7575
/// that shouldn't affect anything, other than maybe debuginfo.
7676
fn repr_discr<'tcx>(
7777
tcx: TyCtxt<'tcx>,

src/librustc_middle/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ impl<'tcx> TyCtxt<'tcx> {
26962696
}
26972697

26982698
/// Returns `true` if the impls are the same polarity and the trait either
2699-
/// has no items or is annotated #[marker] and prevents item overrides.
2699+
/// has no items or is annotated `#[marker]` and prevents item overrides.
27002700
pub fn impls_are_allowed_to_overlap(
27012701
self,
27022702
def_id1: DefId,

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
582582
///
583583
/// This is used when creating error messages like below:
584584
///
585-
/// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
586-
/// > mutable (via `a.u.s.b`) [E0502]
585+
/// ```text
586+
/// cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
587+
/// mutable (via `a.u.s.b`) [E0502]
588+
/// ```
587589
pub(in crate::borrow_check) fn describe_place_for_conflicting_borrow(
588590
&self,
589591
first_borrowed_place: Place<'tcx>,

src/librustc_mir/transform/cleanup_post_borrowck.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
//!
88
//! The `CleanFakeReadsAndBorrows` "pass" is actually implemented as two
99
//! traversals (aka visits) of the input MIR. The first traversal,
10-
//! [`DeleteAndRecordFakeReads`], deletes the fake reads and finds the
11-
//! temporaries read by [`ForMatchGuard`] reads, and [`DeleteFakeBorrows`]
10+
//! `DeleteAndRecordFakeReads`, deletes the fake reads and finds the
11+
//! temporaries read by [`ForMatchGuard`] reads, and `DeleteFakeBorrows`
1212
//! deletes the initialization of those temporaries.
1313
//!
1414
//! [`AscribeUserType`]: rustc_middle::mir::StatementKind::AscribeUserType
1515
//! [`Shallow`]: rustc_middle::mir::BorrowKind::Shallow
1616
//! [`FakeRead`]: rustc_middle::mir::StatementKind::FakeRead
17+
//! [`Assign`]: rustc_middle::mir::StatementKind::Assign
18+
//! [`ForMatchGuard`]: rustc_middle::mir::FakeReadCause::ForMatchGuard
1719
//! [`Nop`]: rustc_middle::mir::StatementKind::Nop
1820
1921
use crate::transform::{MirPass, MirSource};

src/librustc_mir_build/hair/pattern/_match.rs

+2
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> {
513513
}
514514

515515
/// Pretty-printer for matrices of patterns, example:
516+
///
517+
/// ```text
516518
/// +++++++++++++++++++++++++++++
517519
/// + _ + [] +
518520
/// +++++++++++++++++++++++++++++

src/librustc_resolve/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
10511051

10521052
/// Suggests a missing `crate::` if that resolves to an correct module.
10531053
///
1054-
/// ```
1054+
/// ```text
10551055
/// |
10561056
/// LL | use foo::Bar;
10571057
/// | ^^^ did you mean `crate::foo`?
@@ -1147,7 +1147,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
11471147
/// Suggests importing a macro from the root of the crate rather than a module within
11481148
/// the crate.
11491149
///
1150-
/// ```
1150+
/// ```text
11511151
/// help: a macro with this name exists at the root of the crate
11521152
/// |
11531153
/// LL | use issue_59764::makro;

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ impl<'a> Resolver<'a> {
26692669
/// This function adds a suggestion to change the binding name of a new import that conflicts
26702670
/// with an existing import.
26712671
///
2672-
/// ```ignore (diagnostic)
2672+
/// ```text,ignore (diagnostic)
26732673
/// help: you can use `as` to change the binding name of the import
26742674
/// |
26752675
/// LL | use foo::bar as other_bar;

src/librustc_span/hygiene.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ pub struct ExpnData {
661661
/// The span of the macro definition (possibly dummy).
662662
/// This span serves only informational purpose and is not used for resolution.
663663
pub def_site: Span,
664-
/// List of #[unstable]/feature-gated features that the macro is allowed to use
664+
/// List of `#[unstable]`/feature-gated features that the macro is allowed to use
665665
/// internally without forcing the whole crate to opt-in
666666
/// to them.
667667
pub allow_internal_unstable: Option<Lrc<[Symbol]>>,

src/librustc_trait_selection/traits/coherence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ pub fn orphan_check(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Result<(), OrphanChe
327327
/// try to implement this trait-ref. To check for this, we use InCrate::Remote
328328
/// mode. That is sound because we already know all the impls from known crates.
329329
///
330-
/// 3. For non-#[fundamental] traits, they guarantee that parent crates can
330+
/// 3. For non-`#[fundamental]` traits, they guarantee that parent crates can
331331
/// add "non-blanket" impls without breaking negative reasoning in dependent
332332
/// crates. This is the "rebalancing coherence" (RFC 1023) restriction.
333333
///
334334
/// For that, we only a allow crate to perform negative reasoning on
335-
/// non-local-non-#[fundamental] only if there's a local key parameter as per (2).
335+
/// non-local-non-`#[fundamental]` only if there's a local key parameter as per (2).
336336
///
337337
/// Because we never perform negative reasoning generically (coherence does
338338
/// not involve type parameters), this can be interpreted as doing the full

src/librustc_ty/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn instance_def_size_estimate<'tcx>(
307307

308308
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
309309
///
310-
/// See [`ImplOverlapKind::Issue33140`] for more details.
310+
/// See [`ty::ImplOverlapKind::Issue33140`] for more details.
311311
fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
312312
debug!("issue33140_self_ty({:?})", def_id);
313313

src/librustc_typeck/check/regionck.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1105,19 +1105,21 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
11051105
/// itself the referent of a borrowed pointer. Let me give an
11061106
/// example fragment of code to make clear(er) the situation:
11071107
///
1108-
/// let r: &'a mut T = ...; // the original reference "r" has lifetime 'a
1109-
/// ...
1110-
/// &'z *r // the reborrow has lifetime 'z
1108+
/// ```ignore (incomplete Rust code)
1109+
/// let r: &'a mut T = ...; // the original reference "r" has lifetime 'a
1110+
/// ...
1111+
/// &'z *r // the reborrow has lifetime 'z
1112+
/// ```
11111113
///
11121114
/// Now, in this case, our primary job is to add the inference
11131115
/// constraint that `'z <= 'a`. Given this setup, let's clarify the
11141116
/// parameters in (roughly) terms of the example:
11151117
///
11161118
/// ```plain,ignore (pseudo-Rust)
1117-
/// A borrow of: `& 'z bk * r` where `r` has type `& 'a bk T`
1118-
/// borrow_region ^~ ref_region ^~
1119-
/// borrow_kind ^~ ref_kind ^~
1120-
/// ref_cmt ^
1119+
/// A borrow of: `& 'z bk * r` where `r` has type `& 'a bk T`
1120+
/// borrow_region ^~ ref_region ^~
1121+
/// borrow_kind ^~ ref_kind ^~
1122+
/// ref_cmt ^
11211123
/// ```
11221124
///
11231125
/// Here `bk` stands for some borrow-kind (e.g., `mut`, `uniq`, etc).
@@ -1193,7 +1195,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> {
11931195
/// a `FnMut` or `Fn` closure.
11941196
///
11951197
/// This function links the lifetimes of those references to the lifetime
1196-
/// of the borrow that's provided. See [link_reborrowed_region] for some
1198+
/// of the borrow that's provided. See [RegionCtxt::link_reborrowed_region] for some
11971199
/// more explanation of this in the general case.
11981200
///
11991201
/// We also supply a *cause*, and in this case we set the cause to

src/librustc_typeck/mem_categorization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! - `ty`: the type of data found at the address `A`.
3131
//!
3232
//! The resulting categorization tree differs somewhat from the expressions
33-
//! themselves. For example, auto-derefs are explicit. Also, an index a[b] is
33+
//! themselves. For example, auto-derefs are explicit. Also, an index `a[b]` is
3434
//! decomposed into two operations: a dereference to reach the array data and
3535
//! then an index to jump forward to the relevant item.
3636
//!

src/librustdoc/html/toc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pub struct Toc {
66
/// The levels are strictly decreasing, i.e.
77
///
8-
/// entries[0].level >= entries[1].level >= ...
8+
/// `entries[0].level >= entries[1].level >= ...`
99
///
1010
/// Normally they are equal, but can differ in cases like A and B,
1111
/// both of which end up in the same `Toc` as they have the same
@@ -39,8 +39,8 @@ pub struct TocEntry {
3939
pub struct TocBuilder {
4040
top_level: Toc,
4141
/// The current hierarchy of parent headings, the levels are
42-
/// strictly increasing (i.e., chain[0].level < chain[1].level <
43-
/// ...) with each entry being the most recent occurrence of a
42+
/// strictly increasing (i.e., `chain[0].level < chain[1].level <
43+
/// ...`) with each entry being the most recent occurrence of a
4444
/// heading with that level (it doesn't include the most recent
4545
/// occurrences of every level, just, if it *is* in `chain` then
4646
/// it is the most recent one).

0 commit comments

Comments
 (0)