Commit Graph

211 Commits

Author SHA1 Message Date
bjorn3 cba53f0be5 Allow writing metadata without llvm 2017-09-23 12:54:53 +02:00
Vadim Petrochenkov 419069d984 Use recorded types in rustc_privacy 2017-09-23 00:50:46 +03:00
Tamir Duberstein 231d9e7e5d
Remove rustc_bitflags; use the bitflags crate 2017-09-17 14:19:24 -04:00
Tim Neumann eea2f5596a Rollup merge of #44533 - nrc:rustfmt-submod, r=alexcrichton
Add Rustfmt

r? @alexcrichton
2017-09-17 13:19:04 +02:00
Alex Crichton a47ca2291d Rollup merge of #44606 - alexcrichton:update-cmake, r=Mark-Simulacrum
rustbuild: Update `cmake` dependency

Should help suppress some warnings from various repos as `cmake` in the newest
version disables warnings by default.
2017-09-16 17:09:41 -07:00
Alex Crichton 941e172fc1 Rollup merge of #44531 - QuietMisdreavus:bump-gcc, r=alexcrichton
bump gcc for bootstrap

On Windows, the gcc crate would send /Wall to msvc, which would cause
builds to get flooded with warnings, exploding compile times from one
hour to more than 72! The gcc crate version 0.3.54 changes this behavior
to send /W4 instead, which greatly cuts down on cl.exe flooding the
command prompt window with warnings.
2017-09-16 17:09:37 -07:00
bors ae8efdc87d Auto merge of #43017 - durka:stabilize-const-invocation, r=eddyb
Individualize feature gates for const fn invocation

This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward.

This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review.

- `std::cell`
    - `Cell::new`
    - `RefCell::new`
    - `UnsafeCell::new`
- `std::mem`
    - `size_of`
    - `align_of`
- `std::ptr`
    - `null`
    - `null_mut`
- `std::sync`
    - `atomic`
        - `Atomic{Bool,Ptr,Isize,Usize}::new`
    - `once`
        - `Once::new`
- primitives
    - `{integer}::min_value`
    - `{integer}::max_value`

Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time.

After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR.

- `std::sync`
    - `atomic`
        - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT`
    - `once`
        - `ONCE_INIT`
2017-09-16 17:02:17 +00:00
Alex Burka 332c38cd70 bump rls 2017-09-16 15:53:02 +00:00
Alex Crichton 6fdadaaa96 rustbuild: Update `cmake` dependency
Should help suppress some warnings from various repos as `cmake` in the newest
version disables warnings by default.
2017-09-15 09:37:52 -07:00
Corey Farwell 5255ab7e2a Rollup merge of #44430 - steveklabnik:update-mdbook, r=alexcrichton
update mdbook

This eliminates some warnings

r? @alexcrichton
2017-09-14 22:32:37 -04:00
Nick Cameron d0070e85db Build and test Rustfmt 2017-09-13 16:18:45 +12:00
Alex Crichton 921750b8ac rustc: Make `CrateStore` private to `TyCtxt`
This commit removes the `cstore_untracked` method, making the `CrateStore` trait
object entirely private to the `ty/context.rs` module.
2017-09-12 21:14:06 -07:00
QuietMisdreavus 81ebab6fca bump gcc for bootstrap
On Windows, the gcc crate would send /Wall to msvc, which would cause
builds to get flooded with warnings, exploding compile times from one
hour to more than 72! The gcc crate version 0.3.54 changes this behavior
to send /W4 instead, which greatly cuts down on cl.exe flooding the
command prompt window with warnings.
2017-09-12 18:09:26 -05:00
steveklabnik f3d6f120e8 update mdbook 2017-09-11 11:56:35 -04:00
Alex Crichton 38bedfabb9 rustbuild: Switch back to using hard links
The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.

This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.

Hopefully this can help speed up local builds by doing fewer copies all over the
place!
2017-09-09 21:14:44 -07:00
bors 3681220877 Auto merge of #43975 - RalfJung:gcc, r=alexcrichton
use gcc::Build rather than deprecated gcc::Config

I did `cargo update -p gcc` to upgrade only this package. Is there further process that should be follwoed when updating a build dependency from crates.io?

r? @alexcrichton
Fixes #43973
2017-09-06 19:28:36 +00:00
bors 5e9431a6f5 Auto merge of #44176 - nrc:update-rls, r=alexcrichton
Update rls

And expose the `CFG_VERSION` env var to tools so they can determine the version of Rust.

This gets the RLS back on master and so completes the PR dance for the generators PR.

r? @alexcrichton
2017-09-03 00:51:47 +00:00
Ralf Jung 12d84cc009 update gcc crate
Use gcc::Build rather than deprecated gcc::Config.
Fixes #43973
2017-09-02 21:51:18 +02:00
Guillaume Gomez 7befbbc020 Update html-diff-rs version 2017-09-02 00:16:55 +02:00
Alex Crichton 271c63c189 Update git2-rs to fix cross compiles 2017-09-01 07:56:44 -07:00
Alex Crichton 7a2a8d7d60 Update Cargo to 0.23.0 and our lockfile 2017-08-31 07:02:50 -07:00
bors 97b01abf3d Auto merge of #41991 - GuillaumeGomez:rustdoc-html-diff, r=nrc
Add warnings when rustdoc html rendering differs
2017-08-31 08:52:03 +00:00
Guillaume Gomez b501d00090 downgrade libgit2 2017-08-31 09:49:38 +02:00
Nick Cameron 92867d22a8 Update rls 2017-08-31 15:24:23 +12:00
Alex Crichton fd4f362b30 Rollup merge of #44125 - SergioBenitez:master, r=nrc
Initial diagnostic API for proc-macros.

This commit introduces the ability to create and emit `Diagnostic` structures from proc-macros, allowing for proc-macro authors to emit warning, error, note, and help messages just like the compiler does.

The API is somewhat based on the diagnostic API already present in `rustc` with several changes that improve usability. The entry point into the diagnostic API is a new `Diagnostic` type which is primarily created through new `error`, `warning`, `help`, and `note` methods on `Span`. The `Diagnostic` type records the diagnostic level, message, and optional `Span` for the top-level diagnostic and contains a `Vec` of all of the child diagnostics. Child diagnostics can be added through builder methods on `Diagnostic`.

A typical use of the API may look like:

```rust
let token = parse_token();
let val = parse_val();

val.span
    .error(format!("expected A but found {}", val))
    .span_note(token.span, "because of this token")
    .help("consider using a different token")
    .emit();
```

cc @jseyfried @nrc @dtolnay @alexcrichton
2017-08-30 11:11:12 -05:00
Guillaume Gomez 9b26f3ad25 Remove some false positive issues 2017-08-30 11:46:58 +02:00
Guillaume Gomez f2774b7ac3 Print warning whatever the rendering mode 2017-08-30 09:40:43 +02:00
Guillaume Gomez 33d99e526e Set python binary name to python 2.7 2017-08-30 09:40:43 +02:00
Guillaume Gomez e1367ef1b1 Update unstable-crate test 2017-08-30 09:40:43 +02:00
Guillaume Gomez 274543b9ca Add warnings when rustdoc html rendering differs 2017-08-30 09:40:43 +02:00
Alex Crichton a996d5eec7 Tweak rls submodule again 2017-08-28 07:32:25 -07:00
Sergio Benitez 8be132e9d7 Initial diagnostic API for proc-macros.
This commit introduces the ability to create and emit `Diagnostic`
structures from proc-macros, allowing for proc-macro authors to emit
warning, error, note, and help messages just like the compiler does.
2017-08-28 02:58:22 -07:00
Alex Crichton 8a9e32b3fa Update lock file 2017-08-27 18:52:02 -07:00
Tatsuyuki Ishi 611b111139 Move unused-extern-crate to late pass 2017-08-27 19:02:24 +09:00
Mark Simulacrum a947c6a595 Update cargo 2017-08-26 12:30:57 -06:00
Nick Cameron 7cb3f45063 Update RLS and Cargo 2017-08-25 18:12:47 -07:00
Felix S. Klock II 8e79fc72cb Move borrowck error msg construction to module in `rustc_mir` (for later reuse by mir borrowck).
post-rebase: Do not put "(Ast)" suffix in error msg unless passed `-Z borrowck-mir`.
(But unconditionally include "(Mir)" suffix for mir-borrowck errors.)
2017-08-16 15:52:45 +02:00
bjorn3 e5399961c6
Remove some unused dependencies from rustc_trans_utils 2017-08-11 14:00:09 +02:00
bjorn3 b8d5c74c99
It now completely compiles without LLVM!!! 2017-08-11 14:00:07 +02:00
bjorn3 b7314c7caf
Actually make rustc_driver compile without llvm 2017-08-11 14:00:05 +02:00
bjorn3 b43c02b0aa
Make librustc_driver work without librustc_trans 2017-08-11 10:38:31 +02:00
Danek Duvall 9c5397d033 Update libc to 0.2.29
Cargo pulls in libc from crates.io for a number of dependencies, but
0.2.27 is too old to work properly with Solaris.  In particular, it
needs the change to make Solaris' PTHREAD_PROCESS_PRIVATE a 16-bit
integer.
2017-08-07 15:42:30 -07:00
Nick Cameron 17d5f6a086 update rls 2017-08-07 12:16:04 +12:00
bors 2b82b7e50a Auto merge of #43554 - eddyb:apfloat, r=nikomatsakis
APFloat: Rewrite It In Rust and use it for deterministic floating-point CTFE.

As part of the CTFE initiative, we're forced to find a solution for floating-point operations.
By design, IEEE-754 does not explicitly define everything in a deterministic manner, and there is some variability between platforms, at the very least (e.g. NaN payloads).

If types are to evaluate constant expressions involving type (or in the future, const) generics, that evaluation needs to be *fully deterministic*, even across `rustc` host platforms.
That is, if `[T; T::X]` was used in a cross-compiled library, and the evaluation of `T::X` executed a floating-point operation, that operation has to be reproducible on *any other host*, only knowing `T` and the definition of the `X` associated const (as either AST or HIR).

Failure to uphold those rules allows an associated type (e.g. `<Foo as Iterator>::Item`) to be seen as two (or more) different types, depending on the current host, and such type safety violations typically allow writing of a `transmute` in safe code, given enough generics.

The options considered by @rust-lang/compiler were:
1. Ban floating-point operations in generic const-evaluation contexts
2. Emulate floating-point operations in an uniformly deterministic fashion

The former option may seem appealing at first, but floating-point operations *are allowed today*, so they can't be banned wholesale, a distinction has to be made between the code that already works, and future generic contexts. *Moreover*, every computation that succeeded *has to be cached*, otherwise the generic case can be reproduced without any generics. IMO there are too many ways it can go wrong, and a single violation can be enough for an unsoundness hole.
Not to mention we may end up really wanting floating-point operations *anyway*, in CTFE.

I went with the latter option, and seeing how LLVM *already* has a library for this exact purpose (as it needs to perform optimizations independently of host floating-point capabilities), i.e. `APFloat`, that was what I ended up basing this PR on.
But having been burned by the low reusability of bindings that link to LLVM, and because I would *rather* the floating-point operations to be wrong than not deterministic or not memory-safe (`APFloat` does far more pointer juggling than I'm comfortable with), I decided to RIIR.

This way, we have a guarantee of *no* `unsafe` code, a bit more control over the where native floating-point might accidentally be involved, and non-LLVM backends can share it.
I've also ported all the testcases over, *before* any functionality, to catch any mistakes.

Currently the PR replaces all CTFE operations to go through `apfloat::ieee::{Single,Double}`, keeping only the bits of the `f32` / `f64` memory representation in between operations.
Converting from a string also double-checks that `core::num` and `apfloat` agree on the interpretation of a floating-point number literal, in case either of them has any bugs left around.

r? @nikomatsakis
f? @nagisa @est31

<hr/>

Huge thanks to @edef1c for first demoing usable `APFloat` bindings and to @chandlerc for fielding my questions on IRC about `APFloat` peculiarities (also upstreaming some bugfixes).
2017-08-05 13:12:56 +00:00
Nick Cameron 5abbf798e7 Update RLS 2017-08-02 17:53:37 +12:00
Nick Cameron 8c1699d874 Update rls-data dep 2017-08-02 16:57:50 +12:00
Eduard-Mihai Burtescu 877ec94654 rustc_apfloat: introduce the base Float API. 2017-08-02 03:45:03 +03:00
bors e772c28d2e Auto merge of #43506 - michaelwoerister:async-llvm, r=alexcrichton
Run translation and LLVM in parallel when compiling with multiple CGUs

This is still a work in progress but the bulk of the implementation is done, so I thought it would be good to get it in front of more eyes.

This PR makes the compiler start running LLVM while translation is still in progress, effectively allowing for more parallelism towards the end of the compilation pipeline. It also allows the main thread to switch between either translation or running LLVM, which allows to reduce peak memory usage since not all LLVM module have to be kept in memory until linking. This is especially good for incr. comp. but it works just as well when running with `-Ccodegen-units=N`.

In order to help tuning and debugging the work scheduler, the PR adds the `-Ztrans-time-graph` flag which spits out html files that show how work packages where scheduled:
![Building regex](https://user-images.githubusercontent.com/1825894/28679272-f6752bd8-72f2-11e7-8a6c-56207855ce95.png)
(red is translation, green is llvm)

One side effect here is that `-Ztime-passes` might show something not quite correct because trans and LLVM are not strictly separated anymore. I plan to have some special handling there that will try to produce useful output.

One open question is how to determine whether the trans-thread should switch to intermediate LLVM processing.

TODO:
- [x] Restore `-Z time-passes` output for LLVM.
- [x] Update documentation, esp. for work package scheduling.
- [x] Tune the scheduling algorithm.

cc @alexcrichton @rust-lang/compiler
2017-08-01 17:21:24 +00:00
bors df90a54662 Auto merge of #43533 - nrc:macro-save, r=jseyfried,
Three small fixes for save-analysis

First commit does some naive deduplication of macro uses. We end up with lots of duplication here because of the weird way we get this data (we extract a use for every span generated by a macro use).

Second commit is basically a typo fix.

Third commit is a bit interesting, it partially reverts a change from #40939 where temporary variables in format! (and thus println!) got a span with the primary pointing at the value stored into the temporary (e.g., `x` in `println!("...", x)`). If `format!` had a definition it should point at the temporary in the macro def, but since it is built-in, that is not possible (for now), so `DUMMY_SP` is the best we can do (using the span in the callee really breaks save-analysis because it thinks `x` is a definition as well as a reference).

There aren't a test for this stuff because: the deduplication is filtered by any of the users of save-analysis, so it is purely an efficiency change. I couldn't actually find an example for the second commit that we have any machinery to test, and the third commit is tested by the RLS, so there will be a test once I update the RLS version and and uncomment the previously failing tests).

r? @jseyfried
2017-08-01 03:52:14 +00:00
Nick Cameron 27b9182d5b review changes 2017-08-01 15:06:22 +12:00