Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit df903a5

Browse files
fix doc tests
1 parent 8c16ded commit df903a5

File tree

37 files changed

+75
-61
lines changed

37 files changed

+75
-61
lines changed

src/tools/rust-analyzer/crates/hir-def/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ license.workspace = true
1010
rust-version.workspace = true
1111

1212
[lib]
13-
doctest = false
1413

1514
[dependencies]
1615
arrayvec.workspace = true

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
//!
66
//! It is used like this:
77
//!
8-
//! ```
8+
//! ```ignore
9+
//! # use hir_def::dyn_map::DynMap;
10+
//! # use hir_def::dyn_map::Key;
911
//! // keys define submaps of a `DynMap`
1012
//! const STRING_TO_U32: Key<String, u32> = Key::new();
1113
//! const U32_TO_VEC: Key<u32, Vec<bool>> = Key::new();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,20 +883,20 @@ pub struct UseTree {
883883

884884
#[derive(Debug, Clone, Eq, PartialEq)]
885885
pub enum UseTreeKind {
886-
/// ```
886+
/// ```ignore
887887
/// use path::to::Item;
888888
/// use path::to::Item as Renamed;
889889
/// use path::to::Trait as _;
890890
/// ```
891891
Single { path: Interned<ModPath>, alias: Option<ImportAlias> },
892892

893-
/// ```
893+
/// ```ignore
894894
/// use *; // (invalid, but can occur in nested tree)
895895
/// use path::*;
896896
/// ```
897897
Glob { path: Option<Interned<ModPath>> },
898898

899-
/// ```
899+
/// ```ignore
900900
/// use prefix::{self, Item, ...};
901901
/// ```
902902
Prefixed { prefix: Option<Interned<ModPath>>, list: Box<[UseTree]> },

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl DirPath {
134134
/// So this is the case which doesn't really work I think if we try to be
135135
/// 100% platform agnostic:
136136
///
137-
/// ```
137+
/// ```ignore
138138
/// mod a {
139139
/// #[path="C://sad/face"]
140140
/// mod b { mod c; }

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,17 @@ impl Resolver {
532532
/// Note that in Rust one name can be bound to several items:
533533
///
534534
/// ```
535+
/// # #![allow(non_camel_case_types)]
535536
/// macro_rules! t { () => (()) }
536537
/// type t = t!();
537-
/// const t: t = t!()
538+
/// const t: t = t!();
538539
/// ```
539540
///
540541
/// That's why we return a multimap.
541542
///
542543
/// The shadowing is accounted for: in
543544
///
544-
/// ```
545+
/// ```ignore
545546
/// let it = 92;
546547
/// {
547548
/// let it = 92;

src/tools/rust-analyzer/crates/hir-expand/src/builtin/attr_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn dummy_gate_test_expand(
101101
/// somewhat inconsistently resolve derive attributes.
102102
///
103103
/// As such, we expand `#[derive(Foo, bar::Bar)]` into
104-
/// ```
104+
/// ```ignore
105105
/// #![Foo]
106106
/// #![bar::Bar]
107107
/// ```

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub struct HirFormatter<'a> {
9595
enum BoundsFormattingCtx {
9696
Entered {
9797
/// We can have recursive bounds like the following case:
98-
/// ```rust
98+
/// ```ignore
9999
/// where
100100
/// T: Foo,
101101
/// T::FooAssoc: Baz<<T::FooAssoc as Bar>::BarAssoc> + Bar

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl Default for InternedStandardTypes {
335335
/// sized struct to a dynamically sized one. E.g., &[i32; 4] -> &[i32] is
336336
/// represented by:
337337
///
338-
/// ```
338+
/// ```ignore
339339
/// Deref(None) -> [i32; 4],
340340
/// Borrow(AutoBorrow::Ref) -> &[i32; 4],
341341
/// Unsize -> &[i32],
@@ -481,9 +481,10 @@ pub struct InferenceResult {
481481
/// or pattern can have multiple binding modes. For example:
482482
/// ```
483483
/// fn foo(mut slice: &[u32]) -> usize {
484-
/// slice = match slice {
485-
/// [0, rest @ ..] | rest => rest,
486-
/// };
484+
/// slice = match slice {
485+
/// [0, rest @ ..] | rest => rest,
486+
/// };
487+
/// 0
487488
/// }
488489
/// ```
489490
/// the first `rest` has implicit `ref` binding mode, but the second `rest` binding mode is `move`.

src/tools/rust-analyzer/crates/hir/src/semantics/source_to_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! This module solves the following problem:
77
//!
8-
//! Given a piece of syntax, find the corresponding semantic definition (def).
8+
//! > Given a piece of syntax, find the corresponding semantic definition (def).
99
//!
1010
//! This problem is a part of more-or-less every IDE feature implemented. Every
1111
//! IDE functionality (like goto to definition), conceptually starts with a

src/tools/rust-analyzer/crates/hir/src/term_search/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn mod_item_path_str(
4040
/// Type tree shows how can we get from set of types to some type.
4141
///
4242
/// Consider the following code as an example
43-
/// ```
43+
/// ```ignore
4444
/// fn foo(x: i32, y: bool) -> Option<i32> { None }
4545
/// fn bar() {
4646
/// let a = 1;

0 commit comments

Comments
 (0)