Auto merge of #99324 - reez12g:issue-99144, r=jyn514

Enable doctests in compiler/ crates

Helps with https://github.com/rust-lang/rust/issues/99144
This commit is contained in:
bors 2022-10-06 03:01:57 +00:00
commit 0152393048
36 changed files with 16 additions and 40 deletions

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
bitflags = "1.2.1"

View File

@ -1609,11 +1609,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
/// Desugar `ExprKind::Yeet` from: `do yeet <expr>` into:
/// ```rust
/// ```ignore(illustrative)
/// // If there is an enclosing `try {...}`:
/// break 'catch_target FromResidual::from_residual(Yeet(residual)),
/// break 'catch_target FromResidual::from_residual(Yeet(residual));
/// // Otherwise:
/// return FromResidual::from_residual(Yeet(residual)),
/// return FromResidual::from_residual(Yeet(residual));
/// ```
/// But to simplify this, there's a `from_yeet` lang item function which
/// handles the combined `FromResidual::from_residual(Yeet(residual))`.

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_span = { path = "../rustc_span" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_ast_pretty = { path = "../rustc_ast_pretty" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
either = "1.5.0"

View File

@ -341,7 +341,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
/// Report an error because the universal region `fr` was required to outlive
/// `outlived_fr` but it is not known to do so. For example:
///
/// ```compile_fail,E0312
/// ```compile_fail
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
/// ```
///

View File

@ -1398,7 +1398,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// whether any of the constraints were too strong. In particular,
/// we want to check for a case where a universally quantified
/// region exceeded its bounds. Consider:
/// ```compile_fail,E0312
/// ```compile_fail
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
/// ```
/// In this case, returning `x` requires `&'a u32 <: &'b u32`
@ -1451,7 +1451,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// <https://smallcultfollowing.com/babysteps/blog/2019/01/17/polonius-and-region-errors/>
///
/// In the canonical example
/// ```compile_fail,E0312
/// ```compile_fail
/// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
/// ```
/// returning `x` requires `&'a u32 <: &'b u32` and hence we establish (transitively) a

View File

@ -58,6 +58,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
/// Builds the whole `assert!` expression. For example, `let elem = 1; assert!(elem == 1);` expands to:
///
/// ```rust
/// #![feature(generic_assert_internals)]
/// let elem = 1;
/// {
/// #[allow(unused_imports)]
@ -70,7 +71,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
/// __local_bind0
/// } == 1
/// ) {
/// panic!("Assertion failed: elem == 1\nWith captures:\n elem = {}", __capture0)
/// panic!("Assertion failed: elem == 1\nWith captures:\n elem = {:?}", __capture0)
/// }
/// }
/// ```

View File

@ -1114,6 +1114,11 @@ impl<'a> MethodDef<'a> {
/// ```
/// is equivalent to:
/// ```
/// #![feature(core_intrinsics)]
/// enum A {
/// A1,
/// A2(i32)
/// }
/// impl ::core::cmp::PartialEq for A {
/// #[inline]
/// fn eq(&self, other: &A) -> bool {

View File

@ -5,7 +5,6 @@ edition = "2021"
[lib]
test = false
doctest = false
[dependencies]
bitflags = "1.0"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
tracing = "0.1"

View File

@ -56,7 +56,7 @@ macro_rules! throw_validation_failure {
/// This lets you use the patterns as a kind of validation list, asserting which errors
/// can possibly happen:
///
/// ```
/// ```ignore(illustrative)
/// let v = try_validation!(some_fn(), some_path, {
/// Foo | Bar | Baz => { "some failure" },
/// });
@ -65,7 +65,7 @@ macro_rules! throw_validation_failure {
/// The patterns must be of type `UndefinedBehaviorInfo`.
/// An additional expected parameter can also be added to the failure message:
///
/// ```
/// ```ignore(illustrative)
/// let v = try_validation!(some_fn(), some_path, {
/// Foo | Bar | Baz => { "some failure" } expected { "something that wasn't a failure" },
/// });
@ -74,7 +74,7 @@ macro_rules! throw_validation_failure {
/// An additional nicety is that both parameters actually take format args, so you can just write
/// the format string in directly:
///
/// ```
/// ```ignore(illustrative)
/// let v = try_validation!(some_fn(), some_path, {
/// Foo | Bar | Baz => { "{:?}", some_failure } expected { "{}", expected_value },
/// });

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
arrayvec = { version = "0.7", default-features = false }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
fluent-bundle = "0.15.2"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
tracing = "0.1"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_data_structures = { path = "../rustc_data_structures" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_arena = { path = "../rustc_arena" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_ast_pretty = { path = "../rustc_ast_pretty" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_graphviz = { path = "../rustc_graphviz" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
arrayvec = { version = "0.7", default-features = false }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
libloading = "0.7.1"

View File

@ -12,7 +12,6 @@ Rust lexer used by rustc. No stability guarantees are provided.
# Note: do not remove this blank `[lib]` section.
# This will be used when publishing this crate as `rustc-ap-rustc_lexer`.
[lib]
doctest = false
# Note that this crate purposefully does not depend on other rustc crates
[dependencies]

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
libloading = "0.7.1"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_arena = { path = "../rustc_arena" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
polonius-engine = "0.13.0"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
itertools = "0.10.1"

View File

@ -5,4 +5,3 @@ edition = "2021"
[lib]
proc-macro = true
doctest = false

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
smallvec = { version = "1.8.1", features = [ "union", "may_dangle" ] }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
bitflags = "1.0"

View File

@ -5,7 +5,6 @@ build = false
edition = "2021"
[lib]
doctest = false
[dependencies]
libloading = "0.7.1"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
parking_lot = "0.11"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
bitflags = "1.2.1"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_serialize = { path = "../rustc_serialize" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
bitflags = "1.2.1"

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
rustc_parse_format = { path = "../rustc_parse_format" }

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"
[lib]
doctest = false
[dependencies]
bitflags = "1.2.1"