Skip to content

Add "the Rustc book" #49707

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

Merged
merged 18 commits into from
Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
write docs for targets
  • Loading branch information
steveklabnik committed Apr 16, 2018
commit 00c860e8a908ae09eee0a3508a377fc6b7003d8c
9 changes: 9 additions & 0 deletions src/doc/rustc/src/targets/built-in.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# Built-in Targets

`rustc` ships with the ability to compile to many targets automatically, we
call these "built-in" targets, and they generally correspond to targets that
the team is supporting directly.

To see the list of built-in targets, you can run `rustc --print target-list`,
or look at [the API
docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/#modules).
Each module there defines a builder for a particular target.
16 changes: 16 additions & 0 deletions src/doc/rustc/src/targets/custom.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# Custom Targets

If you'd like to build for a target that is not yet supported by `rustc`, you can use a
"custom target specification" to define a target. These target specification files
are JSON. To see the JSON for the host target, you can run:

```bash
$ rustc +nightly -Z unstable-options --print target-spec-json
```

To see it for a different target, add the `--target` flag:

```bash
$ rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json
```

To use a custom target, see [`xargo`](https://github.com/japaric/xargo).
13 changes: 13 additions & 0 deletions src/doc/rustc/src/targets/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# Targets

`rustc` is a cross-compiler by default. This means that you can use any compiler to build for any
architecture. The list of *targets* are the possible architectures that you can build for.

You can see the API docs for a given target
[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/struct.Target.html), all
Copy link
Member

Choose a reason for hiding this comment

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

This line seems a little off. My reading implies "this is the standard library available under any given target", but it's more like "these are the things that a target can specify".

of these options can be set on a per-target basis.

To compile to a particular target, use the `--target` flag:

```bash
$ rustc src/main.rs --target=wasm32-unknown-unknown
```