Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ This flag can be passed multiple times to nest wrappers.

## Passing arguments to rustc when compiling doctests

You can use the `--doctest-compilation-args` flag if you want to add options when compiling the
You can use the `--doctest-build-arg` flag if you want to add options when compiling the
doctest. For example if you have:

```rust,no_run
Expand Down Expand Up @@ -784,35 +784,19 @@ failures:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
```

But if you can limit the lint level to warning by using `--doctest_compilation_args=--cap-lints=warn`:
But if you can limit the lint level to warning by using `--doctest-build-arg=--cap-lints=warn`:

```console
$ rustdoc --test --doctest_compilation_args=--cap-lints=warn file.rs
$ rustdoc --test --doctest-build-arg=--cap-lints=warn file.rs

running 1 test
test tests/rustdoc-ui/doctest/rustflags.rs - Bar (line 5) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
```

The parsing of arguments works as follows: if it encounters a `"` or a `'`, it will continue
until it finds the character unescaped (without a prepending `\`). If not inside a string, a
whitespace character will also split arguments. Example:

```text
"hello 'a'\" ok" how are 'you today?'
```

will be split as follows:

```text
[
"hello 'a'\" ok",
"how",
"are",
"you today?",
]
```
In order to pass multiple arguments to the underlying compiler,
pass `--doctest-build-arg ARG` for each argument `ARG`.

## `--generate-macro-expansion`: Generate macros expansion toggles in source code

Expand Down
Loading