Commit Graph

77455 Commits

Author SHA1 Message Date
Manish Goregaokar
56ace0aac2 Pass down NodeId to resolve_path 2018-04-19 21:26:24 -07:00
Kurtis Nusbaum
320fdaa942 add EDITIONS_NAME_LIST, make edition tracked, enforce that only stable editions are allowed to be used on non-nightly builds 2018-04-19 21:03:21 -07:00
bors
f4a3df1f76 Auto merge of #50051 - nnethercote:no-env-var, r=Mark-Simulacrum
Lazily evaluate EvalErrorKind::*.into() calls.

eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.

This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.

Output from rustc-perf, comparing stage 2 builds with jemalloc disabled:

<details>

```
coercions
	avg: -1.8%	min: -6.0%	max: -0.0%
helloworld-opt
	avg: -3.7%	min: -4.0%	max: -3.4%
helloworld
	avg: -3.7%	min: -3.9%	max: -3.5%
parser
	avg: -3.5%	min: -3.9%	max: -3.1%
unify-linearly-opt
	avg: -3.2%	min: -3.8%	max: -2.8%
unify-linearly
	avg: -3.2%	min: -3.7%	max: -2.8%
parser-opt
	avg: -3.2%	min: -3.6%	max: -2.8%
clap-rs
	avg: -0.9%	min: -3.6%	max: 0.1%
encoding
	avg: -1.9%	min: -3.0%	max: -1.2%
clap-rs-opt
	avg: -0.8%	min: -2.7%	max: -0.1%
helloworld-check
	avg: -1.9%	min: -2.2%	max: -1.7%
deeply-nested-check
	avg: -1.4%	min: -2.1%	max: -0.9%
issue-46449-opt
	avg: -0.7%	min: -2.0%	max: -0.3%
unify-linearly-check
	avg: -1.5%	min: -1.9%	max: -1.2%
issue-46449
	avg: -1.0%	min: -1.8%	max: -0.8%
deeply-nested-opt
	avg: -0.7%	min: -1.7%	max: -0.2%
deeply-nested
	avg: -1.0%	min: -1.6%	max: -0.6%
parser-check
	avg: -1.3%	min: -1.6%	max: -0.8%
encoding-check
	avg: -1.5%	min: -1.6%	max: -1.2%
tuple-stress
	avg: -0.9%	min: -1.5%	max: 0.0%
tuple-stress-opt
	avg: -1.0%	min: -1.5%	max: -0.3%
issue-46449-check
	avg: -1.3%	min: -1.4%	max: -1.0%
encoding-opt
	avg: -1.1%	min: -1.2%	max: -0.9%
regression-31157
	avg: -0.7%	min: -1.2%	max: -0.2%
regression-31157-check
	avg: -0.8%	min: -1.2%	max: -0.5%
futures-check
	avg: -0.8%	min: -1.2%	max: -0.4%
unused-warnings-opt
	avg: -1.0%	min: -1.2%	max: -0.9%
unused-warnings
	avg: -1.0%	min: -1.1%	max: -0.9%
coercions-opt
	avg: -0.6%	min: -1.0%	max: -0.2%
inflate-check
	avg: -0.4%	min: -0.9%	max: -0.1%
regex-check
	avg: -0.8%	min: -0.9%	max: -0.5%
piston-image-check
	avg: -0.8%	min: -0.9%	max: -0.8%
deep-vector
	avg: -0.3%	min: -0.9%	max: 0.1%
futures
	avg: -0.5%	min: -0.8%	max: -0.2%
futures-opt
	avg: -0.5%	min: -0.7%	max: -0.1%
html5ever
	avg: -0.6%	min: -0.7%	max: -0.4%
tokio-webpush-simple-check
	avg: -0.2%	min: -0.7%	max: 0.1%
piston-image-opt
	avg: -0.3%	min: -0.7%	max: -0.1%
regex
	avg: -0.4%	min: -0.7%	max: -0.1%
piston-image
	avg: -0.4%	min: -0.7%	max: -0.2%
regex-opt
	avg: -0.3%	min: -0.7%	max: 0.1%
tokio-webpush-simple-opt
	avg: -0.2%	min: -0.6%	max: 0.0%
coercions-check
	avg: -0.3%	min: -0.6%	max: -0.1%
hyper
	avg: -0.4%	min: -0.6%	max: -0.2%
syn-opt
	avg: -0.3%	min: -0.6%	max: -0.0%
hyper-check
	avg: -0.5%	min: -0.6%	max: -0.3%
syn-check
	avg: -0.4%	min: -0.5%	max: -0.2%
hyper-opt
	avg: -0.3%	min: -0.5%	max: -0.1%
html5ever-opt
	avg: -0.3%	min: -0.5%	max: -0.2%
syn
	avg: -0.2%	min: -0.4%	max: -0.1%
deep-vector-opt
	avg: -0.2%	min: -0.4%	max: 0.1%
tokio-webpush-simple
	avg: -0.2%	min: -0.4%	max: -0.1%
inflate
	avg: -0.2%	min: -0.4%	max: -0.1%
inflate-opt
	avg: -0.2%	min: -0.4%	max: -0.0%
regression-31157-opt
	avg: -0.1%	min: -0.4%	max: 0.0%
html5ever-check
	avg: -0.3%	min: -0.4%	max: -0.2%
unused-warnings-check
	avg: -0.2%	min: -0.3%	max: -0.2%
script-servo-check
	avg: -0.1%	min: -0.3%	max: 0.0%
crates.io-check
	avg: -0.2%	min: -0.3%	max: -0.0%
script-servo
	avg: -0.1%	min: -0.2%	max: 0.0%
clap-rs-check
	avg: 0.0%	min: -0.1%	max: 0.2%
deep-vector-check
	avg: -0.0%	min: -0.2%	max: 0.2%
tuple-stress-check
	avg: -0.1%	min: -0.2%	max: 0.0%
crates.io-opt
	avg: -0.1%	min: -0.2%	max: 0.0%
crates.io
	avg: -0.1%	min: -0.2%	max: -0.0%
script-servo-opt
	avg: -0.0%	min: -0.1%	max: 0.0%
```

</details>
2018-04-20 01:41:34 +00:00
Alex Crichton
81a643731d rustc: Blanket whitelist #[target_feature]
This commit transitions the `target_feature` attribute from `Normal` to
`Whitelisted`. Discovered in #50095 the fact of whether this attribute is used
or not is dependent on typechecking running and executing `check_name`, but
incremental compilation doesn't currently account for this, meaning that the
attribute ends up being flagged as unused when it shouldn't be.

I was a little too ambitious it seems hoping that `Normal` could be used, so
instead this transitions to `Whitelisted` to be the same as other codegen
attributes like `#[inline]`

Closes #50095
2018-04-19 17:54:20 -07:00
Alex Crichton
fc9da8f795 rustc: Whitelist upstream target_features
When compiling crates we'll be calculating and parsing `#[target_feature]` for
upstream crates. We'll also be checking the stability of listed features, but we
only want to check the listed stability during the actual crate that wrote the
relevant code. This commit updates the `target_feature` process to ignore
foreign `DefId` instances and only check the feature whitelist for local
functions.

Closes #50094
2018-04-19 17:54:13 -07:00
Mike Hommey
64f5233c44 Adapt the owned_box lang item to allow a Box type with defaulted parameters
A Box type with associated allocator would, on its own, be a backwards
incompatible change, because of the additional parameter, but if that
additional parameter has a default, then backwards compatibility with
the current definition of the type is preserved.

But the owned_box lang item currently doesn't allow such extra
parameters, so add support for this.
2018-04-20 09:49:13 +09:00
Mike Hommey
6614fa0981 Support an alternative form for box_free
box_free currently takes a pointer. With the prospect of the Box type
definition changing in the future to include an allocator, box_free will
also need to be aware of this. In order to prepare for that future, we
allow box_free to take a form where its argument are the fields of the
Box.

e.g. if Box is defined as `Box(A, B, C)`, then box_free signature
becomes `box_free(a: A, b: B, c: C)`.

We however still allow the current form (taking a pointer), so that the
same compiler can handle both forms, which helps with bootstrap.
2018-04-20 09:43:52 +09:00
Mike Hommey
dfa611146c Remove the explicit box_free type check
Because box_free is now passed a pointer instead of a Box, we can stop
relying on TypeChecked::check_box_free_inputs, because
TypeChecker::check_call_inputs should be enough, like for all other
function calls.

It seems it was not actually reached anyways in cases where it would
have made a difference. (issue #50071)
2018-04-20 09:36:51 +09:00
Wesley Wiser
4a77d35c1e Remove HIR inlining
Fixes #49690
2018-04-19 20:33:18 -04:00
Mike Hommey
43b24c6c83 Pass the right type to box_free() in MIR
Currently, MIR just passes the raw Box to box_free(), which happens to
work because practically, it's the same thing. But that might not be
true in the future, with Box<T, A: Alloc>.

The MIR inline pass actually fixes up the argument while inlining
box_free, but this is not enabled by default and doesn't necessarily
happen (the inline threshold needs to be passed).

This change effectively moves what the MIR inline pass does to the
elaborate_drops pass, so that box_free() is passed the raw pointer
instead of the Box.
2018-04-20 09:31:45 +09:00
Alex Crichton
ca79ba300a Tweak some stabilizations in libstd
This commit tweaks a few stable APIs in the `beta` branch before they hit
stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were
deleted (added in #49381, issue at #49657). The `and_modify` APIs added
in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure.

Closes #49581
Closes #49657
2018-04-19 16:53:12 -07:00
bors
230b97af1c Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton
atomic: remove 'Atomic*' from Debug output

For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.
2018-04-19 23:08:16 +00:00
Alex Crichton
e58629b990 wasm: Increase default stack size to 1MB
This commit increases the dfeault stack size allocated to the
wasm32-unknown-unknown target to 1MB by default. Currently the default stack
size is one wasm page, or 64 kilobytes. This default stack is quite small and
has caused a stack overflow or two in the wild by accident.

The current "best practice" for fixing this is to pass `-Clink-args='-z
stack-size=$bigger'` but that's not great nor always easy to do. A default of
1MB matches more closely with other platforms where it's "pretty big" by
default.

Note that it was tested and if the users uses `-C link-args` to pass a custom
stack size that's still resepected as lld seems to take the first argument, and
where rustc is passing it will always be last.
2018-04-19 14:51:59 -07:00
Guillaume Gomez
2d266e1d11 Update stdsimd submodule 2018-04-19 23:47:28 +02:00
Nicholas Rishel
da6142c810 Rustfmt result (for relevant changes) to satisfy Travis line length check.
Signed-off-by: Nicholas Rishel <nick@accups.com>
2018-04-19 17:27:05 -04:00
Kurtis Nusbaum
51f51109ce add --edition option 2018-04-19 13:57:01 -07:00
Nicholas Rishel
c7f3621f0e The prior check causes abstract unix domain sockets to return unnamed on Android.
Signed-off-by: Nicholas Rishel <nick@accups.com>
2018-04-19 15:55:02 -04:00
James Sanderson
1a72d6dcd1 Fix some of the __names in the comments 2018-04-19 20:17:06 +01:00
James Sanderson
b9b650c412 Gensym remaining identifiers 2018-04-19 20:06:35 +01:00
varkor
261da7108d Ensure CleanTools is run for check rustdoc 2018-04-19 19:20:55 +01:00
varkor
baf940d580 Add rustdoc to x.py check
This can often encounter errors after modifying rustc, so it's useful to include it in the steps that are checked.
2018-04-19 19:06:34 +01:00
bors
8830a03043 Auto merge of #50020 - oli-obk:clippy, r=Manishearth
Update clippy

r? @Manishearth
2018-04-19 16:39:57 +00:00
Santiago Pastorino
55054eede6
Fix Iter exhaustion in prove_predicates when debug is on
ht @tamird
2018-04-19 13:11:14 -03:00
James Sanderson
a3241d1350 Don't prepend deriving-generated attributes with _ 2018-04-19 13:57:43 +01:00
bors
8a28d94ea1 Auto merge of #49900 - pnkfelix:compare-mode-nll-followup-3, r=nikomatsakis
Add src/test/ui regression testing for NLL

This PR changes `x.py test` so that when you are running the `ui` test suite, it will also always run `compiletest` in the new `--compare-mode=nll`, which just double-checks that when running under the experimental NLL mode, the output matches the `<source-name>.nll.stderr` file, if present.

In order to reduce the chance of a developer revolt in response to this change, this PR also includes some changes to make the `--compare-mode=nll` more user-friendly:

 1. It now generates nll-specific .stamp files, and uses them (so that repeated runs can reuse previously cached results).
 2. Each line of terminal output distinguishes whether we are running under `--compare-mode=nll` by printing with the prefix `[ui (nll)]` instead of just the prefix `[ui]`.

Subtask of rust-lang/rust#48879
2018-04-19 11:13:10 +00:00
bors
5fe6b58dfc Auto merge of #49949 - oli-obk:const_signed_pat, r=eddyb
Sign extend constants in range patterns

fixes  #49940

r? @Mark-Simulacrum
2018-04-19 08:41:35 +00:00
Oliver Schneider
b22c9c01fb
Sign extend constants in range patterns 2018-04-19 09:01:27 +02:00
Oliver Schneider
0f1f9a79f2
Update clippy 2018-04-19 08:52:52 +02:00
bors
78fc510743 Auto merge of #49890 - varkor:xpy-check-rustc_trans, r=alexcrichton
Add rustc_trans to x.py check

r? @Mark-Simulacrum

I looked at `bootstrap/compile.rs` and `bootstrap/check.rs` to try to work out which steps were appropriate, but I'm sure I've overlooked some details here, so it's worth checking carefully I've got all the steps right (e.g. I wasn't sure whether we want to build LLVM if necessary with `x.py check`, though I thought it was probably better to than to not).

From a quick test, it seems to be working, though.
2018-04-19 06:19:27 +00:00
bors
883bf4ba2e Auto merge of #49630 - npmccallum:shl, r=alexcrichton
Update Rhs on ShlAssign to default to Self

This matches the behavior on ShrAssign and all other *Assign operations.
2018-04-19 03:53:32 +00:00
Alex Crichton
e9348738fc proc_macro: Stay on the "use the cache" path more
Discovered in #50061 we're falling off the "happy path" of using a stringified
token stream more often than we should. This was due to the fact that a
user-written token like `0xf` is equality-different from the stringified token
of `15` (despite being semantically equivalent).

This patch updates the call to `eq_unspanned` with an even more awful solution,
`probably_equal_for_proc_macro`, which ignores the value of each token and
basically only compares the structure of the token stream, assuming that the AST
doesn't change just one token at a time.

While this is a step towards fixing #50061 there is still one regression
from #49154 which needs to be fixed.
2018-04-18 19:36:48 -07:00
bors
5dc896e9e7 Auto merge of #50048 - glandium:issue50041, r=eddyb
rustc_trans: also check dominators for SSA values in mir::analyze

Fixes #50041
2018-04-19 01:13:29 +00:00
Nicholas Nethercote
9f145022ef Avoid allocating when parsing \u{...} literals.
`char_lit` uses an allocation in order to ignore '_' chars in \u{...}
literals. This patch changes it to not do that by processing the chars
more directly.

This improves various rustc-perf benchmark measurements by up to 6%,
particularly regex, futures, clap, coercions, hyper, and encoding.
2018-04-19 09:17:40 +10:00
varkor
86acb09273
Add rerun-if-env-changed=RUST_CHECK to librustc_llvm 2018-04-19 00:09:41 +01:00
Nicholas Nethercote
5070dea236 Lazily evaluate EvalErrorKind::*.into() calls.
eval_context.rs calls `ok_or` in multiple places with an eagerly
evaluated `EvalErrorKind::*.into()` argument, which calls
EvalError::from(), which calls env::var("MIRI_BACKTRACE"), which
allocates a String. This code is hot enough for this to have a
measurable effect on some benchmarks.

This patch changes the `ok_or` calls into `ok_or_else`, thus avoiding
the evaluations when they're not needed. As a result, most of the
rustc-perf benchmarks get a measurable speedup, particularly the
shorter-running ones, where the improvement is as high as 6%.
2018-04-19 08:56:27 +10:00
bors
e0f9b32357 Auto merge of #50022 - nrc:doc-analysis, r=mark-simulacrum
Only emit save-analysis data for `cargo build` tasks

Previously, we were emittinng analysis data for all tasks, including `doc`. That meant we got two sets of save-analysis data, one from the normal build and one from the docs. That means indexing with the RLS took twice as long and made downloads larger and build times longer.

cc https://github.com/rust-lang-nursery/rls/issues/826

r? @Mark-Simulacrum
2018-04-18 22:30:00 +00:00
Michael Lamparski
90b361b3a7 fix my unit test that was horrendously wrong
and add one for non-mut slicing since I touched that method too
2018-04-18 16:48:56 -04:00
bors
ac3c2288f9 Auto merge of #50017 - tinaun:stabilize-all-the-things, r=sfackler
stabilize a bunch of minor api additions

besides `ptr::NonNull::cast` (which is 4 days away from end of FCP) all of these have been finished with FCP for a few weeks now with minimal issues raised

* Closes #41020
* Closes #42818
* Closes #44030
* Closes #44400
* Closes #46507
* Closes #47653
* Closes #46344

the following functions will be stabilized in 1.27:
* `[T]::rsplit`
* `[T]::rsplit_mut`
* `[T]::swap_with_slice`
* `ptr::swap_nonoverlapping`
* `NonNull::cast`
* `Duration::from_micros`
* `Duration::from_nanos`
* `Duration::subsec_millis`
* `Duration::subsec_micros`
* `HashMap::remove_entry`
2018-04-18 19:47:56 +00:00
bors
c8fa49f83b Auto merge of #50006 - rcoh:reorder-compiler-builtins, r=oli-obk
Reorder injection of std to get better compilation error

Per #49851, reorder injection imports to get a better error message.

r? @oli-obk
2018-04-18 17:07:21 +00:00
Kerem
670448d448
Added build disk usage information
Closes https://github.com/rust-lang/rust/issues/50019
2018-04-18 20:06:05 +03:00
bors
3dfda16525 Auto merge of #49993 - nnethercote:shrink-Token, r=alexcrichton
Change the hashcounts in raw `Lit` variants from usize to u16.

This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit
platforms.
2018-04-18 14:44:54 +00:00
Felix S. Klock II
33bcb4ed16 When running under compare-mode=nll, generate expected output to foo.nll.stderr
This allows easy revision of the update-references.sh script (included
here) so that it can update the expected output for nll rather than
stderr. It also reminds the rustc developer via the filename that they
are looking at output generated under comapre-mode=nll.

One could argue that there is still a problem with the strategy encoded here:
if we reach a scenario where a change to the compiler brings the output
under AST and NLL modes back into sync, this code will continue to still
generate output to distinct `foo.stderr` and `foo.nll.stderr` files, and
will continue to copy those two files back to corresponding distinct
files in the source tree, even if the *content* of the two files is now the
same.

  * Arguably the "right thing" to do in that case is to remove the
    `foo.nll.stderr` file entirely.

  * However, I think the real answer is that we will probably want to
    double-check such cases by hand anyway. We should be regularly
    double-checking the diffs between `foo.stderr` and
    `foo.nll.stderr`, and if we see a zero-diff case, then we should
    evaluate whether that is correct, and if so, remove the file by
    hand.)

  * In any case, I think the default behavior encoded here (or at
    least *intended* to be encoded here) is superior to the
    alternative of *only* generating a `foo.nll.stderr` file if one
    already existed in the source tree at the time that `compiletest`
    was invoked (and otherwise unconditionally generating a
    `foo.stderr` file, as was the behavior prior to this commit),
    because that alternative is more likely to cause rustc developers
    to overwrite a `foo.stderr` file with the stderr output from a
    compare-mode=nll run, which will then break the *normal*
    `compiletest` run and probably be much more confusing for the
    average rustc developer.
2018-04-18 15:37:30 +02:00
Felix S. Klock II
1a4326d3fb Workaround rust-lang/rust#49998 by opting into experimental -Z nll-subminimal-causes flag
This commit only applies the flag to the one test case,
ui/span/dropck_vec_cycle_checked.rs, that absolutely needs it. Without
the flag, that test takes an unknown amount of time (greater than 1
minute) to compile. But its possible that other tests would also
benefit from the flag, and we may want to make it the default (after
evaluating its impact on other tests).

In terms of its known impact on other tests, I have only evaluated the
ui tests, and the *only* ui test I have found that the flag impacts
(running under NLL mode, of course), is src/test/ui/nll/issue-31567.rs

In particular:

```
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs
error[E0597]: `*v.0` does not live long enough
  --> ../src/test/ui/nll/issue-31567.rs:22:26
   |
22 |     let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
   |                          ^^^^^ borrowed value does not live long enough
23 |     &s_inner.0
24 | }
   | - borrowed value only lives until here
   |
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:1...
  --> ../src/test/ui/nll/issue-31567.rs:21:1
   |
21 | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
% ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/nll/issue-31567.rs  -Z nll-subminimal-causes
error[E0597]: `*v.0` does not live long enough
  --> ../src/test/ui/nll/issue-31567.rs:22:26
   |
22 |     let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
   |                          ^^^^^ borrowed value does not live long enough
23 |     &s_inner.0
24 | }
   | -
   | |
   | borrowed value only lives until here
   | borrow later used here, when `v` is dropped

error: aborting due to previous error

For more information about this error, try `rustc --explain E0597`.
%
```
2018-04-18 15:37:30 +02:00
Felix S. Klock II
a771b0f075 Work around rust-lang/rust#49998 with experimental code that does less updating of cause map.
This seems to avoid poor scaling on src/test/ui/span/dropck_vec_cycle_checked.rs
2018-04-18 15:37:30 +02:00
Felix S. Klock II
699c98ec6a Removed .nll.stderr files that currently match their corresponding .stderr files. 2018-04-18 15:37:30 +02:00
Felix S. Klock II
032081cdff Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
Felix S. Klock II
ea454746b3 Update the previously checkpointed (but unused by bors) tests to reflect current reality. 2018-04-18 15:37:18 +02:00
Felix S. Klock II
02a7809f1c Generate separate stamp files for --compare-mode=nll, and also use them. :) 2018-04-18 14:47:28 +02:00
Felix S. Klock II
ae6a9d4ba4 Change output of compiletest to include the compare-mode when present.
E.g. when running with `--compare-mode=nll`, then each test line will
look like e.g.:

```
test [ui (nll)] ui/issue-10969.rs ... ok
```
2018-04-18 14:47:28 +02:00
Felix S. Klock II
5589550356 Expand x.py test to also run with --compare-mode=nll on src/test/ui suite. 2018-04-18 14:47:24 +02:00