diff options
| author | bors <bors@rust-lang.org> | 2018-04-16 05:00:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-04-16 05:00:14 +0000 |
| commit | 3e70dfd65542a09db3a5ae31e6334a0f7cc20035 (patch) | |
| tree | e60d0c86ffa04becf1b98c0abc4973ce1af2231c /src/doc | |
| parent | 748c549185651a886de46110d6d9b616f3c09fef (diff) | |
| parent | a5456bdd87d77deff6002be7632e6e2f307b4cfa (diff) | |
| download | rust-3e70dfd65542a09db3a5ae31e6334a0f7cc20035.tar.gz rust-3e70dfd65542a09db3a5ae31e6334a0f7cc20035.zip | |
Auto merge of #49956 - QuietMisdreavus:rustdoc-codegen, r=GuillaumeGomez
rustdoc: port the -C option from rustc Blocked on https://github.com/rust-lang/rust/pull/49864. The included test won't work without those changes, so this PR includes those commits as well. When documenting items that require certain target features, it helps to be able to force those target features into existence. Rather than include a flag just to parse those features, i instead decided to port the `-C` flag from rustc in its entirety. It takes the same parameters, because it runs through the same parsing function. This has the added benefit of being able to control the codegen of doctests as well. One concern i have with the flag is that i set it to stable here. My rationale is that it is a direct port of functionality on rustc that is currently stable, used only in mechanisms that it is originally used for. If needed, i can set it back to be unstable.
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustdoc/src/command-line-arguments.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index e51c63cf008..417608cc5ca 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -141,6 +141,31 @@ Similar to `--library-path`, `--extern` is about specifying the location of a dependency. `--library-path` provides directories to search in, `--extern` instead lets you specify exactly which dependency is located where. +## `-C`/`--codegen`: pass codegen options to rustc + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -C target_feature=+avx +$ rustdoc src/lib.rs --codegen target_feature=+avx + +$ rustdoc --test src/lib.rs -C target_feature=+avx +$ rustdoc --test src/lib.rs --codegen target_feature=+avx + +$ rustdoc --test README.md -C target_feature=+avx +$ rustdoc --test README.md --codegen target_feature=+avx +``` + +When rustdoc generates documentation, looks for documentation tests, or executes documentation +tests, it needs to compile some rust code, at least part-way. This flag allows you to tell rustdoc +to provide some extra codegen options to rustc when it runs these compilations. Most of the time, +these options won't affect a regular documentation run, but if something depends on target features +to be enabled, or documentation tests need to use some additional options, this flag allows you to +affect that. + +The arguments to this flag are the same as those for the `-C` flag on rustc. Run `rustc -C help` to +get the full list. + ## `--passes`: add more rustdoc passes Using this flag looks like this: |
