Commit Graph

81791 Commits

Author SHA1 Message Date
Manish Goregaokar
cd70153e28 Update clippy 2018-08-03 10:16:07 -07:00
Mark Rousskov
5aec365cb9 Store concrete crate stores where possible 2018-08-03 11:09:49 -06:00
Mark Rousskov
eb0bc64265 Visibility is now a query 2018-08-03 11:09:36 -06:00
Mark Rousskov
cc1a6b99b0 Delete dummy crate store 2018-08-03 11:09:36 -06:00
Mark Rousskov
d4beecaed3 Move validate_crate_name to rustc_metadata 2018-08-03 11:09:02 -06:00
Scott McMurray
7398c3125b Fix the stage1 build 2018-08-03 08:52:30 -07:00
bors
59fa6bd6c1 Auto merge of #52712 - oli-obk:const_eval_cleanups, r=RalfJung
Reintroduce `Undef` and properly check constant value sizes

r? @RalfJung

cc @eddyb

basically all kinds of silent failures that never occurred are assertions now
2018-08-03 14:28:12 +00:00
Aleksey Kladov
a2f9aaf7a3
Fix trailnig WS 2018-08-03 16:50:30 +03:00
bors
88e0ff14a8 Auto merge of #52887 - yurydelendik:disable-lld-symbols, r=alexcrichton
Disable debug sections when optimization flags is set for LLD.

Currently LLD does not error when optimization is set and debugging information sections are present. (See discussion at https://reviews.llvm.org/D47901)

Using `--strip-debug` along with the `-O` option.
2018-08-03 12:22:17 +00:00
Aleksey Kladov
94de821002
Specify reentrancy gurantees of Once::call_once 2018-08-03 14:18:06 +03:00
Oliver Schneider
828aebfe3a Unify API of Scalar and ScalarMaybeUndef 2018-08-03 12:40:03 +02:00
Ralf Jung
71460d4d11 volatile operations docs: clarify that this does not help wrt. concurrency 2018-08-03 12:15:00 +02:00
Oliver Schneider
4819094031 Reintroduce alignment check 2018-08-03 11:28:06 +02:00
Oliver Schneider
21debc6984 Remove spurious whitespace 2018-08-03 11:24:36 +02:00
bors
e415b5ecc0 Auto merge of #52948 - davidtwco:issue-52633-later-loop-iteration, r=pnkfelix
NLL: Better Diagnostic When "Later" means "A Future Loop Iteration"

Part of #52663.

r? @pnkfelix
2018-08-03 09:22:11 +00:00
Oliver Schneider
26231e64b2 Remove some more unnecessary mut 2018-08-03 11:21:44 +02:00
Scott McMurray
ce9d469a70 Extract impl_header_lifetime_elision out of in_band_lifetimes 2018-08-03 00:08:44 -07:00
bors
4dae470513 Auto merge of #52925 - RalfJung:sanity_check, r=oli-obk
check_const: use the same ParamEnv as codegen for statics

Fixes at least part of https://github.com/rust-lang/rust/issues/52849 (my CTFE-stress benchmark). Note that I do not know what I am doing here, this is just based on hints from @oli-obk.

r? @oli-obk
2018-08-03 06:34:16 +00:00
Niko Matsakis
75504eeffa update error messages -- in some cases maybe we should investigate 2018-08-03 08:31:17 +02:00
Niko Matsakis
e79656c5b7 support X = &*Y reborrows 2018-08-03 08:15:55 +02:00
Tobias Bucher
a04b2cda0b Provide {to,from}_{ne,le,be}_bytes functions on integers
If one doesn't view integers as containers of bytes, converting them to
bytes necessarily needs the specfication of encoding.

I think Rust is a language that wants to be explicit. The `to_bytes`
function is basically the opposite of that – it converts an integer into
the native byte representation, but there's no mention (in the function
name) of it being very much platform dependent. Therefore, I think it
would be better to replace that method by three methods, the explicit
`to_ne_bytes` ("native endian") which does the same thing and
`to_{le,be}_bytes` which return the little- resp. big-endian encoding.
2018-08-03 07:55:10 +02:00
bors
7e8ca9f8bd Auto merge of #52919 - alexcrichton:update-cargo, r=Mark-Simulacrum
Update tool submodules, update feature unification strategy

* Bring in some fixes for `cargo fix`
* Update RLS/rustfmt to keep them compiling
* Update all tools to [depend on `rustc-workspace-hack`](https://github.com/rust-lang/rust/pull/52919#issuecomment-409802418)
* Change how we deal with feature unification amongst these builds.
2018-08-03 02:53:17 +00:00
Alex Crichton
0e034d162a Update Cargo submodule
Bring in some fixes for `cargo fix` notably
2018-08-02 18:09:19 -07:00
bors
1e3c45a7c3 Auto merge of #51657 - wesleywiser:wip_profiling, r=eddyb
Implement a self profiler

This is a work in progress implementation of #50780. I'd love feedback on the overall structure and code as well as some specific things:

- [The query categorization mechanism](https://github.com/rust-lang/rust/compare/master...wesleywiser:wip_profiling?expand=1#diff-19e0a69c10eff31eb2d16805e79f3437R101). This works but looks kind of ugly to me. Perhaps there's a better way?

- [The profiler assumes only one activity can run at a time](https://github.com/rust-lang/rust/compare/master...wesleywiser:wip_profiling?expand=1#diff-f8a403b2d88d873e4b27c097c614a236R177). This is obviously incompatible with the ongoing parallel queries.

- [The output code is just a bunch of `format!()`s](https://github.com/rust-lang/rust/compare/master...wesleywiser:wip_profiling?expand=1#diff-f8a403b2d88d873e4b27c097c614a236R91). Is there a better way to generate markdown or json in the compiler?

- [The query categorizations are likely wrong](https://github.com/rust-lang/rust/compare/master...wesleywiser:wip_profiling?expand=1#diff-19e0a69c10eff31eb2d16805e79f3437R101). I've marked what seemed obvious to me but I'm sure I got a lot of them wrong.

The overhead currently seems very low. Running `perf` on a sample compilation with profiling enabled reveals:
![image](https://user-images.githubusercontent.com/831192/41657821-9775efec-7462-11e8-9e5e-47ec94105d9d.png)
2018-08-03 00:50:09 +00:00
Wesley Wiser
2d3a0a9927 Generate self-profiler types with macros 2018-08-02 18:57:24 -04:00
Wesley Wiser
60c2e9a329 Fix tidy 2018-08-02 18:57:24 -04:00
Wesley Wiser
97ab37e2dc Remove some dead code 2018-08-02 18:57:24 -04:00
Wesley Wiser
256a6e4fa9 Include additional data in the json output 2018-08-02 18:57:24 -04:00
Wesley Wiser
579facaba2 Include query hits/totals 2018-08-02 18:57:24 -04:00
Wesley Wiser
4552607d64 Refactor json printing 2018-08-02 18:57:24 -04:00
Wesley Wiser
51cc594e10 First pass at json output 2018-08-02 18:57:24 -04:00
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