Commit Graph

83610 Commits

Author SHA1 Message Date
kennytm
51c387931e
Rollup merge of #53315 - nikomatsakis:newtype-index, r=Mark-Simulacrum
use `NonZeroU32` in `newtype_index!`macro, change syntax

Various improvements to the `newtype_index!` macro:

- Use `NonZeroU32` so that `Option<T>` is cheap
- More ergonomic helper method, no need to import `Idx` trait all the time
- Improve syntax to use `struct` keyword so that ripgrep works to find type def'n

Fixes https://github.com/rust-lang/rust/issues/50337

I'm curious to see if this passes tests =)
2018-09-08 18:28:13 +08:00
kennytm
b1ef2b81b9
Rollup merge of #54050 - GabrielMajeri:fix-build-with-nightly, r=alexcrichton
Update `petgraph` dependency to 0.4.13 to fix build with nightly

I wanted to build Rust from source using a local nightly compiler, but I was unable to get `bootstrap` to compile due to a naming conflict with the `find_map` function.

This PR updates the `petgraph` dependency of `bootstrap` to 0.4.13, fixing the issue.
2018-09-08 18:27:28 +08:00
kennytm
0b58d2d4e1
Rollup merge of #54040 - steveklabnik:update-books, r=Mark-Simulacrum
update books for next release
2018-09-08 18:27:15 +08:00
kennytm
1a86a9379e
Rollup merge of #54007 - japaric:gh53964, r=cramertj
crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint

fixes the *first* false positive reported in #53964
2018-09-08 18:26:59 +08:00
kennytm
407da0a8a2
Rollup merge of #53993 - eddyb:issue-53691, r=petrochenkov
rustc_resolve: don't record uniform_paths canaries as reexports.

Fixes #53691, fixes #53484.
2018-09-08 18:26:44 +08:00
kennytm
e2e3608a4b
Rollup merge of #53987 - Keruspe:llvm-suffix, r=alexcrichton
rustbuild: allow configuring llvm version suffix

Fixes #53852 by allowing user to install different versions of rust to the same sysroot.
2018-09-08 18:26:41 +08:00
kennytm
14c21a11b3
Rollup merge of #53981 - fbernier:patch-1, r=sfackler
Implement initializer() for FileDesc

Here was my initial issue:

```rust
use std::process::{Command};

fn main() {
    let output = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").output();
    println!("{:?}", output.unwrap().stdout.len());
}
```
```
~/stuff ❯❯❯ time ./dwl
104857600
./dwl  16.22s user 1.80s system 23% cpu 1:15.24 total
```

```rust
use std::process::{Command, Stdio};

fn main() {
    let child = Command::new("curl").arg("-s").arg("http://ovh.net/files/100Mio.dat").stdout(Stdio::piped()).spawn();
    let output = child.unwrap().wait_with_output().unwrap();
    println!("{:?}", output.stdout.len());
}
```

```
~/stuff ❯❯❯ time ./dwl2
104857600
./dwl2  0.64s user 2.18s system 5% cpu 53.072 total
```

As you can see the first version is spending much more time in userland and also uses more cpu. With the help of @programble, @talchas and @habnabit  on the rust IRC, we discovered that the slow version uses two pipes, one for `stdin` and one for `stderr` and in that case it polls when going through [this function](https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/pipe.rs#L82). The polling calls `read_to_end` on the pipes repetitively and this results in zeroing its internal buffer each time. To avoid this zeroing, `FileDesc` needs to implement `initializer`. We see no reason why it [wouldn't work with uninitialized memory](https://doc.rust-lang.org/1.26.1/src/std/io/mod.rs.html#534) so this PR fixes that.

Here is some tracing of the slow program:
![image](https://user-images.githubusercontent.com/147585/45133180-ed8a2d80-b161-11e8-9ec7-09979ec96145.png)

versus the fast program:
![image](https://user-images.githubusercontent.com/147585/45133216-0c88bf80-b162-11e8-908e-ff81d59239fb.png)

I have not tested the change yet but will try to build it tomorrow.
2018-09-08 18:26:39 +08:00
kennytm
5cc51add43
Rollup merge of #53973 - tromey:prefer-rust-enabled-lldb, r=alexcrichton
Have rust-lldb look for the rust-enabled lldb

We're shipping a rust-enabled lldb, but the "lldb" executable is not
installed into the "bin" directory by rustup.  See the discussion in
https://github.com/rust-lang-nursery/rustup.rs/pull/1492 for
background on this decision.  There, we agreed to have rust-lldb
prefer the rust-enabled lldb if it is installed.  This patch changes
rust-lldb to look in the sysroot and use the lldb found there, if any.

See issue #48168
2018-09-08 18:26:37 +08:00
kennytm
dbc9ec9da8
Rollup merge of #53942 - nnethercote:faster-precompute, r=nikomatsakis
Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups.

It now does one hash table lookup per basic block, instead of one per
statement. This is worthwhile because this function is hot for NLL
builds of `ucd`.

I haven't measured the effect of this yet because I'm having trouble doing optimized builds of rustc that are suitable for profiling (#53916). I will do an online perf run instead.

r? @nikomatsakis
2018-09-08 18:26:34 +08:00
kennytm
7569d9266e
Rollup merge of #53932 - matthewjasper:remove-base-path, r=nikomatsakis
[NLL] Remove base_place

This function was supposed to make `Box` less special. But

* I think that the consensus is that MIR borrowck is going to fully special case `Box`
* It wasn't implemented correctly, it's looking at the type of the wrong `Place`, resulting in weird behaviour:

```rust
#![feature(nll)]
type A = Box<i32>; // If this is changed to another type then this will compile.

pub fn foo(x: Box<(String, A)>) {
    let a = x.0; // This will compile if these lines are swapped
    let b = x.1;
}
```

r? @nikomatsakis
2018-09-08 18:26:29 +08:00
bors
ff59ab127a Auto merge of #51366 - japaric:stable-panic-impl, r=Mark-Simulacrum
stabilize #[panic_handler]

closes #44489

### Update(2018-09-07)

This was proposed for stabilization in https://github.com/rust-lang/rust/issues/44489#issuecomment-398965881 and its FCP with disposition to merge / accept is nearly over. The summary of what's being stabilized can be found in https://github.com/rust-lang/rust/issues/44489#issuecomment-416645946

Documentation PRs:

- Reference. https://github.com/rust-lang-nursery/reference/pull/362
- Nomicon. https://github.com/rust-lang-nursery/nomicon/pull/75

---

`#[panic_implementation]` was implemented recently in #50338. `#[panic_implementation]` is basically the old `panic_fmt` language item but in a less error prone (\*) shape. There are still some issues and questions to sort out around this feature (cf. #44489) but this PR is meant to start a discussion about those issues / questions with the language team.

(\*) `panic_fmt` was not type checked; changes in its function signature caused serious, silent binary size regressions like the one observed in #43054

Some unresolved questions from #44489:

> Should the Display of PanicInfo format the panic information as "panicked at 'reason',
> src/main.rs:27:4", as "'reason', src/main.rs:27:4", or simply as "reason".

The current implementation formats `PanicInfo` as the first alternative, which is how panic messages are formatted by the `std` panic handler. The `Display` implementation is more than a convenience: `PanicInfo.message` is unstable so it's not possible to replicate the `Display` implementation on stable.

> Is this design compatible, or can it be extended to work, with unwinding implementations for
> no-std environments?

I believe @whitequark made more progress with unwinding in no-std since their last comment in #44489. Perhaps they can give us an update?

---

Another unresolved question is where this feature should be documented. The feature currently doesn't have any documentation.

cc @rust-lang/lang
cc @jackpot51 @alevy @phil-opp
2018-09-08 09:23:45 +00:00
Gabriel Majeri
b31eaa4a08 Update petgraph dependency to 0.4.13
This fixes building `bootstrap` using a local Rust nightly.
2018-09-08 09:04:29 +03:00
bors
06da917b01 Auto merge of #51885 - GuillaumeGomez:trait-impl-show-docs, r=Mark-Simulacrum,QuietMisdreavus
Trait impl show docs

Fixes #51834.

<img width="1440" alt="screen shot 2018-06-29 at 00 14 33" src="https://user-images.githubusercontent.com/3050060/42063323-6e6e8cc8-7b31-11e8-88ef-4dd2229df76c.png">

(You can see both commit changes in the screenshot 😄)

r? @QuietMisdreavus
2018-09-08 04:14:54 +00:00
Gabriel Majeri
82cde902c5 Optimize miri checking of integer array/slices
Instead of checking every element, we can check the whole memory
range at once.
2018-09-08 07:13:19 +03:00
Alva Snædís
aa4f73c845 Update documentation for fill_buf in std::io::BufRead
Brings the documentation in line with the BufReader implementation.

Fixes #48022.
2018-09-07 23:16:55 +00:00
bors
295ad30ef4 Auto merge of #53745 - nikomatsakis:nll-issue-53570, r=pnkfelix
do not propagate closure requirements if we can prove them locally

Fixes #53570

cc @mikhail-m1 -- you're the one who last touched this code

r? @pnkfelix
2018-09-07 23:02:17 +00:00
Niko Matsakis
bb8c4c0db9 print less info to stabilize tests 2018-09-07 17:24:46 -04:00
Niko Matsakis
43e758798c avoid propagating outlives obligations on locals if we can 2018-09-07 17:08:22 -04:00
Niko Matsakis
db169e53e5 move annotate onto a method of UniversalRegions
This allows it to print out the "late-bound regions" from the closure
context more easily. Besides, all the state that is being printed it
is private to the `UniversalRegions`.
2018-09-07 17:08:21 -04:00
Niko Matsakis
b7f871363b region_infer: rustfmt 2018-09-07 16:41:15 -04:00
Niko Matsakis
8eb789f4c7 region_infer.rs: add some debug! 2018-09-07 16:41:15 -04:00
Eduard-Mihai Burtescu
e0e7cf303b rustc_resolve: only prepend CrateRoot to a non-keyword segment. 2018-09-07 23:23:51 +03:00
steveklabnik
de6a61110c update books for next release 2018-09-07 15:30:35 -04:00
bors
fc81e36242 Auto merge of #53327 - wesleywiser:wip_optimize_nll, r=nikomatsakis
[nll] teach SCC about `'static`

r? @nikomatsakis

I think this is right? I am seeing better performance on the `html5ever` benchmark but I'd like a perf run to quantify the exact speedup. There's a few ui tests failing due to changes in the error messages. The main issue seems to be that returns aren't being detected correctly?

`mir_check_cast_unsize.rs` before:

```
error: unsatisfied lifetime constraints
  --> mir_check_cast_unsize.rs:17:46
   |
17 |   fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
   |  ________--____________________________________^
   | |        |
   | |        lifetime `'a` defined here
18 | |     //~^ ERROR unsatisfied lifetime constraints
19 | |     x
20 | |     //~^ WARNING not reporting region error due to nll
21 | | }
   | |_^ return requires that `'a` must outlive `'static`
```

`mir_check_cast_unsize.rs` after:

```
error: unsatisfied lifetime constraints
  --> mir_check_cast_unsize.rs:19:5
   |
17 | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
   |        -- lifetime `'a` defined here
18 |     //~^ ERROR unsatisfied lifetime constraints
19 |     x
   |     ^ cast requires that `'a` must outlive `'static`
```
2018-09-07 17:56:23 +00:00
Niko Matsakis
ab43c1e9a4 add const_fn feature 2018-09-07 13:28:23 -04:00
Jordan Rhee
54a16aea6a Fix tidy errors 2018-09-07 08:41:16 -07:00
Niko Matsakis
e5e72f6666 switch back to using a plain u32, not NonZeroU32
This reverts (part of) commit cb9a336ae2cf6a75fdcc130853286349cb424c96.
2018-09-07 11:37:47 -04:00
Niko Matsakis
ec0ad09059 use a BTreeSet for a more stable error message order 2018-09-07 11:37:47 -04:00
Niko Matsakis
3805ebeeb9 remove use of from_u32_unchecked 2018-09-07 11:37:47 -04:00
Niko Matsakis
3b6361d29d switch to using NonZeroU32 to represent indices 2018-09-07 11:37:47 -04:00
Niko Matsakis
f702bd6a52 rewrite constants to use NewType::MAX instead of u32::MAX
Also, adjust the MAX to be `u32::MAX - 1`, leaving room for `u32::MAX`
to become a sentinel value in the future.
2018-09-07 11:37:47 -04:00
Niko Matsakis
c67d518b0d add various #[inline] directives 2018-09-07 11:37:47 -04:00
Niko Matsakis
24ab3758a6 remove all references to private from outside the macro 2018-09-07 11:37:47 -04:00
Niko Matsakis
6ccf9b8134 change from tuple struct to brace struct 2018-09-07 11:37:47 -04:00
Niko Matsakis
5aee959e9f make field always private, add From impls 2018-09-07 11:37:46 -04:00
Niko Matsakis
c46f185f67 add a comment 2018-09-07 11:34:41 -04:00
Niko Matsakis
1242639b88 change syntax of newtype_index to look like a struct decl 2018-09-07 11:34:41 -04:00
Jordan Rhee
b081a49a07 Removed hardcoded paths and unnecessary LLVM features 2018-09-07 08:34:24 -07:00
Marc-Antoine Perennou
ef44068613 rustbuild: allow configuring llvm version suffix
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2018-09-07 17:33:45 +02:00
Alex Crichton
0c89243fd3 Fix compiling some rustc crates to wasm
I was dabbling recently seeing what it would take to compile `rustfmt` to the
`wasm32-unknown-unknown` target and it turns out not much effort is needed!
Currently `rustfmt` depends on a few rustc crates published to crates.io, so
this commit touches up those crates to compile for wasm themselves. Notably:

* The `rustc_data_structures` crate's `flock` implementation is stubbed out to
  unconditionally return errors on unsupported platforms.
* The `rustc_errors` crate is extended to not do any locking for all non-windows
  platforms.

In both of these cases if we port the compiler to new platforms the
functionality isn't critical but will be discovered over time as it comes up, so
this hopefully doesn't make it too too hard to compile to new platforms!
2018-09-07 08:17:02 -07:00
bors
24ef47bccf Auto merge of #53893 - petrochenkov:cfgexpr, r=pnkfelix
Validate syntax of `cfg` attributes

Fixes https://github.com/rust-lang/rust/issues/53298
2018-09-07 15:14:52 +00:00
Tom Tromey
8aae6ca44a Have rust-lldb look for the rust-enabled lldb
We're shipping a rust-enabled lldb, but the "lldb" executable is not
installed into the "bin" directory by rustup.  See the discussion in
https://github.com/rust-lang-nursery/rustup.rs/pull/1492 for
background on this decision.  There, we agreed to have rust-lldb
prefer the rust-enabled lldb if it is installed.

This patch changes dist.rs to put lldb into rustlib, following what
was done for the other LLVM tools in #53955, and then fixes rust-lldb
to prefer that lldb, if it exists.

See issue #48168
2018-09-07 09:13:47 -06:00
ljedrz
8bbe1789fa A few cleanups and minor improvements to rustc_passes 2018-09-07 15:10:16 +02:00
bors
5a3292f163 Auto merge of #54021 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

Successful merges:

 - #53299 (Updated core/macros.rs to note it works in a no_std environment.)
 - #53376 (Cross reference io::copy and fs::copy in docs.)
 - #53455 (Individual docs for {from,to}_*_bytes)
 - #53550 (librustc_lint: In recursion warning, change 'recurring' to 'recursing')
 - #53860 (Migrate (some) of run-pass/ to ui)
 - #53874 (Implement Unpin for Box, Rc, and Arc)
 - #53895 (tidy: Cleanups and clippy warning fixes)
 - #53946 (Clarify `ManuallyDrop` docs)
 - #53948 (Minimized clippy test from when NLL disabled two-phase borrows)
 - #53959 (Add .git extension to submodule paths missing it)
 - #53966 (A few cleanups and minor improvements to mir/dataflow)
 - #53967 (propagate build.python into cmake)
 - #53979 (Remove `#[repr(transparent)]` from atomics)
 - #53991 (Add unchecked_shl/shr check for intrinsics to fix miri's test suit)
 - #53992 (migrate run-pass/borrowck to ui/run-pass)
 - #53994 (migrate run-pass/*/ to ui/run-pass)
 - #54023 (update clippy submodule)
2018-09-07 12:48:20 +00:00
Jorge Aparicio
358fc5b621 stabilize #[panic_handler] 2018-09-07 13:27:30 +02:00
kennytm
87fbf54413
Rollup merge of #54023 - matthiaskrgr:clippy, r=oli-obk
update clippy submodule

updates to cafef7b576
2018-09-07 18:14:28 +08:00
kennytm
ba57ef116f
Rollup merge of #53994 - pnkfelix:issue-53764-migrate-run-pass-dirs-to-ui, r=alexcrichton
migrate run-pass/*/ to ui/run-pass

I think this is all that remains of #53764
2018-09-07 18:14:05 +08:00
kennytm
12b382648e
Rollup merge of #53992 - pnkfelix:issue-53764-migrate-run-pass-borrowck-to-ui, r=nikomatsakis
migrate run-pass/borrowck to ui/run-pass

Part of #53764
2018-09-07 18:14:02 +08:00
kennytm
dcca8e86b1
Rollup merge of #53991 - TimDiekmann:fix-unchecked-intrinsics, r=oli-obk
Add unchecked_shl/shr check for intrinsics to fix miri's test suit

r? @RalfJung

cc @oli-obk

#53697 broke miri's test suite as described in [this comment](https://github.com/rust-lang/rust/pull/53697#issuecomment-419034668). This PR adds test for the `unchecked_shr/shl` for the intrinsics.
2018-09-07 18:13:59 +08:00
kennytm
9b70ef7780
Rollup merge of #53979 - alexcrichton:remove-repr-transparent-atomics-master, r=sfackler
Remove `#[repr(transparent)]` from atomics

Added in #52149 the discussion in #53514 is showing how we may not want to
actually add this attribute to the atomic types. While we continue to
debate #53514 this commit reverts the addition of the `transparent` attribute.
This should be a more conservative route which leaves us the ability to tweak
this in the future but in the meantime allows us to continue discussion as well.
2018-09-07 18:13:57 +08:00