Commit Graph

69455 Commits

Author SHA1 Message Date
kennytm
2c4a0a78b8 Rollup merge of #45783 - kennytm:compiler-test-fixes, r=alexcrichton
Miscellaneous changes for CI, Docker and compiletest.

This PR contains 7 independent commits that improves interaction with CI, Docker and compiletest.

1. a4e5c91cb8 — Forces a newline every 100 dots when testing in quiet mode. Prevents spurious timeouts when abusing the CI to test Android jobs.

2. 1b5aaf22e8 — Use vault.centos.org for dist-powerpc64le-linux, see #45744.

3. 33400fbbcd — Modify `src/ci/docker/run.sh` so that the docker images can be run from Docker Toolbox for Windows on Windows 7. I haven't checked the behavior of the newer Docker for Windows on Windows 10. Also, "can run" does not mean all the test can pass successfully (the UDP tests failed last time I checked)

4. d517668a08 — Don't emit a real warning the linker segfault, which affects UI tests like https://github.com/rust-lang/rust/pull/45489#issuecomment-340134944. Log it instead.

5. 51e2247948 — During run-pass, trim the output if stdout/stderr exceeds 416 KB (top 160 KB + bottom 256 KB). This is an attempt to avoid spurious failures like https://github.com/rust-lang/rust/pull/45384#issuecomment-341755788

6. 9cfdabaf3c — Force `gem update --system` before deploy. This is an attempt to prevent spurious error #44159.

7. eee10cc482 — Tries to print the crash log on macOS on failure. This is an attempt to debug #45230.
2017-11-10 17:07:04 +08:00
bors
d5ff0e6422 Auto merge of #45773 - Badel2:dotdoteq, r=petrochenkov
Add error for `...` in expressions

Follow-up to https://github.com/rust-lang/rust/pull/44709
Tracking issue: https://github.com/rust-lang/rust/issues/28237

* Using `...` in expressions was a warning, now it's an error
* The error message suggests using `..` or `..=` instead, and explains the difference
* Updated remaining occurrences of `...` to `..=`

r? petrochenkov
2017-11-10 01:40:21 +00:00
bors
aa1b0b2391 Auto merge of #45761 - gnzlbg:xsave_feature, r=alexcrichton
[xsave] whitelist xsave target feature

Required for https://github.com/rust-lang-nursery/stdsimd/issues/171
2017-11-09 23:17:13 +00:00
bors
d6b06c63a0 Auto merge of #45757 - mikhail-m1:change-mir-dump-filename, r=nikomatsakis
change MIR dump filenames from `rustc.nodeN...` to `rustc.<DefPath>`

r? @nikomatsakis
2017-11-09 20:46:39 +00:00
bors
f1ea23e2cc Auto merge of #45725 - alexcrichton:std-less-rand, r=dtolnay
Working towards a libc-less (wasm32) libstd

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.
2017-11-09 18:14:48 +00:00
Alex Crichton
5c3fe111d4 std: Avoid use of libc in portable modules
This commit removes usage of the `libc` crate in "portable" modules like
those at the top level and `sys_common`. Instead common types like `*mut
u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as
switching to platform-specific functions like `sys::strlen` instead of
`libc::strlen`.
2017-11-09 07:56:44 -08:00
bors
98e791e7e1 Auto merge of #45741 - oli-obk:refactor_suggestions, r=estebank
Refactor internal suggestion API

~~The only functional change is that whitespace, which is suggested to be added, also gets `^^^^` under it. An example is shown in the tests (the only test that changed).~~

Continuation of #41876

r? @nagisa

the changes are probably best viewed [without whitespace](https://github.com/rust-lang/rust/pull/45741/files?w=1)
2017-11-09 15:42:26 +00:00
Mikhail Modin
0e5c95ebcb change separator from . to - 2017-11-09 12:37:16 +03:00
Mikhail Modin
7a6832de99 change MIR dump filenames from nodeN to DefPath 2017-11-09 12:00:17 +03:00
Alex Crichton
348930eb4e std: Move the cmath module into the sys module
This commit moves the `f32::cmath` and `f64::cmath` modules into the
`sys` module. Note that these are not publicly exported modules, simply
implementation details. These modules are already platform-specific with
shims on MSVC and this is mostly just a reflection of that reality. This
should also help cut down on `#[cfg]` traffic if platforms are brought on
which don't directly support these functions.
2017-11-08 20:42:23 -08:00
Alex Crichton
1ccb50eaa6 std: Change how EBADF is handled in sys
This commit removes the reexport of `EBADF_ERR` as a constant from
libstd's portability facade, instead opting for a platform-specific
function that specifically queries an `io::Error`. Not all platforms may
have a constant for this, so it makes the intent a little more clear
that a code need not be supplied, just an answer to a query.
2017-11-08 20:41:17 -08:00
Alex Crichton
6bc8f164b0 std: Remove rand crate and module
This commit removes the `rand` crate from the standard library facade as
well as the `__rand` module in the standard library. Neither of these
were used in any meaningful way in the standard library itself. The only
need for randomness in libstd is to initialize the thread-local keys of
a `HashMap`, and that unconditionally used `OsRng` defined in the
standard library anyway.

The cruft of the `rand` crate and the extra `rand` support in the
standard library makes libstd slightly more difficult to port to new
platforms, namely WebAssembly which doesn't have any randomness at all
(without interfacing with JS). The purpose of this commit is to clarify
and streamline randomness in libstd, focusing on how it's only required
in one location, hashmap seeds.

Note that the `rand` crate out of tree has almost always been a drop-in
replacement for the `rand` crate in-tree, so any usage (accidental or
purposeful) of the crate in-tree should switch to the `rand` crate on
crates.io. This then also has the further benefit of avoiding
duplication (mostly) between the two crates!
2017-11-08 20:41:17 -08:00
bors
fd9ecfdfd0 Auto merge of #45736 - oli-obk:rvalue_promotable_map, r=nikomatsakis
Use a `Set<T>` instead of a `Map<T, bool>`

r? @nikomatsakis

introduced in #44501
2017-11-09 04:14:28 +00:00
bors
fc77b623d3 Auto merge of #45688 - Gankro:layout-tests, r=alexcrichton
Add reftest that checks the layout of repr(int) on non-c-like enums

This verifies the first layout specified in https://github.com/rust-lang/rfcs/pull/2195

The second (`repr(C)`) layout isn't included here because it doesn't actually exist today. However if/when that's implemented a second test could be fairly easily derived from this one.

CC @eddyb
2017-11-09 00:50:56 +00:00
bors
da3fbe750f Auto merge of #45867 - michaelwoerister:check-ich-stability, r=nikomatsakis
incr.comp.: Verify stability of incr. comp. hashes and clean up various other things.

The main contribution of this PR is that it adds the `-Z incremental-verify-ich` functionality. Normally, when the red-green tracking system determines that a certain query result has not changed, it does not re-compute the incr. comp. hash (ICH) for that query result because that hash is already known. `-Z incremental-verify-ich` tells the compiler to re-hash the query result and compare the new hash against the cached hash. This is a rather thorough way of
- testing hashing implementation stability,
- finding missing `[input]` annotations on `DepNodes`, and
- finding missing read-edges,

since both a missed read and a missing `[input]` annotation can lead to something being marked as green instead of red and thus will have a different hash than it should have.

Case in point, implementing this verification logic and activating it for all `src/test/incremental` tests has revealed several such oversights, all of which are fixed in this PR.

r? @nikomatsakis
2017-11-08 22:27:06 +00:00
bors
02004ef783 Auto merge of #45452 - estebank:colon-typo, r=nikomatsakis
Detect `=` -> `:` typo in let bindings

When encountering a let binding type error, attempt to parse as
initializer instead. If successful, it is likely just a typo:

```rust
fn main() {
    let x: Vec::with_capacity(10);
}
```

```
error: expected type, found `10`
 --> file.rs:3:31
  |
3 |     let x: Vec::with_capacity(10, 20);
  |         --                    ^^
  |         ||
  |         |help: did you mean assign here?: `=`
  |         while parsing the type for `x`
```

Fix #43703.
2017-11-08 20:00:41 +00:00
Alexis Beingessner
e156f89e11 Add reftest that checks the layout of repr(int) on non-c-like enums
This verifies the layout specified in rfc #2195
2017-11-08 12:47:39 -05:00
bors
7ca430df71 Auto merge of #45205 - rkruppe:saturating-casts, r=eddyb
Saturating casts between integers and floats

Introduces a new flag, `-Z saturating-float-casts`, which makes code generation for int->float and float->int casts safe (`undef`-free), implementing [the saturating semantics laid out by](https://github.com/rust-lang/rust/issues/10184#issuecomment-299229143) @jorendorff for float->int casts and overflowing to infinity for `u128::MAX` -> `f32`.
Constant evaluation in trans was changed to behave like HIR const eval already did, i.e., saturate for u128->f32 and report an error for problematic float->int casts.

Many thanks to @eddyb, whose APFloat port simplified many parts of this patch, and made HIR constant evaluation recognize dangerous float casts as mentioned above.
Also thanks to @ActuallyaDeviloper whose branchless implementation served as inspiration for this implementation.

cc #10184 #41799
fixes #45134
2017-11-08 17:27:56 +00:00
bors
6e2977499b Auto merge of #45866 - JohnColanduoni:issue-45731, r=alexcrichton
Disable `mmap`  in `libbacktrace` on Apple platforms

Fixes #45731

libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.
2017-11-08 14:54:03 +00:00
Robin Kruppe
ef0b99930e Disable u128 <-> float tests on emscripten 2017-11-08 14:54:03 +01:00
Michael Woerister
d01b89b948 incr.comp.: Provide session to some more decoding contexts. 2017-11-08 14:52:00 +01:00
bors
4bb96f6519 Auto merge of #45575 - michaelwoerister:tweak-inline-trans-items, r=nikomatsakis
Only instantiate inline- and const-fns if they are referenced (again).

It seems that we have regressed on not translating `#[inline]` functions unless they are actually used. This should bring back this optimization. I also added a regression test this time so it doesn't happen again accidentally.

Fixes #40392.

r? @alexcrichton

UPDATE & PSA
---------------------
This patch **makes translation very lazy** -- in general this is a good thing (we don't want the compiler to do unnecessary work) but it has two consequences:
1. Some error messages are only generated when an item is actually translated. Consequently, this patch will lead to more cases where the compiler will only start emitting errors when the erroneous function is actually used. This has always been true to some extend (e.g. when passing generic values to an intrinsic) but since this is something user-facing it's worth mentioning.
2. When writing tests, one has to make sure that the functions in question are actually generated. In other words, it must not be dead code. This can usually  be achieved by either
    1. making sure the function is exported from the resulting binary or
    2. by making sure the function is called from something that is exported (or `main()`).

Note that it depends on the crate type what functions are exported:
   1. For rlibs and dylibs everything that is reachable from the outside is exported.
   2. For executables, cdylibs, and staticlibs, items are only exported if they are additionally `#[no_mangle]` or have an `#[export_name]`.

The commits in this PR contain many examples of how tests can be updated to comply to the new requirements.
2017-11-08 12:23:34 +00:00
Michael Woerister
d948af1d37 incr.comp.: Remove unused DepKind::WorkProduct. 2017-11-08 11:44:55 +01:00
Michael Woerister
702ce8f0a6 incr.comp.: Remove outdated comment about TraitSelect dep-node. 2017-11-08 11:34:09 +01:00
Michael Woerister
13bc7ad476 incr.comp.: Always verify incr. comp. hashes when running incremental tests. 2017-11-08 11:33:06 +01:00
Michael Woerister
95b0849715 incr.comp.: Adapt nested_items test to new HIR hashing rules. 2017-11-08 11:32:16 +01:00
Michael Woerister
fde0ca5456 incr.comp.: Add some missing reads in HIR map. 2017-11-08 11:31:15 +01:00
Michael Woerister
616b45542b incr.comp.: Make DefSpan an input dep-node so it is not affected by the existing Span/HIR hashing hack. 2017-11-08 11:30:14 +01:00
John Colanduoni
8581b59fb3 Disable mmap in libbacktrace on Apple platforms
Fixes #45731

libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.
2017-11-08 02:28:17 -08:00
Michael Woerister
081ef8ed75 Update fastcall-inreg codegen test so that functions actually get instantiated. 2017-11-08 11:09:48 +01:00
bors
f733f484f8 Auto merge of #45862 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #45582, #45766, #45830, #45849
- Failed merges:
2017-11-08 09:43:27 +00:00
Guillaume Gomez
661c507a2e Rollup merge of #45849 - GuillaumeGomez:more-shortcut, r=QuietMisdreavus
Add "-" shortcut

Fixes #45847.

r? @Havvy
2017-11-08 10:09:18 +01:00
Guillaume Gomez
6392a164f0 Rollup merge of #45830 - pornel:dosglobs, r=dtolnay
Warn about lack of args glob expansion in Windows shell

Because all shells on Linux/macOS expand globs, and even MinGW on Windows emulates this behavior, it's easy to forget that Windows by itself doesn't support glob expansion. This PR documents this cross-platform difference.
2017-11-08 10:09:17 +01:00
Guillaume Gomez
1db95a2354 Rollup merge of #45766 - GuillaumeGomez:trait-methods-list, r=QuietMisdreavus
Add more elements in the sidebar

Fixes #45740.

r? @rust-lang/docs
2017-11-08 10:09:16 +01:00
Guillaume Gomez
0f6e0107c3 Rollup merge of #45582 - GuillaumeGomez:doc-unix-missing-links, r=frewsxcv
Add missing links and examples

r? @rust-lang/docs
2017-11-08 10:09:15 +01:00
bors
49bee9d09a Auto merge of #45735 - tirr-c:issue-45730, r=arielb1
Forbid casting to/from a pointer of unknown kind

Fixes #45730.

Before, it ICE'd when `pointer_kind` encountered `TyInfer`.
2017-11-08 07:12:15 +00:00
bors
e177df3d5c Auto merge of #45379 - cuviper:unit_from_iter, r=alexcrichton
impl FromIterator<()> for ()

This just collapses all unit items from an iterator into one.  This is
more useful when combined with higher-level abstractions, like
collecting to a `Result<(), E>` where you only care about errors:

```rust
use std::io::*;
data = vec![1, 2, 3, 4, 5];
let res: Result<()> = data.iter()
    .map(|x| writeln!(stdout(), "{}", x))
    .collect();
assert!(res.is_ok());
```
2017-11-08 01:32:12 +00:00
Guillaume Gomez
ac398a33a9 Add more elements in the sidebar 2017-11-07 23:45:06 +01:00
Guillaume Gomez
5e116985eb Add "-" shortcut 2017-11-07 22:44:18 +01:00
bors
ee2286149a Auto merge of #44932 - cuviper:unsized-ptr-is_null, r=alexcrichton
Remove `T: Sized` on pointer `as_ref()` and `as_mut()`

`NonZero::is_zero()` was already casting all pointers to thin `*mut u8` to check for null.  The same test on unsized fat pointers can also be used with `as_ref()` and `as_mut()` to get fat references.

(This PR formerly changed `is_null()` too, but checking just the data pointer is not obviously correct for trait objects, especially if `*const self` sorts of methods are ever allowed.)
2017-11-07 20:55:01 +00:00
Guillaume Gomez
cef0573734 Add missing links and examples 2017-11-07 20:42:26 +01:00
Robin Kruppe
ce4664956f Clean up 2017-11-07 20:13:19 +01:00
Robin Kruppe
0a843df264 Implement more efficient saturation 2017-11-07 20:13:19 +01:00
Robin Kruppe
354a5cb250 Make trans const eval error on overflow and NaN, matching HIR const eval. 2017-11-07 20:13:19 +01:00
Robin Kruppe
e999e7b8b2 Extract (f32::MAX + 0.5 ULP) constant 2017-11-07 20:13:19 +01:00
Robin Kruppe
964ba2a6e7 Fix bug in rustc_apfloat 2017-11-07 20:13:19 +01:00
Robin Kruppe
0d6b52c2f3 Saturating casts between integers and floats (both directions).
This affects regular code generation as well as constant evaluation in trans,
but not the HIR constant evaluator because that one returns an error for
overflowing casts and NaN-to-int casts. That error is conservatively
correct and we should be careful to not accept more code in constant
expressions.
The changes to code generation are guarded by a new -Z flag, to be able
to evaluate the performance impact. The trans constant evaluation changes
are unconditional because they have no run time impact and don't affect
type checking either.
2017-11-07 20:13:19 +01:00
bors
7f6417e9b7 Auto merge of #45822 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

- Successful merges: #45470, #45588, #45682, #45714, #45751, #45764, #45778, #45782, #45784
- Failed merges:
2017-11-07 18:04:33 +00:00
Kornel
53de42e333 Warn about non-portability of glob patterns 2017-11-07 17:01:56 +00:00
Michael Woerister
d141abfda7 Always treat #[rustc_std_internal_symbol]s as root TransItems. 2017-11-07 16:41:42 +01:00