Skip to content

Commit 1e3fbf9

Browse files
authored
Merge pull request #21188 from Wilfred/fix_rustdoc_and_add_ci
Fix rustdoc warnings and add CI
2 parents 329395e + 5c93137 commit 1e3fbf9

File tree

26 files changed

+60
-47
lines changed

26 files changed

+60
-47
lines changed

src/tools/rust-analyzer/.github/workflows/rustdoc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
CARGO_INCREMENTAL: 0
99
CARGO_NET_RETRY: 10
1010
RUSTFLAGS: "-D warnings -W unreachable-pub"
11+
RUSTDOCFLAGS: "-D warnings"
1112
RUSTUP_MAX_RETRIES: 10
1213

1314
jobs:

src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub use self::lower::{
4343
hir_assoc_type_binding_to_ast, hir_generic_arg_to_ast, hir_segment_to_ast_segment,
4444
};
4545

46-
/// A wrapper around [`span::SyntaxContextId`] that is intended only for comparisons.
46+
/// A wrapper around [`span::SyntaxContext`] that is intended only for comparisons.
4747
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4848
pub struct HygieneId(span::SyntaxContext);
4949

src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub type LocalLifetimeParamId = Idx<LifetimeParamData>;
2020
/// Data about a generic type parameter (to a function, struct, impl, ...).
2121
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
2222
pub struct TypeParamData {
23-
/// [`None`] only if the type ref is an [`TypeRef::ImplTrait`]. FIXME: Might be better to just
23+
/// [`None`] only if the type ref is an [`crate::type_ref::TypeRef::ImplTrait`]. FIXME: Might be better to just
2424
/// make it always be a value, giving impl trait a special name.
2525
pub name: Option<Name>,
2626
pub default: Option<TypeRefId>,

src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ language_item_table! { LangItems =>
238238
Clone, sym::clone, clone_trait, TraitId, GenericRequirement::None;
239239
Sync, sym::sync, sync_trait, TraitId, GenericRequirement::Exact(0);
240240
DiscriminantKind, sym::discriminant_kind, discriminant_kind_trait, TraitId, GenericRequirement::None;
241-
/// The associated item of the [`DiscriminantKind`] trait.
241+
/// The associated item of the `DiscriminantKind` trait.
242242
Discriminant, sym::discriminant_type, discriminant_type, TypeAliasId, GenericRequirement::None;
243243

244244
PointeeTrait, sym::pointee_trait, pointee_trait, TraitId, GenericRequirement::None;

src/tools/rust-analyzer/crates/hir-def/src/nameres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ impl ModuleData {
739739
self.origin.definition_source(db)
740740
}
741741

742-
/// Same as [`definition_source`] but only returns the file id to prevent parsing the ASt.
742+
/// Same as [`ModuleData::definition_source`] but only returns the file id to prevent parsing the ASt.
743743
pub fn definition_source_file_id(&self) -> HirFileId {
744744
match self.origin {
745745
ModuleOrigin::File { definition, .. } | ModuleOrigin::CrateRoot { definition } => {

src/tools/rust-analyzer/crates/hir-expand/src/files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<SN: Borrow<SyntaxNode>> InFile<SN> {
295295
/// Falls back to the macro call range if the node cannot be mapped up fully.
296296
///
297297
/// For attributes and derives, this will point back to the attribute only.
298-
/// For the entire item use [`InFile::original_file_range_full`].
298+
/// For the entire item use `InFile::original_file_range_full`.
299299
pub fn original_file_range_rooted(self, db: &dyn db::ExpandDatabase) -> FileRange {
300300
self.borrow().map(SyntaxNode::text_range).original_node_file_range_rooted(db)
301301
}

src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
//!
99
//! # The Expansion Order Hierarchy
1010
//!
11-
//! `ExpnData` in rustc, rust-analyzer's version is [`MacroCallLoc`]. Traversing the hierarchy
12-
//! upwards can be achieved by walking up [`MacroCallLoc::kind`]'s contained file id, as
13-
//! [`MacroFile`]s are interned [`MacroCallLoc`]s.
11+
//! `ExpnData` in rustc, rust-analyzer's version is `MacroCallLoc`. Traversing the hierarchy
12+
//! upwards can be achieved by walking up `MacroCallLoc::kind`'s contained file id, as
13+
//! `MacroFile`s are interned `MacroCallLoc`s.
1414
//!
1515
//! # The Macro Definition Hierarchy
1616
//!
1717
//! `SyntaxContextData` in rustc and rust-analyzer. Basically the same in both.
1818
//!
1919
//! # The Call-site Hierarchy
2020
//!
21-
//! `ExpnData::call_site` in rustc, [`MacroCallLoc::call_site`] in rust-analyzer.
21+
//! `ExpnData::call_site` in rustc, `MacroCallLoc::call_site` in rust-analyzer.
2222
// FIXME: Move this into the span crate? Not quite possible today as that depends on `MacroCallLoc`
2323
// which contains a bunch of unrelated things
2424

src/tools/rust-analyzer/crates/hir-expand/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//! tree originates not from the text of some `FileId`, but from some macro
55
//! expansion.
66
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
7+
// It's useful to refer to code that is private in doc comments.
8+
#![allow(rustdoc::private_intra_doc_links)]
79

810
pub use intern;
911

@@ -860,7 +862,7 @@ impl ExpansionInfo {
860862
}
861863

862864
/// Maps the passed in file range down into a macro expansion if it is the input to a macro call.
863-
/// Unlike [`map_range_down_exact`], this will consider spans that contain the given span.
865+
/// Unlike [`ExpansionInfo::map_range_down_exact`], this will consider spans that contain the given span.
864866
///
865867
/// Note this does a linear search through the entire backing vector of the spanmap.
866868
pub fn map_range_down(

src/tools/rust-analyzer/crates/hir-ty/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//! information and various assists.
33
44
#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
5+
// It's useful to refer to code that is private in doc comments.
6+
#![allow(rustdoc::private_intra_doc_links)]
57

68
// FIXME: We used to import `rustc_*` deps from `rustc_private` with `feature = "in-rust-tree" but
79
// temporarily switched to crates.io versions due to hardships that working on them from rustc

src/tools/rust-analyzer/crates/hir-ty/src/mir.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -977,15 +977,13 @@ pub enum Rvalue<'db> {
977977
UnaryOp(UnOp, Operand<'db>),
978978

979979
/// Computes the discriminant of the place, returning it as an integer of type
980-
/// [`discriminant_ty`]. Returns zero for types without discriminant.
980+
/// `discriminant_ty`. Returns zero for types without discriminant.
981981
///
982982
/// The validity requirements for the underlying value are undecided for this rvalue, see
983983
/// [#91095]. Note too that the value of the discriminant is not the same thing as the
984-
/// variant index; use [`discriminant_for_variant`] to convert.
984+
/// variant index; use `discriminant_for_variant` to convert.
985985
///
986-
/// [`discriminant_ty`]: crate::ty::Ty::discriminant_ty
987986
/// [#91095]: https://github.com/rust-lang/rust/issues/91095
988-
/// [`discriminant_for_variant`]: crate::ty::Ty::discriminant_for_variant
989987
Discriminant(Place<'db>),
990988

991989
/// Creates an aggregate value, like a tuple or struct.

0 commit comments

Comments
 (0)