]> git.lizzy.rs Git - rust.git/commitdiff
add -C to the rustdoc book
authorQuietMisdreavus <grey@quietmisdreavus.net>
Fri, 13 Apr 2018 21:21:27 +0000 (16:21 -0500)
committerQuietMisdreavus <grey@quietmisdreavus.net>
Fri, 13 Apr 2018 21:21:27 +0000 (16:21 -0500)
src/doc/rustdoc/src/command-line-arguments.md

index e51c63cf008981ae5f4cfcfcbdb2f77cd6bb9f85..417608cc5ca0a3e57f76c4cde1c28bc0addfabc3 100644 (file)
@@ -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: