Commit Graph

1685 Commits

Author SHA1 Message Date
Alex Crichton
40aaa65734 test: Verify all sysroot crates are unstable
As we continue to add more crates to the compiler and use them to implement
various features we want to be sure we're not accidentally expanding the API
surface area of the compiler! To that end this commit adds a new `run-make` test
which will attempt to `extern crate foo` all crates in the sysroot, verifying
that they're all unstable.

This commit discovered that the `std_shim` and `test_shim` crates were
accidentally stable and fixes the situation by deleting those shims. The shims
are no longer necessary due to changes in Cargo that have happened since they
were originally incepted.
2017-02-21 11:38:17 -08:00
Jorge Aparicio
9af6aa3889 sanitizer support 2017-02-08 18:51:43 -05:00
Vadim Petrochenkov
b4abb72ef0 Fixup crate versions 2017-02-02 23:55:42 +03:00
Aidan Hobson Sayers
70d2372ada Expose a feature to force use of alloc_system, teach rustbuild
This fixes jemalloc-less local rebuilds, where we tell cargo that
we're actually stage1
2017-01-16 03:06:45 +00:00
Alex Crichton
a8535ce9d1 std: Don't build docs for misc facade crates
Retain the same behavior as stable.

Closes #38319
2016-12-30 10:00:33 -08:00
Alex Crichton
2186660b51 Update the bootstrap compiler
Now that we've got a beta build, let's use it!
2016-11-30 10:38:08 -08:00
bors
9003e1ab6a Auto merge of #38008 - bluss:rustbuild-benches, r=alexcrichton
Add rustbuild command `bench`

Add command bench to rustbuild, so that `./x.py bench <path>` can compile and run benchmarks.

`./x.py bench --stage 1 src/libcollections` and `./x.py bench --stage 1 src/libstd` should both compile well. Just `./x.py bench` runs all benchmarks for the libstd crates.

Fixes #37897
2016-11-26 12:32:19 -06:00
Ulrik Sverdrup
17cb7bdd83 rustbuild: Add bench = false to std shim crates 2016-11-26 00:26:44 +01:00
Jorge Aparicio
ba07a1b58d std: make compilation of libpanic_unwind optional via a Cargo feature
with this feature disabled, you can (Cargo) compile std with
"panic=abort"

rustbuild will build std with this feature enabled, to maintain the
status quo

fixes #37252
2016-11-23 21:49:54 -05:00
Ahmed Charles
9ca382f95f Use workspaces and switch to a single Cargo.lock.
This involves hacking the code used to run cargo test on various
packages, because it reads Cargo.lock to determine which packages should
be tested. This change implements a blacklist, since that will catch new
crates when they are added in the future.
2016-10-07 12:04:32 -07:00
Alex Crichton
2148bdfcc7 rustc: Rename rustc_macro to proc_macro
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
which reflects the general consensus of #35900. A follow up PR to Cargo will be
required to purge the `rustc-macro` name as well.
2016-10-06 11:07:23 -07:00
Eduard Burtescu
a96abca2a4 rustc_metadata: replace RBML with a simple and type-safe scheme. 2016-09-20 20:08:05 +03:00
Eduard Burtescu
0863012fb9 Remove librbml and the RBML-tagged auto-encoder/decoder. 2016-09-20 20:08:01 +03:00
bors
8394685b83 Auto merge of #36441 - alexcrichton:rustbuild-target, r=brson
rustbuild: Fix cross-compiles to MinGW on Linux

Closes #36290
Closes #36291
2016-09-16 04:01:01 -07:00
Alex Crichton
5841678f51 rustbuild: Fix cross-compiles to MinGW on Linux
Closes #36290
Closes #36291
2016-09-12 22:41:17 -07:00
Jorge Aparicio
3fd5fdd8d3 crate-ify compiler-rt into compiler-builtins
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics. Users of the `std` have to do nothing
extra as the std crate depends on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400
2016-09-12 21:22:15 -07:00
Alex Crichton
ecc6c39e87 rustc: Implement custom derive (macros 1.1)
This commit is an implementation of [RFC 1681] which adds support to the
compiler for first-class user-define custom `#[derive]` modes with a far more
stable API than plugins have today.

[RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md

The main features added by this commit are:

* A new `rustc-macro` crate-type. This crate type represents one which will
  provide custom `derive` implementations and perhaps eventually flower into the
  implementation of macros 2.0 as well.

* A new `rustc_macro` crate in the standard distribution. This crate will
  provide the runtime interface between macro crates and the compiler. The API
  here is particularly conservative right now but has quite a bit of room to
  expand into any manner of APIs required by macro authors.

* The ability to load new derive modes through the `#[macro_use]` annotations on
  other crates.

All support added here is gated behind the `rustc_macro` feature gate, both for
the library support (the `rustc_macro` crate) as well as the language features.

There are a few minor differences from the implementation outlined in the RFC,
such as the `rustc_macro` crate being available as a dylib and all symbols are
`dlsym`'d directly instead of having a shim compiled. These should only affect
the implementation, however, not the public interface.

This commit also ended up touching a lot of code related to `#[derive]`, making
a few notable changes:

* Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
  sure how to keep this behavior and *not* expose it to custom derive.

* Derive attributes no longer have access to unstable features by default, they
  have to opt in on a granular level.

* The `derive(Copy,Clone)` optimization is now done through another "obscure
  attribute" which is just intended to ferry along in the compiler that such an
  optimization is possible. The `derive(PartialEq,Eq)` optimization was also
  updated to do something similar.

---

One part of this PR which needs to be improved before stabilizing are the errors
and exact interfaces here. The error messages are relatively poor quality and
there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
not working by default. The custom attributes added by the compiler end up
becoming unstable again when going through a custom impl.

Hopefully though this is enough to start allowing experimentation on crates.io!

syntax-[breaking-change]
2016-09-02 12:52:56 -07:00
Michael Woerister
004a7eb127 Fix rustbuild 2016-08-29 14:27:40 -04:00
Brian Anderson
144cc7285f Update cargo bootstrap rev and add fix for cargo#3005 2016-08-23 00:05:33 +00:00
cgswords
98c8e0a05d Proc_macro is alive 2016-08-16 13:17:36 -07:00
Timon Van Overveldt
57cad5722d Update gcc crate dependency to 0.3.27.
This is to pull in changes to support ARM MUSL targets.

This change also commits a couple of other cargo-generated changes
to other dependencies in the various Cargo.toml files.
2016-07-30 15:39:13 -05:00
bors
7580534c3a Auto merge of #35051 - japaric:backtrace, r=alexcrichton
rustbuild: make backtraces (RUST_BACKTRACE) optional

but keep them enabled by default to maintain the status quo.

When disabled shaves ~56KB off every x86_64-unknown-linux-gnu
binary.

To disable backtraces you have to use a config.toml (see
src/bootstrap/config.toml.example for details) when building rustc/std:

$ python bootstrap.py --config=config.toml

---

r? @alexcrichton
cc rust-lang/rfcs#1417
2016-07-30 00:08:24 -07:00
Jorge Aparicio
d464422c0a rustbuild: make backtraces (RUST_BACKTRACE) optional
but keep them enabled by default to maintain the status quo.

When disabled shaves ~56KB off every x86_64-unknown-linux-gnu
binary.

To disable backtraces you have to use a config.toml (see
src/bootstrap/config.toml.example for details) when building rustc/std:

$ python bootstrap.py --config=config.toml
2016-07-26 15:21:25 -05:00
Ariel Ben-Yehuda
37c569627c refactor constant evaluation error reporting
Refactor constant evaluation to use a single error reporting function
that reports a type-error-like message.

Also, unify all error codes with the "constant evaluation error" message
to just E0080, and similarly for a few other duplicate codes. The old
situation was a total mess, and now that we have *something* we can
further iterate on the UX.
2016-07-22 14:32:56 +03:00
Oliver Schneider
9d33ce58b1
evaluate the array length of fixed size array types in rustdoc 2016-07-13 10:35:58 +02:00
Ariel Ben-Yehuda
bff28ec468 refactor rustc_metadata to use CamelCase names and IndexVec 2016-06-28 23:41:09 +03:00
Jeffrey Seyfried
360dcae419 Update src/rustc/Cargo.lock 2016-06-27 23:40:04 +00:00
Ariel Ben-Yehuda
ce4fdefbd8 fix issues 2016-06-09 21:47:58 +03:00
Ariel Ben-Yehuda
2de6ea7a35 fix Cargo.lock 2016-06-09 01:05:37 +03:00
Vadim Petrochenkov
731144b95a sanity -> validation
Add test for `::super` in import prefix
2016-05-28 20:52:49 +03:00
Alex Crichton
bb9062a296 rustbuild: Add support for crate tests + doctests
This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590
2016-05-12 08:52:20 -07:00
Alex Crichton
8d65591cf2 rustbuild: Tighten dependencies of build scripts
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that
they've all got the right list of dependencies.
2016-05-10 23:41:19 -07:00
Alex Crichton
0ec321f7b5 rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.

[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md

Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.

With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.

Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-05-09 08:22:36 -07:00
Manish Goregaokar
0cb966fa3b
Rollup merge of #33404 - gsquire:cargo-lock, r=alexcrichton
Cargo lock tidy check

A rebased PR for #32901
2016-05-08 07:00:07 -07:00
Eduard Burtescu
78884b7659 mir: qualify and promote constants. 2016-05-07 19:14:28 +03:00
Garrett Squire
b3de042146 add a check to make tidy to ensure cargo lock file is updated 2016-05-04 10:25:17 -07:00
Tamir Duberstein
322f3a3eaa rustc: update Cargo.lock 2016-04-24 19:38:49 -04:00
Alex Crichton
ede8944ea7 rustbuild: Run all markdown documentation tests
This commit adds support to rustbuild to run all documentation tests, basically
running `rustdoc --test` over all our documentation. This also includes support
for running the error index tests.
2016-04-19 09:52:56 -07:00
bors
74b3684d00 Auto merge of #32895 - alexcrichton:rustbuild-beta, r=brson
rustbuild: Fix handling of the bootstrap key

Bring the calculation logic in line with the makefiles and also set the
RUSTC_BOOTSTRAP_KEY environment variable to enable the bootstrap on the stable
compiler.
2016-04-15 04:10:11 -07:00
Alex Crichton
7bfaeaaf9c tidy: Add a check to ensure Cargo.toml is in sync
This verifies that the crates listed in the `[dependencies]` section of
`Cargo.toml` are a subset of the crates listed in `lib.rs` for our in-tree
crates. This should help ensure that when we refactor crates over time we keep
these dependency lists in sync.
2016-04-12 15:55:14 -07:00
Alex Crichton
8efbfae6bf rustbuild: Fix handling of the bootstrap key
Bring the calculation logic in line with the makefiles and also set the
RUSTC_BOOTSTRAP_KEY environment variable to enable the bootstrap on the stable
compiler.
2016-04-11 17:16:32 -07:00
Eduard Burtescu
8b0937293b rustc: move rustc_front to rustc::hir. 2016-04-06 09:01:55 +03:00
bors
3ec71b033a Auto merge of #32598 - alexcrichton:rustbuild-osx, r=aturon
rustbuild: Fix compile on OSX for 10.7

This commit should help configure our OSX rustbuild builder for targeting 10.7.
A key part of this is using `libc++` instead of `libstdc++` as apparently it's
more filled out and otherwise LLVM's cmake configuration would fail.
2016-04-02 10:30:03 -07:00
Alex Crichton
3d6340ffe2 rustbuild: Fix dist for non-host targets
The `rust-std` package that we produce is expected to have not only the standard
library but also libtest for compiling unit tests. Unfortunately this does not
currently happen due to the way rustbuild is structured.

There are currently two main stages of compilation in rustbuild, one for the
standard library and one for the compiler. This is primarily done to allow us to
fill in the sysroot right after the standard library has finished compiling to
continue compiling the rest of the crates. Consequently the entire compiler does
not have to explicitly depend on the standard library, and this also should
allow us to pull in crates.io dependencies into the build in the future because
they'll just naturally build against the std we just produced.

These phases, however, do not represent a cross-compiled build. Target-only
builds also require libtest, and libtest is currently part of the
all-encompassing "compiler build". There's unfortunately no way to learn about
just libtest and its dependencies (in a great and robust fashion) so to ensure
that we can copy the right artifacts over this commit introduces a new build
step, libtest.

The new libtest build step has documentation, dist, and link steps as std/rustc
already do. The compiler now depends on libtest instead of libstd, and all
compiler crates can now assume that test and its dependencies are implicitly
part of the sysroot (hence explicit dependencies being removed). This makes the
build a tad less parallel as in theory many rustc crates can be compiled in
parallel with libtest, but this likely isn't where we really need parallelism
either (all the time is still spent in the compiler).

All in all this allows the `dist-std` step to depend on both libstd and libtest,
so `rust-std` packages produced by rustbuild should start having both the
standard library and libtest.

Closes #32523
2016-04-01 10:18:36 -07:00
Alex Crichton
08ca5d9558 rustbuild: Fix compile on OSX for 10.7
This commit should help configure our OSX rustbuild builder for targeting 10.7.
A key part of this is using `libc++` instead of `libstdc++` as apparently it's
more filled out and otherwise LLVM's cmake configuration would fail.
2016-03-29 21:51:00 -07:00
Felix S. Klock II
782c0cf4a2 Add rustbuild dependency from rustc_borrowck upon rustc_mir crate. 2016-03-22 18:09:57 +01:00
Alex Crichton
6cc06b36c4 rustbuild: Implement make dist
This commit implements the `make dist` command in the new rustbuild build
system, porting over `dist.mk` and `prepare.mk` into Rust. There's a huge amount
of complexity between those two files, not all of which is likely justified, so
the Rust implementation is *much* smaller.

Currently the implementation still shells out to rust-installer as well as some
python scripts, but ideally we'd rewrite it all in the future to not shell out
and be in Rust proper.
2016-03-16 17:15:55 -07:00
Alex Crichton
8cd1c17d90 rustbuild: Refactor stage arguments away
The facet of a stage is rarely relevant when running a tool or building
something, it's all a question of what stage the *compiler* is built in. We've
already got a nice handy `Compiler` structure to carry this information, so
let's use it!

This refactors the signature of the `Build::cargo` function two ways:

1. The `stage` argument is removed, this was just duplicated with the `compiler`
   argument's stage field.
2. The `target` argument is now required. This was a bug where if the `--target`
   flag isn't passed then the snapshot stage0 compiler is always used, so we
   won't pick up any changes.

Much of the other changes in this commit are just propagating these decisions
outwards. For example many of the `Step` variants no longer have a stage
argument as they're baked into the compiler.
2016-03-14 14:56:49 -07:00
Alex Crichton
16fefc5ead rustbuild: Fix stage1 rustdoc
Just always build stage1 rustdoc, it's really not that much more to build as
it's essentially just one library.
2016-03-08 13:44:14 -08:00
Alex Crichton
ee6df13f0c rustbuild: Move rustbook to a src/tools directory
We've actually got quite a few tools that are compiled as part of our build,
let's start housing them all in a `tools` directory.
2016-03-08 11:52:09 -08:00