Skip to content

dev-guide instructions for running tests are incomplete #2251

@tlyu

Description

@tlyu

It's not completely clear whether this is a Reference bug, or a bug in mdBook.

The provided build setup instructions in the dev-guide are incomplete. Context: I currently have my rustup default toolchain set to stable. Installing the nightly toolchain and setting a rustup override in the reference directory (as instructed) seems to be sufficient for building, but running tests doesn't always work. Setting rustup default nightly seems to be necessary to run the tests directly from mdbook test.

Running cargo xtask test-all succeeds for some reason, even without rustup default nightly. Directly running mdbook test from the reference directory succeeds if rustup default nightly has been set, or if RUSTUP_TOOLCHAIN=nightly is set in the environment.

As far as I can tell from its source code, mdbook test uses a temporary directory (based on the OS default), which in general won't be subject to the override set in the reference directory. I don't know what additional setup is being propagated either from cargo run or xtask that is causing cargo xtask test-all to succeed.

macOS 15.7.5 (24G624) in case that matters.

Sample failure output

test expressions/operator-expr.md - Operator_expressions::Type_cast_expressions::Semantics::Pointer_to_pointer_cast (line 2074) - compile fail ... ok

failures:

---- expressions/operator-expr.md - Operator_expressions::The_try_propagation_expression (line 785) stdout ----
error[E0554]: `#![feature]` may not be used on the stable release channel
   --> expressions/operator-expr.md:785:1
    |
785 | #![ feature(try_trait_v2) ]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0554`.
Couldn't compile the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions