Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start documenting rustc #209

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
- [Behavior considered undefined](behavior-considered-undefined.md)
- [Behavior not considered unsafe](behavior-not-considered-unsafe.md)

- [Tools](tools.md)
- [rustc](tools/rustc.md)
- [rustdoc](tools/rustdoc.md)
- [cargo](tools/cargo.md)

[Appendix: Influences](influences.md)

[Appendix: As-yet-undocumented Features](undocumented.md)
Expand Down
15 changes: 15 additions & 0 deletions src/tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tools

The official Rust tool suite contains a variety of tools for dealing with Rust
code and associated artifacts.

[`rustc`][rustc] is the Rust language compiler.

[`rustdoc`][rustdoc] is the documentation tool which generates documentation from Rust
source code.

`cargo` is the Rust package manager.

[rustc]: tools/rustc.html
[rustdoc]: tools/rustdoc.html
[cargo]: tools/cargo.html
3 changes: 3 additions & 0 deletions src/tools/cargo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Cargo

`cargo` has its own reference [here](../cargo/reference/index.html).
49 changes: 49 additions & 0 deletions src/tools/rustc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# `rustc`

The Rust compiler has many options and can accept a wide variety of arguments,
and its behavior can vary depending on the values of several environment
variables.

We document the compiler's command-line options, arguments, and operative
environment variables here.

Some discussions of environment variables exists in the [Linkage](linkage.html)
chapter and the [Operator expressions](expressions/operator-expr.html#overflow)
chapter.

## Lint options

-W, --warn OPT Set lint warnings
-A, --allow OPT Set lint allowed
-D, --deny OPT Set lint denied
-F, --forbid OPT Set lint forbidden
--cap-lints LEVEL
Set the most restrictive lint level. More restrictive
lints are capped at this level

## Codegen options

`rustc` provides many options for codegen, all accessible as arguments to the
`-C` option.

### Debug info

To produce output with debug info use the `-C debuginfo=val` option, where
`val` may be one of `0`, `1`, or `2`. The default is `0`.
- `0` means output no debug info
- `1` means output only line tables
- `2` means output full debug info with variable and type information

Providing the `-g` option is equivalent to `-C debuginfo=2`. If both `-g` and
`-C debuginfo` are provided, the compiler will complain.

### Optimization

To produce optimized output, use the `-C opt-level=val` option, where `val`
may be one of `0`, `1`, `2`, `3`. The default is `0`.

The numbers indicate increasing levels of optimization for execution speed,
with `0` meaning no optimizations, and `3` meaning aggressive optimization.

Providing the option `-O` is equivalent to `-C opt-level=2`. If both `-O` and
`-C opt-level` are provided, the compiler will complain.
3 changes: 3 additions & 0 deletions src/tools/rustdoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `rustdoc`

`rustdoc` has its own book [here](../rustdoc/index.html).
6 changes: 0 additions & 6 deletions src/undocumented.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ to shrink!
specified.
- [Flexible target specification] - Some---but not all---flags are documented
in [Conditional compilation]
- [Require parentheses for chained comparisons]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be part of a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no: that feature is already documented here, so I'm just cleaning this list up.

- [`dllimport`] - one element mentioned but not explained at [FFI attributes]
- [define `crt_link`]
- [define `unaligned_access`]

[`libstd` facade]: https://github.com/rust-lang/rfcs/pull/40
[Trait reform]: https://github.com/rust-lang/rfcs/pull/48
[Attributes on `match` arms]: https://github.com/rust-lang/rfcs/pull/49
[Flexible target specification]: https://github.com/rust-lang/rfcs/pull/131
[Conditional compilation]: attributes.html#conditional-compilation
[Unambiguous function call syntax]: https://github.com/rust-lang/rfcs/pull/132
[Require parentheses for chained comparisons]: https://github.com/rust-lang/rfcs/pull/558
[Integer overflow not `unsafe`]: https://github.com/rust-lang/rfcs/pull/560
[`dllimport`]: https://github.com/rust-lang/rfcs/pull/1717
[FFI attributes]: attributes.html#ffi-attributes
[define `crt_link`]: https://github.com/rust-lang/rfcs/pull/1721
[define `unaligned_access`]: https://github.com/rust-lang/rfcs/pull/1725