Commit Graph

81709 Commits

Author SHA1 Message Date
Wesley Wiser
e50dfe66f3 Fix more missed query data 2018-08-02 18:57:24 -04:00
Wesley Wiser
d3aa593a6b Remove redundant s in output 2018-08-02 18:57:24 -04:00
Wesley Wiser
6a0d37b69c Fix some missed query data 2018-08-02 18:57:24 -04:00
Wesley Wiser
0f43800d10 Switch to markdown output 2018-08-02 18:57:24 -04:00
Wesley Wiser
aceee88c1a Add units to times 2018-08-02 18:57:24 -04:00
Wesley Wiser
177776d55e Basic incremental stats 2018-08-02 18:57:24 -04:00
Wesley Wiser
45482c6f99 Basic profiling 2018-08-02 18:57:24 -04:00
Vadim Petrochenkov
6a3dfa4dba
privacy: Fix an ICE in path_is_private_type
Fixes https://github.com/rust-lang/rust/issues/52879

(Untested.)
2018-08-03 00:43:49 +03:00
QuietMisdreavus
7e77d19905 preserve order if blocks are between items 2018-08-02 16:40:53 -05:00
bors
40e4b6ee3d Auto merge of #52841 - petrochenkov:premacro, r=alexcrichton
resolve: Implement prelude search for macro paths, implement tool attributes

When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details.

"Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude.
This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope.

The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order.
If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway).

Fixes https://github.com/rust-lang/rust/issues/52576
Fixes https://github.com/rust-lang/rust/issues/52512
Fixes https://github.com/rust-lang/rust/issues/51277
cc https://github.com/rust-lang/rust/issues/52269
2018-08-02 21:39:14 +00:00
Andre Bogus
4471537ea0 make TinyList more readable and optimize remove(_)
also add benchmarks

Before:

```
test tiny_list::test::bench_insert_empty             ... bench:           1 ns/iter (+/- 0)
test tiny_list::test::bench_insert_one               ... bench:          16 ns/iter (+/- 0)
test tiny_list::test::bench_remove_empty             ... bench:           2 ns/iter (+/- 0)
test tiny_list::test::bench_remove_one               ... bench:           6 ns/iter (+/- 0)
test tiny_list::test::bench_remove_unknown           ... bench:           4 ns/iter (+/- 0)
```

After:

```
test tiny_list::test::bench_insert_empty             ... bench:           1 ns/iter (+/- 0)
test tiny_list::test::bench_insert_one               ... bench:          16 ns/iter (+/- 0)
test tiny_list::test::bench_remove_empty             ... bench:           0 ns/iter (+/- 0)
test tiny_list::test::bench_remove_one               ... bench:           3 ns/iter (+/- 0)
test tiny_list::test::bench_remove_unknown           ... bench:           2 ns/iter (+/- 0)
```
2018-08-02 22:58:53 +02:00
Josh Stone
23bdc82068 RELEASES.md: fix the hash_map::Entry::or_default link 2018-08-02 13:54:21 -07:00
Guillaume Gomez
dda85abf09 Stabilize --color and --error-format options in rustdoc 2018-08-02 22:54:09 +02:00
QuietMisdreavus
d6a7a3cab0 add rustdoc test for everybody_loops fix 2018-08-02 15:42:02 -05:00
QuietMisdreavus
8df498be1c more fixes for everybody_loops 2018-08-02 15:30:57 -05:00
Taylor Cramer
3a93e914eb Remove unnecessary local in await! macro 2018-08-02 13:07:55 -07:00
QuietMisdreavus
f3733a2f82 make everybody_loops keep item declarations 2018-08-02 14:57:25 -05:00
bors
40cb4478a3 Auto merge of #52782 - pnkfelix:issue-45696-dangly-paths-for-box, r=eddyb
[NLL] Dangly paths for box

Special-case `Box` in `rustc_mir::borrow_check`.

Since we know dropping a box will not access any `&mut` or `&` references, it is safe to model its destructor as only touching the contents *owned* by the box.

----

There are three main things going on here:

1. The first main thing, this PR is fixing a bug in NLL where `rustc` previously would issue a diagnostic error in a case like this:
```rust
fn foo(x: Box<&mut i32>) -> &mut i32 { &mut **x }
```

such code was accepted by the AST-borrowck in the past, but NLL was rejecting it with the following message ([playground](https://play.rust-lang.org/?gist=13c5560f73bfb16d6dab3ceaad44c0f8&version=nightly&mode=release&edition=2015))
```
error[E0597]: `**x` does not live long enough
 --> src/main.rs:3:40
  |
3 | fn foo(x: Box<&mut i32>) -> &mut i32 { &mut **x }
  |                                        ^^^^^^^^ - `**x` dropped here while still borrowed
  |                                        |
  |                                        borrowed value does not live long enough
  |
note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 3:1...
 --> src/main.rs:3:1
  |
3 | fn foo(x: Box<&mut i32>) -> &mut i32 { &mut **x }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error
```

2. The second main thing: The reason such code was previously rejected was because NLL (MIR-borrowck) incorporates a fix for issue #31567, where it models a destructor's execution as potentially accessing any borrows held by the thing being destructed. The tests with `Scribble` model this, showing that the compiler now catches such unsoundness.

However, that fix for issue #31567 is too strong, in that NLL (MIR-borrowck) includes `Box` as one of the types with a destructor that potentially accesses any borrows held by the box. This thus was the cause of the main remaining discrepancy between AST-borrowck and MIR-borrowck, as documented in issue #45696, specifically in [the last example of this comment](https://github.com/rust-lang/rust/issues/45696#issuecomment-345367873), which I have adapted into the `fn foo` shown above.

We did close issue #45696 back in December of 2017, but AFAICT that example was not fixed by PR #46268. (And we did not include a test, etc etc.)

This PR fixes that case, by trying to model the so-called `DerefPure` semantics of `Box<T>` when we traverse the type of the input to `visit_terminator_drop`.

3. The third main thing is that during a review of the first draft of this PR, @matthewjasper pointed out that the new traversal of `Box<T>` could cause the compiler to infinite loop. I have adjusted the PR to avoid this (by tracking what types we have previously seen), and added a much needed test of this somewhat odd scenario. (Its an odd scenario because the particular case only arises for things like `struct A(Box<A>);`, something which cannot be constructed in practice.)

Fix #45696.
2018-08-02 19:42:19 +00:00
Niko Matsakis
341a07c4c3 compute union-find of locals flowing into the output of statics
Co-authored-by: lqd <remy.rakic+github@gmail.com>
Co-authored-by: nikomatsakis <niko@alum.mit.edu>
2018-08-02 22:02:59 +03:00
Aaron Hill
b010d1f929
Tidy fixes 2018-08-02 14:58:13 -04:00
Aaron Hill
016b586685
A bit of cleanup 2018-08-02 14:34:25 -04:00
Aaron Hill
a0943b6bba
Filter out duplicated trait predicates when generating auto traits
Fixes #51236
2018-08-02 13:59:16 -04:00
bors
03da14ba8c Auto merge of #52949 - Mark-Simulacrum:snap, r=alexcrichton
Switch to bootstrapping from 1.29 beta

r? @alexcrichton
2018-08-02 15:34:21 +00:00
Aaron Hill
bff08f2731
Fix rustdoc crash when 'static bound appears in struct declaration 2018-08-02 09:58:44 -04:00
bors
5e92bf280b Auto merge of #52975 - pnkfelix:issue-52967-edition-2018-implies-2-phase-borrows, r=Mark-Simulacrum
NLL migration in the 2018 edition needs two-phase borrows too!

NLL migration in the 2018 edition needs two-phase borrows too!

Fix #52967.
2018-08-02 12:40:35 +00:00
Felix S. Klock II
09a7e64601 When we turn on NLL migration in the 2018 edition, we need two-phase borrows too!
Fix #52967.
2018-08-02 13:51:13 +02:00
Oliver Schneider
37e18e7a30 Second field of ScalarPair can be undef in some cases 2018-08-02 13:16:53 +02:00
bors
76aeeefdc2 Auto merge of #52906 - RalfJung:jemalloc, r=alexcrichton
enable jemalloc assertions when configured to do so

This is essentially a re-submission of the functional part of https://github.com/rust-lang/rust/pull/43648. I was unable to reproduce the issue I had back then, maybe something changed somewhere to no longer trigger the assertion.

Fixes https://github.com/rust-lang/rust/issues/44152
2018-08-02 10:28:42 +00:00
David Wood
2488cb6b10
Explicitly label any named lifetimes mentioned in error messages. 2018-08-02 12:00:15 +02:00
bors
02a369a5c8 Auto merge of #52890 - djrenren:test-visibility, r=petrochenkov
Reexport tests without polluting namespaces

This should fix issue #52557.

Basically now we gensym a new name for the test function and reexport that.
That way the test function's reexport name can't conflict because it was impossible for the test author to write it down.
We then use a `use` statement to expose the original name using the original visibility.
2018-08-02 08:24:14 +00:00
Oliver Schneider
c8e30c4295 Reading values should not be looking at the variant 2018-08-02 10:19:37 +02:00
Marc-Antoine Perennou
66a47182d1 rustbuild: fix local_rebuild
If we detect a local rebuild (e.g. bootstrap compiler is the same version as target compiler), we set stage to 1.
When trying to build e.g. UnstableBook, we use Mode::ToolBootstrap and stage is 1.
Just allow Mode::ToolBootstrap and stagge != 0 if we are in a local_rebuild

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2018-08-02 08:49:36 +02:00
Zack M. Davis
6e63b0dbed Applicability-ify librustc_lint
Andrew Chin recently pointed out (rust-lang/cargo#5846) that it's
surprising that `cargo fix` (now shipping with Cargo itself!) doesn't
fix very common lint warnings, which is as good of a reminder as any
that we should finish #50723.
2018-08-01 21:58:25 -07:00
bors
db5476571d Auto merge of #52847 - upsuper:thread-stack-reserve, r=alexcrichton
Don't commit thread stack on Windows

On Windows, there is a system level resource limitation called commit limit, which is roughly the sum of physical memory + paging files[1]. `CreateThread` by default commits the stack size[2], which unnecessarily takes such resource from the shared limit.

This PR changes it to only reserve the stack size rather than commit it. Reserved memory would only take the address space of the current process until it's actually accessed.

This should make the behavior on Windows match other platforms, and is also a pretty standard practice on Windows nowadays.

[1] https://blogs.technet.microsoft.com/markrussinovich/2008/11/17/pushing-the-limits-of-windows-virtual-memory/
[2] https://docs.microsoft.com/zh-cn/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createthread
2018-08-02 04:22:23 +00:00
bors
60c1ee7645 Auto merge of #52787 - riscv-rust:riscv-rust-pr, r=alexcrichton
Enable RISCV

- Enable LLVM backend.
- Implement call abi.
- Add built-in target riscv32imac-unknown-none.
- Enable CI.
2018-08-02 02:24:15 +00:00
bors
1d9405fb6c Auto merge of #52206 - RalfJung:zst-slices, r=alexcrichton
slices: fix ZST slice iterators making up pointers; debug_assert alignment in from_raw_parts

This fixes the problem that we are fabricating pointers out of thin air. I also managed to share more code between the mutable and shared iterators, while reducing the amount of macros.

I am not sure how useful it really is to add a `debug_assert!` in libcore. Everybody gets a release version of that anyway, right? Is there at least a CI job that runs the test suite with a debug version?

Fixes #42789
2018-08-02 00:14:21 +00:00
Ralf Jung
9fcf2c9726 use the same length computation everywhere 2018-08-02 00:33:04 +02:00
Ralf Jung
e1471cf41f Introduce another way to compute the length, to fix position codegen regression 2018-08-02 00:33:04 +02:00
Ralf Jung
b0a82d9314 simplify len macro: No longer require the type
Also use ident, not expr, to avoid accidental side-effects
2018-08-02 00:33:04 +02:00
Ralf Jung
3e3ff4b652 macro-inline len() and is_empty() to fix performance regressions
This also changes the IR for nth(), but the new IR actually looks nicer that the old
(and it is one instruction shorter).
2018-08-02 00:33:03 +02:00
Ralf Jung
1b3c6bac8b make the code for nth closer to what it used to be 2018-08-02 00:33:03 +02:00
Ralf Jung
60b06369ee test nth better 2018-08-02 00:33:03 +02:00
Ralf Jung
cbdba2b4c2 use wrapping_offset; fix logic error in nth 2018-08-02 00:33:03 +02:00
Ralf Jung
c7d90d1a50 comments 2018-08-02 00:33:03 +02:00
Ralf Jung
86369c3ad4 slice iterators: ZST iterators no longer just "make up" addresses 2018-08-02 00:29:12 +02:00
bors
97085f9fb0 Auto merge of #52958 - pietroalbini:rollup, r=pietroalbini
Rollup of 15 pull requests

Successful merges:

 - #52793 (Add test for NLL: unexpected "free region `` does not outlive" error )
 - #52799 (Use BitVector for global sets of AttrId)
 - #52809 (Add test for unexpected region for local data ReStatic)
 - #52834 ([NLL] Allow conflicting borrows of promoted length zero arrays)
 - #52835 (Fix Alias intra doc ICE)
 - #52854 (fix memrchr in miri)
 - #52899 (tests/ui: Add missing mips{64} ignores)
 - #52908 (Use SetLenOnDrop in Vec::truncate())
 - #52915 (Don't count MIR locals as borrowed after StorageDead when finding locals live across a yield terminator)
 - #52926 (rustc: Trim down the `rust_2018_idioms` lint group)
 - #52930 (rustc_resolve: record single-segment extern crate import resolutions.)
 - #52939 (Make io::Read::read_to_end consider io::Take::limit)
 - #52942 (Another SmallVec.extend optimization)
 - #52947 (1.27 actually added the `armv5te-unknown-linux-musleabi` target)
 - #52954 (async can begin expressions)

Failed merges:

r? @ghost
2018-08-01 19:54:06 +00:00
Pietro Albini
3e7897f773
Rollup merge of #52954 - cramertj:async-parse, r=petrochenkov
async can begin expressions

Fix https://github.com/rust-lang/rust/issues/52951

r? @petrochenkov
2018-08-01 21:46:40 +02:00
Pietro Albini
b2392fad35
Rollup merge of #52947 - Susurrus:patch-1, r=alexcrichton
1.27 actually added the `armv5te-unknown-linux-musleabi` target

The PR title says `armv5te-unknown-linux-musl`, but it looks like the final code merge renamed the target to `armv5te-unknown-linux-musleabi`. `rustup` reports this as correct as well.

The [Rust Platform Support](https://forge.rust-lang.org/platform-support.html) page needs this added as well, but I'm not certain what codebase that is generated from.
2018-08-01 21:46:39 +02:00
Pietro Albini
6e7e3859c6
Rollup merge of #52942 - llogiq:smallvec-opt, r=Mark-Simulacrum
Another SmallVec.extend optimization

This improves SmallVec.extend even more over #52859 while making the code easier to read.

Before

```
test small_vec::tests::fill_small_vec_1_10_with_cap  ... bench:          31 ns/iter (+/- 5)
test small_vec::tests::fill_small_vec_1_10_wo_cap    ... bench:          70 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_1_50_with_cap  ... bench:          36 ns/iter (+/- 3)
test small_vec::tests::fill_small_vec_1_50_wo_cap    ... bench:         256 ns/iter (+/- 17)
test small_vec::tests::fill_small_vec_32_10_with_cap ... bench:          31 ns/iter (+/- 5)
test small_vec::tests::fill_small_vec_32_10_wo_cap   ... bench:          26 ns/iter (+/- 1)
test small_vec::tests::fill_small_vec_32_50_with_cap ... bench:          49 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_32_50_wo_cap   ... bench:         219 ns/iter (+/- 11)
test small_vec::tests::fill_small_vec_8_10_with_cap  ... bench:          32 ns/iter (+/- 2)
test small_vec::tests::fill_small_vec_8_10_wo_cap    ... bench:          61 ns/iter (+/- 12)
test small_vec::tests::fill_small_vec_8_50_with_cap  ... bench:          37 ns/iter (+/- 3)
test small_vec::tests::fill_small_vec_8_50_wo_cap    ... bench:         210 ns/iter (+/- 10)
```

After:

```
test small_vec::tests::fill_small_vec_1_10_wo_cap    ... bench:          31 ns/iter (+/- 3)
test small_vec::tests::fill_small_vec_1_50_with_cap  ... bench:          39 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_1_50_wo_cap    ... bench:          35 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_32_10_with_cap ... bench:          37 ns/iter (+/- 3)
test small_vec::tests::fill_small_vec_32_10_wo_cap   ... bench:          32 ns/iter (+/- 2)
test small_vec::tests::fill_small_vec_32_50_with_cap ... bench:          52 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_32_50_wo_cap   ... bench:          46 ns/iter (+/- 0)
test small_vec::tests::fill_small_vec_8_10_with_cap  ... bench:          35 ns/iter (+/- 4)
test small_vec::tests::fill_small_vec_8_10_wo_cap    ... bench:          31 ns/iter (+/- 0)
test small_vec::tests::fill_small_vec_8_50_with_cap  ... bench:          40 ns/iter (+/- 15)
test small_vec::tests::fill_small_vec_8_50_wo_cap    ... bench:          36 ns/iter (+/- 2)
```
2018-08-01 21:46:37 +02:00
Pietro Albini
eeb7b6ae09
Rollup merge of #52939 - ljedrz:fix_51746, r=kennytm
Make io::Read::read_to_end consider io::Take::limit

Add a custom implementation of `io::Read::read_to_end` for `io::Take` that doesn't reserve the default 32 bytes but rather `Take::limit` if `Take::limit < 32`.

It's a conservative adjustment that preserves the default behavior for `Take::limit >= 32`.

Fixes #51746.
2018-08-01 21:46:36 +02:00