Commit Graph

60585 Commits

Author SHA1 Message Date
bors
bb7e7ef70e Auto merge of #38861 - est31:master, r=alexcrichton
Make members of {std,core}::{i128,u128} unstable

Fixes #38860
2017-01-08 19:50:57 +00:00
bors
302602bcb3 Auto merge of #38853 - alexcrichton:better-dist, r=brson
rustbuild: Don't build target compilers in stage0

The `doc-book` and `doc-nomicon` steps accidentally depended on a rustbook
compiled by a cross-compiled compiler, which isn't necessary. Be sure to set the
`host` on these dependency edges to the build compiler to ensure that we're
always using a tool compiled for the host platform.

This was discovered trawling the build logs for the new dist bots and
discovering that they're building one too many compilers in stage0.
2017-01-08 17:48:14 +00:00
bors
d2c795932b Auto merge of #38837 - eddyb:issue-38074, r=nikomatsakis
Allow projections to be promoted to constants in MIR.

This employs the `LvalueContext` additions by @pcwalton to properly extend the MIR promotion of temporaries to allow projections (field accesses, indexing and dereferences) on said temporaries.

It's needed both parity with the old constant qualification logic (for current borrowck) and it fixes #38074.
The former is *required for soundness* if we accept the RFC for promoting rvalues to `'static` constants.
That is, until we get MIR borrowck and the same source of truth will be used for both checks and codegen.
2017-01-08 15:51:49 +00:00
Vadim Petrochenkov
7363674f2e Fix ICE when variant is used as a part of associated type 2017-01-08 16:40:50 +03:00
bors
e350c44e0c Auto merge of #38797 - abhijeetbhagat:master, r=petrochenkov
Fix process module tests to run on Windows

Fixes #38565
r? @retep998
2017-01-08 13:40:46 +00:00
Vadim Petrochenkov
39e1a7e99e Avoid large number of stage 0 warnings about --no-stack-check 2017-01-08 15:12:03 +03:00
bors
cbf88730e7 Auto merge of #38813 - eddyb:lazy-11, r=nikomatsakis
[11/n] Separate ty::Tables into one per each body.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38449) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

In order to track the results of type-checking and inference for incremental recompilation, they must be stored separately for each function or constant value, instead of lumped together.

These side-`Tables` also have to be tracked by various passes, as they visit through bodies (all of which have `Tables`, even if closures share the ones from their parent functions). This is usually done by switching a `tables` field in an override of `visit_nested_body` before recursing through `visit_body`, to the relevant one and then restoring it - however, in many cases the nesting is unnecessary and creating the visitor for each body in the crate and then visiting that body, would be a much cleaner solution.

To simplify handling of inlined HIR & its side-tables, their `NodeId` remapping and entries HIR map were fully stripped out, which means that `NodeId`s from inlined HIR must not be used where a local `NodeId` is expected. It might be possible to make the nodes (`Expr`, `Block`, `Pat`, etc.) that only show up within a `Body` have IDs that are scoped to that `Body`, which would also allow `Tables` to use `Vec`s.

That last part also fixes #38790 which was accidentally introduced in a previous refactor.
2017-01-08 11:36:52 +00:00
bors
7ac9d337dc Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
Remove not(stage0) from deny(warnings)

Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2017-01-08 08:22:06 +00:00
Esteban Küber
43b10fa8ed Teach diagnostics to have correctly padded lists
Make the suggestion list have a correct padding:

```
error[E0308]: mismatched types
 --> file.rs:3:20
  |
3 |     let x: usize = "";
  |                    ^^ expected usize, found reference
  |
  = note: expected type `usize`
  = note:    found type `&'static str`
  = help: here are some functions which might fulfill your needs:
          - .len()
          - .foo()
          - .bar()
```
2017-01-07 23:34:37 -08:00
Esteban Küber
78e9093abb trying to figure out why this test failes, might need help 2017-01-07 23:31:23 -08:00
Esteban Küber
563ecc1b1f add test case 2017-01-07 23:26:28 -08:00
bors
5219dad855 Auto merge of #38883 - alexcrichton:android-flaky, r=brson
compiletest: Fix flaky Android gdb test runs

Local testing showed that I was able to reproduce an error where debuginfo tests
on Android would fail with "connection reset by peer". Further investigation
turned out that the gdb tests are android with bit of process management:

* First an `adb forward` command is run to ensure that the host's port 5039 is
  the same as the emulator's.
* Next an `adb shell` command is run to execute the `gdbserver` executable
  inside the emulator. This gdb server will attach to port 5039 and listen for
  remote gdb debugging sessions.
* Finally, we run `gdb` on the host (not in the emulator) and then connect to
  this gdb server to send it commands.

The problem was happening when the host's gdb was failing to connect to the
remote gdbserver running inside the emulator. The previous test for this was
that after `adb shell` executed we'd sleep for a second and then attempt to make
a TCP connection to port 5039. If successful we'd run gdb and on failure we'd
sleep again.

It turns out, however, that as soon as we've executed `adb forward` all TCP
connections to 5039 will succeed. This means that we would only ever sleep for
at most one second, and if this wasn't enough time we'd just fail later because
we would assume that gdbserver had started but it may not have done so yet.

This commit fixes these issues by removing the TCP connection to test if
gdbserver is ready to go. Instead we read the stdout of the process and wait for
it to print that it's listening at which point we start running gdb. I've found
that locally at least I was unable to reproduce the failure after these changes.

Closes #38710
2017-01-08 06:19:14 +00:00
bors
0576869085 Auto merge of #38822 - michaelwoerister:collect-fn-once-adapter, r=eddyb
trans: Fix missing closure env drop-glue in trans-item collector.

FnOnce adapters automatically generated by the compiler introduce a call to drop the closure environment. The collector didn't pick up on that because this drop call does not show up in MIR. That could lead to an assertion being triggered if the drop-glue for the environment wasn't instantiated via something else.

Fixes #38810

cc @arielb1

r? @eddyb or @nikomatsakis
2017-01-08 04:18:32 +00:00
bors
05383b2765 Auto merge of #38807 - comex:pprint-expr-attr, r=nrc
Print attributes on expressions when pretty printing.

Test case: `rustc -Z unstable-options --unpretty=hir <(echo 'fn main() { #[allow()] main() }')`
2017-01-08 02:10:26 +00:00
bors
47c8d9fdcf Auto merge of #38798 - jsgf:fix-rpath, r=nikomatsakis
rustc: use -Xlinker when specifying an rpath with ',' in it

The `-Wl` option splits its parameters on commas, so if rustc specifies
`-Wl,-rpath,<path>` when `<path>` contains commas, the path gets split up
and the linker gets a partial path and spurious extra parameters.

Gcc/clang support the more verbose `-Xlinker` option to pass options to the linker directly, so use it for comma-containing paths.

Fixes issue #38795.
2017-01-08 00:10:15 +00:00
bors
089682611f Auto merge of #38781 - SimonSapin:unishrink, r=alexcrichton
Reduce the size of static data in std_unicode::tables

`BoolTrie` works well for sets of code points spread out through most of Unicode’s range, but is uses a lot of space for sets with few, mostly low, code points.

This switches a few of its instances to a similar but simpler trie data structure.

CC @raphlinus, who wrote the original `BoolTrie`.

## Before

`size_of::<BoolTrie>()` is 1552, which is added to `table.r3.len() * 8 + t.r5.len() + t.r6.len() * 8`:

* `Cc_table`: 1632
* `White_Space_table`: 1656
* `Pattern_White_Space_table`: 1640
* Total: 4928 bytes

## After

`size_of::<SmallBoolTrie>()` is 32, which is added to `t.r1.len() + t.r2.len() * 8`:

* `Cc_table`: 51
* `White_Space_table`: 273
* `Pattern_White_Space_table`: 193
* Total: 517 bytes

## Difference

Every Rust program with `std` statically linked should be about 4 KB smaller.
2017-01-07 21:28:47 +00:00
Steve Klabnik
95fe6ac14f thanks @eddyb 2017-01-07 14:27:04 -05:00
bors
b97b605211 Auto merge of #38733 - sfackler:peek-mut-pop, r=alexcrichton
Add PeekMut::pop

A fairly common workflow is to put a bunch of stuff into a binary heap
and then mutate the top value until its empty. This both makes that a
bit more convenient (no need to save a boolean off and pop after to
avoid borrowck issues), and a bit more efficient since you only shift
once.

r? @alexcrichton

cc @rust-lang/libs
2017-01-07 19:21:49 +00:00
Steve Klabnik
c547e08ce2 Improve safety warning on ptr::swap 2017-01-07 13:41:16 -05:00
Jeff Waugh
9f92d4f9d5 libcompiler_builtins: Don't build emutls.c
Rather than improving the check, let's ditch emutls.c entirely.
2017-01-08 03:34:31 +11:00
Alex Crichton
93f9e696c5 rustbuild: Pass --retry 3 to curl
Try to handle spurious network failures on Travis by automatically
retrying failed downloads on Travis.
2017-01-07 07:55:06 -08:00
bors
3191886426 Auto merge of #38551 - aidanhs:aphs-vec-in-place, r=brson
Implement placement-in protocol for `Vec`

Follow-up of #32366 per comment at https://github.com/rust-lang/rust/issues/30172#issuecomment-268099009, updating to latest rust, leaving @apasel422 as author and putting myself as committer.

I've removed the implementation of `push` in terms of place to make this PR more conservative.
2017-01-07 13:02:52 +00:00
bors
e1dfe3d678 Auto merge of #38469 - tbu-:pr_writeln_no_args, r=brson
Allow `writeln!` without arguments, in symmetry with `println!`

CC #36825.
2017-01-07 10:59:46 +00:00
bors
b9637f79e2 Auto merge of #38327 - Yamakaky:into-ipaddr, r=brson
Impl From<Ipv4Addr, Ipv6Addr> for IpAddr.

Fixes https://github.com/rust-lang/rfcs/issues/1816.
2017-01-07 09:00:52 +00:00
bors
008e2393bd Auto merge of #38859 - jonathandturner:E0088_fix, r=eddyb
E0088/E0090 fix

This fixes an issue reported by @eddyb (https://github.com/rust-lang/rust/pull/36208#issuecomment-2707092230) where the check for "too few lifetime parameters" was removed in one of the error message PRs.

I also removed the span shrinking from E0088, as early bound lifetimes give you a confusing underline in some cases.

r=eddyb
2017-01-07 05:59:38 +00:00
Alex Crichton
882426b404 travis: Wrap submodules updates in travis_retry
Let's try to squash some of those network issues with a `travis_retry`
tool to just retry the command a few times.
2017-01-06 21:28:57 -08:00
Alex Crichton
abb9189083 std: Add a nonblocking Child::try_wait method
This commit adds a new method to the `Child` type in the `std::process` module
called `try_wait`. This method is the same as `wait` except that it will not
block the calling thread and instead only attempt to collect the exit status. On
Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it
just means that we pass a 0 timeout to `WaitForSingleObject`.

Currently it's possible to build this method out of tree, but it's unfortunately
tricky to do so. Specifically on Unix you essentially lose ownership of the pid
for the process once a call to `waitpid` has succeeded. Although `Child` tracks
this state internally to be resilient to multiple calls to `wait` or a `kill`
after a successful wait, if the child is waited on externally then the state
inside of `Child` is not updated. This means that external implementations of
this method must be extra careful to essentially not use a `Child`'s methods
after a call to `waitpid` has succeeded (even in a nonblocking fashion).

By adding this functionality to the standard library it should help canonicalize
these external implementations and ensure they can continue to robustly reuse
the `Child` type from the standard library without worrying about pid ownership.
2017-01-06 21:20:39 -08:00
comex
743535a643 Add test case. 2017-01-06 23:15:08 -05:00
comex
55513696bd Fix test/ui/span/issue-24690.stderr
The errors are now emitted in a different order (in order of source
location rather than going back and forth) but otherwise everything's
the same.
2017-01-06 23:14:57 -05:00
comex
b16a54dd30 Remove accidental submodule change. 2017-01-06 23:13:32 -05:00
bors
b6c97c3da6 Auto merge of #38858 - ollie27:rustbuild_docs_std, r=alexcrichton
rustbuild: Stop building docs for std dependancies

Fixes: #38319

r? @alexcrichton
2017-01-07 04:02:43 +00:00
Esteban Küber
c999221cf8 Move check-ui to fulldeps so librustc is available
As per @alexcrichton's comment in #38607.
2017-01-06 18:18:47 -08:00
Esteban Küber
e72b203566 Test for appropriate span on second custom derive 2017-01-06 18:17:34 -08:00
bors
25bfc8aedc Auto merge of #38855 - Mark-Simulacrum:immediate-fix, r=eddyb
Fix ICE on i686 when calling immediate() on OperandValue::Ref in return

Fixes #38727, and adds a test case.

r? @eddyb
2017-01-07 02:01:51 +00:00
Kyle Aleshire
4af830a2c8 Error message more like original 2017-01-06 19:13:59 -06:00
bors
7e38a89a7b Auto merge of #38835 - alexcrichton:less-overlapped, r=brson
std: Don't pass overlapped handles to processes

This commit fixes a mistake introduced in #31618 where overlapped handles were
leaked to child processes on Windows. On Windows once a handle is in overlapped
mode it should always have I/O executed with an instance of `OVERLAPPED`. Most
child processes, however, are not prepared to have their stdio handles in
overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle.

Now we haven't had any odd behavior in Rust up to this point, and the original
bug was introduced almost a year ago. I believe this is because it turns out
that if you *don't* pass an `OVERLAPPED` then the system will [supply one for
you][link]. In this case everything will go awry if you concurrently operate on
the handle. In Rust, however, the stdio handles are always locked, and there's
no way to not use them unlocked in libstd. Due to that change we've always had
synchronized access to these handles, which means that Rust programs typically
"just work".

Conversely, though, this commit fixes the test case included, which exhibits
behavior that other programs Rust spawns may attempt to execute. Namely, the
stdio handles may be concurrently used and having them in overlapped mode wreaks
havoc.

[link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343

Closes #38811
2017-01-06 23:49:57 +00:00
bors
373efe8794 Auto merge of #38815 - cardoe:fix-print, r=nikomatsakis
fix help for the --print option

Since 8285ab5c99, which was merged in with #38061, the help for the
--print option is missing the surrounding [ ] around the possible
options.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2017-01-06 21:23:51 +00:00
Eduard-Mihai Burtescu
cde0a7e7e0 rustc: store ty::Tables separately for each body (except closures'). 2017-01-06 22:23:29 +02:00
Eduard-Mihai Burtescu
85a4a192c7 rustc: keep track of tables everywhere as if they were per-body. 2017-01-06 22:23:29 +02:00
bors
e447b73f39 Auto merge of #38792 - jseyfried:improve_macros_11_diagnostics, r=nikomatsakis
proc macros 1.1: improve diagnostics

Fixes #38586.
r? @nrc
2017-01-06 19:23:06 +00:00
Alex Crichton
9ced90164c compiletest: Fix flaky Android gdb test runs
Local testing showed that I was able to reproduce an error where debuginfo tests
on Android would fail with "connection reset by peer". Further investigation
turned out that the gdb tests are android with bit of process management:

* First an `adb forward` command is run to ensure that the host's port 5039 is
  the same as the emulator's.
* Next an `adb shell` command is run to execute the `gdbserver` executable
  inside the emulator. This gdb server will attach to port 5039 and listen for
  remote gdb debugging sessions.
* Finally, we run `gdb` on the host (not in the emulator) and then connect to
  this gdb server to send it commands.

The problem was happening when the host's gdb was failing to connect to the
remote gdbserver running inside the emulator. The previous test for this was
that after `adb shell` executed we'd sleep for a second and then attempt to make
a TCP connection to port 5039. If successful we'd run gdb and on failure we'd
sleep again.

It turns out, however, that as soon as we've executed `adb forward` all TCP
connections to 5039 will succeed. This means that we would only ever sleep for
at most one second, and if this wasn't enough time we'd just fail later because
we would assume that gdbserver had started but it may not have done so yet.

This commit fixes these issues by removing the TCP connection to test if
gdbserver is ready to go. Instead we read the stdout of the process and wait for
it to print that it's listening at which point we start running gdb. I've found
that locally at least I was unable to reproduce the failure after these changes.

Closes #38710
2017-01-06 10:26:40 -08:00
derekdreery
0a85d5f7f3 Update vec.rs
Changed language to stress char is the C meaning (u8) not unicode.
2017-01-06 18:17:18 +00:00
bors
a28701a928 Auto merge of #38304 - sfackler:no-ipv6only, r=alexcrichton
Deprecate TcpListener::set_only_v6

This was supposed to have been removed in #33124 but snuck through :(

Should the docs be removed?

I left the accessor undeprecated since it should actually work, though that method doesn't exist on other networking types.

r? @alexcrichton
cc @rust-lang/libs
2017-01-06 16:55:06 +00:00
derekdreery
5cb37f6331 Update vec.rs
Add a warning not to convert  char* from c to Vec<u8> (I thought you could until I asked on irc)
2017-01-06 15:58:35 +00:00
bors
0728b71034 Auto merge of #38833 - arielb1:constant-mir-overflow, r=eddyb
fix promotion of MIR terminators

promotion of MIR terminators used to try to promote the destination it
is trying to promote, leading to stack overflow.

Also clean up the code in `promote_temp` a bit to make it more understandable.

Fixes #37991.

cc @nikomatsakis
r? @eddyb
2017-01-06 09:43:37 +00:00
Alex Crichton
7eb43f1b20 std: Ignore close_read_wakes_up on Windows
It looks like in practice at least this test will not pass on Windows.
Empirically it is prone to blocking forever, presumably because a call to
`shutdown` doesn't actually wake up other threads on Windows.

We don't document this as a guarantee for `shutdown`, nor do we internally rely
on it. This test originated in a time long since passed when it was leveraged
for canceling I/O, but nowadays there's nothing fancy happening in the standard
library so it's not really a productive test anyway, hence just ignoring it on
Windows.

Closes #31657
2017-01-05 22:58:37 -08:00
bors
e7907a9910 Auto merge of #38793 - jseyfried:fix_macro_export_duplicates, r=nrc
Fix regression with duplicate `#[macro_export] macro_rules!`

Fixes #38715.
r? @nrc
2017-01-06 06:41:31 +00:00
Steven Fackler
eb5e9ab145 Deprecate TcpListener::set_only_v6
This was supposed to have been removed in #33124 but snuck through :(
2017-01-05 21:36:27 -08:00
Steven Fackler
54dc533494 Add a tracking issue 2017-01-05 19:36:35 -08:00
est31
1779ffa98f Make members of {std,core}::{i128,u128} unstable
Adding it in a stable form was an accident.
It thankfully only leaked to nightly.

Fixes #38860
2017-01-06 03:53:55 +01:00