Skip to content

Commit 0152393

Browse files
committed
Auto merge of #99324 - reez12g:issue-99144, r=jyn514
Enable doctests in compiler/ crates Helps with #99144
2 parents 27579a2 + 488eb42 commit 0152393

File tree

36 files changed

+16
-40
lines changed

36 files changed

+16
-40
lines changed

compiler/rustc_ast/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
bitflags = "1.2.1"

compiler/rustc_ast_lowering/src/expr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1609,11 +1609,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
16091609
}
16101610

16111611
/// Desugar `ExprKind::Yeet` from: `do yeet <expr>` into:
1612-
/// ```rust
1612+
/// ```ignore(illustrative)
16131613
/// // If there is an enclosing `try {...}`:
1614-
/// break 'catch_target FromResidual::from_residual(Yeet(residual)),
1614+
/// break 'catch_target FromResidual::from_residual(Yeet(residual));
16151615
/// // Otherwise:
1616-
/// return FromResidual::from_residual(Yeet(residual)),
1616+
/// return FromResidual::from_residual(Yeet(residual));
16171617
/// ```
16181618
/// But to simplify this, there's a `from_yeet` lang item function which
16191619
/// handles the combined `FromResidual::from_residual(Yeet(residual))`.

compiler/rustc_ast_pretty/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_span = { path = "../rustc_span" }

compiler/rustc_attr/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_ast_pretty = { path = "../rustc_ast_pretty" }

compiler/rustc_borrowck/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
either = "1.5.0"

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
341341
/// Report an error because the universal region `fr` was required to outlive
342342
/// `outlived_fr` but it is not known to do so. For example:
343343
///
344-
/// ```compile_fail,E0312
344+
/// ```compile_fail
345345
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
346346
/// ```
347347
///

compiler/rustc_borrowck/src/region_infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13981398
/// whether any of the constraints were too strong. In particular,
13991399
/// we want to check for a case where a universally quantified
14001400
/// region exceeded its bounds. Consider:
1401-
/// ```compile_fail,E0312
1401+
/// ```compile_fail
14021402
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
14031403
/// ```
14041404
/// In this case, returning `x` requires `&'a u32 <: &'b u32`
@@ -1451,7 +1451,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14511451
/// <https://smallcultfollowing.com/babysteps/blog/2019/01/17/polonius-and-region-errors/>
14521452
///
14531453
/// In the canonical example
1454-
/// ```compile_fail,E0312
1454+
/// ```compile_fail
14551455
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
14561456
/// ```
14571457
/// returning `x` requires `&'a u32 <: &'b u32` and hence we establish (transitively) a

compiler/rustc_builtin_macros/src/assert/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
5858
/// Builds the whole `assert!` expression. For example, `let elem = 1; assert!(elem == 1);` expands to:
5959
///
6060
/// ```rust
61+
/// #![feature(generic_assert_internals)]
6162
/// let elem = 1;
6263
/// {
6364
/// #[allow(unused_imports)]
@@ -70,7 +71,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
7071
/// __local_bind0
7172
/// } == 1
7273
/// ) {
73-
/// panic!("Assertion failed: elem == 1\nWith captures:\n elem = {}", __capture0)
74+
/// panic!("Assertion failed: elem == 1\nWith captures:\n elem = {:?}", __capture0)
7475
/// }
7576
/// }
7677
/// ```

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,11 @@ impl<'a> MethodDef<'a> {
11141114
/// ```
11151115
/// is equivalent to:
11161116
/// ```
1117+
/// #![feature(core_intrinsics)]
1118+
/// enum A {
1119+
/// A1,
1120+
/// A2(i32)
1121+
/// }
11171122
/// impl ::core::cmp::PartialEq for A {
11181123
/// #[inline]
11191124
/// fn eq(&self, other: &A) -> bool {

compiler/rustc_codegen_llvm/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ edition = "2021"
55

66
[lib]
77
test = false
8-
doctest = false
98

109
[dependencies]
1110
bitflags = "1.0"

compiler/rustc_const_eval/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
tracing = "0.1"

compiler/rustc_const_eval/src/interpret/validity.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ macro_rules! throw_validation_failure {
5656
/// This lets you use the patterns as a kind of validation list, asserting which errors
5757
/// can possibly happen:
5858
///
59-
/// ```
59+
/// ```ignore(illustrative)
6060
/// let v = try_validation!(some_fn(), some_path, {
6161
/// Foo | Bar | Baz => { "some failure" },
6262
/// });
@@ -65,7 +65,7 @@ macro_rules! throw_validation_failure {
6565
/// The patterns must be of type `UndefinedBehaviorInfo`.
6666
/// An additional expected parameter can also be added to the failure message:
6767
///
68-
/// ```
68+
/// ```ignore(illustrative)
6969
/// let v = try_validation!(some_fn(), some_path, {
7070
/// Foo | Bar | Baz => { "some failure" } expected { "something that wasn't a failure" },
7171
/// });
@@ -74,7 +74,7 @@ macro_rules! throw_validation_failure {
7474
/// An additional nicety is that both parameters actually take format args, so you can just write
7575
/// the format string in directly:
7676
///
77-
/// ```
77+
/// ```ignore(illustrative)
7878
/// let v = try_validation!(some_fn(), some_path, {
7979
/// Foo | Bar | Baz => { "{:?}", some_failure } expected { "{}", expected_value },
8080
/// });

compiler/rustc_data_structures/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
arrayvec = { version = "0.7", default-features = false }

compiler/rustc_error_messages/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
fluent-bundle = "0.15.2"

compiler/rustc_errors/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
tracing = "0.1"

compiler/rustc_feature/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_hir/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_arena = { path = "../rustc_arena" }

compiler/rustc_hir_pretty/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_ast_pretty = { path = "../rustc_ast_pretty" }

compiler/rustc_incremental/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_graphviz = { path = "../rustc_graphviz" }

compiler/rustc_index/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
arrayvec = { version = "0.7", default-features = false }

compiler/rustc_interface/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
libloading = "0.7.1"

compiler/rustc_lexer/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Rust lexer used by rustc. No stability guarantees are provided.
1212
# Note: do not remove this blank `[lib]` section.
1313
# This will be used when publishing this crate as `rustc-ap-rustc_lexer`.
1414
[lib]
15-
doctest = false
1615

1716
# Note that this crate purposefully does not depend on other rustc crates
1817
[dependencies]

compiler/rustc_metadata/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
libloading = "0.7.1"

compiler/rustc_mir_build/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_arena = { path = "../rustc_arena" }

compiler/rustc_mir_dataflow/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
polonius-engine = "0.13.0"

compiler/rustc_mir_transform/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
itertools = "0.10.1"

compiler/rustc_mir_transform/src/coverage/test_macros/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ edition = "2021"
55

66
[lib]
77
proc-macro = true
8-
doctest = false

compiler/rustc_monomorphize/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
smallvec = { version = "1.8.1", features = [ "union", "may_dangle" ] }

compiler/rustc_parse/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
bitflags = "1.0"

compiler/rustc_plugin_impl/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ build = false
55
edition = "2021"
66

77
[lib]
8-
doctest = false
98

109
[dependencies]
1110
libloading = "0.7.1"

compiler/rustc_query_system/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
parking_lot = "0.11"

compiler/rustc_resolve/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
bitflags = "1.2.1"

compiler/rustc_span/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_serialize = { path = "../rustc_serialize" }

compiler/rustc_symbol_mangling/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
bitflags = "1.2.1"

compiler/rustc_trait_selection/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
rustc_parse_format = { path = "../rustc_parse_format" }

compiler/rustc_type_ir/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.0.0"
44
edition = "2021"
55

66
[lib]
7-
doctest = false
87

98
[dependencies]
109
bitflags = "1.2.1"

0 commit comments

Comments
 (0)