]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #38606 - estebank:test-for-27522, r=petrochenkov
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:38 +0000 (20:27 +0900)]
Rollup merge of #38606 - estebank:test-for-27522, r=petrochenkov

Add test for correct span for type

Adds test for and closes #27522.

7 years agoAuto merge of #38138 - rkruppe:no_std-no_loop, r=steveklabnik
bors [Tue, 10 Jan 2017 06:50:59 +0000 (06:50 +0000)]
Auto merge of #38138 - rkruppe:no_std-no_loop, r=steveklabnik

book: use abort() over loop {} for panic

Due to #28728 `loop {}` is very risky and can lead to fun debugging experiences such as #38136. Besides, aborting is probably better behavior than an infinite loop.

r? @steveklabnik

7 years agoAuto merge of #38947 - nrc:custom-derive-span, r=jseyfried
bors [Tue, 10 Jan 2017 04:44:04 +0000 (04:44 +0000)]
Auto merge of #38947 - nrc:custom-derive-span, r=jseyfried

Give custom derive spans an expansion ID

r? @jseyfried

7 years agoAuto merge of #38934 - Manishearth:nodrop, r=eddyb
bors [Tue, 10 Jan 2017 02:45:37 +0000 (02:45 +0000)]
Auto merge of #38934 - Manishearth:nodrop, r=eddyb

Remove destructor-related restrictions from unions

They don't have drop glue.

This doesn't fix the rvalue promotion issues when trying to do things like `static FOO: NoDrop<Bar> = NoDrop {inner: Bar}`. I'm not sure if we should fix that.

7 years agoGive custom derive spans an expansion ID
Nick Cameron [Mon, 9 Jan 2017 22:02:26 +0000 (11:02 +1300)]
Give custom derive spans an expansion ID

7 years agoAuto merge of #38937 - nrc:save-ty-fix, r=nikomatsakis
bors [Mon, 9 Jan 2017 23:46:00 +0000 (23:46 +0000)]
Auto merge of #38937 - nrc:save-ty-fix, r=nikomatsakis

save-analysis: fix over-zealous filter on generated code

7 years agoAuto merge of #38244 - estebank:escape-reason-docs, r=ollie27
bors [Mon, 9 Jan 2017 19:38:50 +0000 (19:38 +0000)]
Auto merge of #38244 - estebank:escape-reason-docs, r=ollie27

rustdoc: escape the deprecated and unstable reason text

Fix #38220.
Instead of the [current output](https://doc.rust-lang.org/std/boxed/trait.FnBox.html):

<img width="967" alt="incorrect unescaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021898/73121d42-bd2f-11e6-8076-8a5127dbc010.png">

display:

<img width="979" alt="escaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021876/52eb0f88-bd2f-11e6-9088-58bdc7d92328.png">

7 years agoMake unions never have needs_drop
Manish Goregaokar [Mon, 9 Jan 2017 15:13:28 +0000 (07:13 -0800)]
Make unions never have needs_drop

7 years agoAuto merge of #38581 - frewsxcv:vecdequeue-insert, r=GuillaumeGomez
bors [Mon, 9 Jan 2017 17:31:41 +0000 (17:31 +0000)]
Auto merge of #38581 - frewsxcv:vecdequeue-insert, r=GuillaumeGomez

Clarify behavior of `VecDeque::insert`.

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

7 years agoAuto merge of #38310 - frewsxcv:ctlz-cttz, r=pnkfelix
bors [Mon, 9 Jan 2017 13:56:10 +0000 (13:56 +0000)]
Auto merge of #38310 - frewsxcv:ctlz-cttz, r=pnkfelix

Clarify zero-value behavior of `ctlz`/`cttz` intrinsics.

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

7 years agoAuto merge of #38929 - Manishearth:compiler-docs, r=alexcrichton
bors [Mon, 9 Jan 2017 10:58:08 +0000 (10:58 +0000)]
Auto merge of #38929 - Manishearth:compiler-docs, r=alexcrichton

Don't restrict docs in compiler-docs mode

Search is broken without this. We want all crates to be included in compiler-docs mode. This was changed in https://github.com/rust-lang/rust/pull/38858, this PR brings that functionality back in compiler-docs mode.

7 years agoAuto merge of #38923 - petrochenkov:scheck, r=alexcrichton
bors [Mon, 9 Jan 2017 08:58:28 +0000 (08:58 +0000)]
Auto merge of #38923 - petrochenkov:scheck, r=alexcrichton

Avoid large number of stage 0 warnings about --no-stack-check

```
....

rustc: x86_64-pc-windows-gnu/stage0/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd
warning: the --no-stack-check flag is deprecated and does nothing

rustc: x86_64-pc-windows-gnu/stage0/lib/rustlib/x86_64-pc-windows-gnu/lib/libgetopts
warning: the --no-stack-check flag is deprecated and does nothing

rustc: x86_64-pc-windows-gnu/stage0/lib/rustlib/x86_64-pc-windows-gnu/lib/libterm
warning: the --no-stack-check flag is deprecated and does nothing

rustc: x86_64-pc-windows-gnu/stage0/lib/rustlib/x86_64-pc-windows-gnu/lib/liblog
warning: the --no-stack-check flag is deprecated and does nothing

....
```

r? @alexcrichton

7 years agoAuto merge of #38866 - alexcrichton:try-wait, r=aturon
bors [Mon, 9 Jan 2017 07:01:10 +0000 (07:01 +0000)]
Auto merge of #38866 - alexcrichton:try-wait, r=aturon

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.

7 years agoAuto merge of #38840 - kjaleshire:multiple-targets-error-fix, r=nrc
bors [Mon, 9 Jan 2017 04:57:36 +0000 (04:57 +0000)]
Auto merge of #38840 - kjaleshire:multiple-targets-error-fix, r=nrc

Warn that the link target ignores the given name

Hi, new contributor here. This is my stab at #20130, any feedback welcome!

7 years agoDon't restrict docs in compiler-docs mode
Manish Goregaokar [Sun, 8 Jan 2017 19:37:52 +0000 (11:37 -0800)]
Don't restrict docs in compiler-docs mode

7 years agoAuto merge of #38910 - steveklabnik:update_docs, r=eddyb
bors [Mon, 9 Jan 2017 02:59:33 +0000 (02:59 +0000)]
Auto merge of #38910 - steveklabnik:update_docs, r=eddyb

Improve safety warning on ptr::swap

r? @eddyb @bluss , who I asked about this on IRC

7 years agosave-analysis: fix over-zealous filter on generated code
Nick Cameron [Mon, 9 Jan 2017 02:07:07 +0000 (15:07 +1300)]
save-analysis: fix over-zealous filter on generated code

7 years agoAuto merge of #38907 - alexcrichton:curl-retry, r=japaric
bors [Mon, 9 Jan 2017 01:00:30 +0000 (01:00 +0000)]
Auto merge of #38907 - alexcrichton:curl-retry, r=japaric

rustbuild: Pass --retry 3 to curl

Try to handle spurious network failures on Travis by automatically
retrying failed downloads on Travis.

7 years agoAuto merge of #38904 - alexcrichton:travis-retry, r=japaric
bors [Sun, 8 Jan 2017 23:01:11 +0000 (23:01 +0000)]
Auto merge of #38904 - alexcrichton:travis-retry, r=japaric

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.

7 years agoAuto merge of #38861 - est31:master, r=alexcrichton
bors [Sun, 8 Jan 2017 19:50:57 +0000 (19:50 +0000)]
Auto merge of #38861 - est31:master, r=alexcrichton

Make members of {std,core}::{i128,u128} unstable

Fixes #38860

7 years agoAuto merge of #38853 - alexcrichton:better-dist, r=brson
bors [Sun, 8 Jan 2017 17:48:14 +0000 (17:48 +0000)]
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.

7 years agoAuto merge of #38837 - eddyb:issue-38074, r=nikomatsakis
bors [Sun, 8 Jan 2017 15:51:49 +0000 (15:51 +0000)]
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.

7 years agoAuto merge of #38797 - abhijeetbhagat:master, r=petrochenkov
bors [Sun, 8 Jan 2017 13:40:46 +0000 (13:40 +0000)]
Auto merge of #38797 - abhijeetbhagat:master, r=petrochenkov

Fix process module tests to run on Windows

Fixes #38565
r? @retep998

7 years agoAvoid large number of stage 0 warnings about --no-stack-check
Vadim Petrochenkov [Sun, 8 Jan 2017 12:09:55 +0000 (15:09 +0300)]
Avoid large number of stage 0 warnings about --no-stack-check

7 years agoAuto merge of #38813 - eddyb:lazy-11, r=nikomatsakis
bors [Sun, 8 Jan 2017 11:36:52 +0000 (11:36 +0000)]
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.

7 years agoAuto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
bors [Sun, 8 Jan 2017 08:22:06 +0000 (08:22 +0000)]
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.

7 years agoAuto merge of #38883 - alexcrichton:android-flaky, r=brson
bors [Sun, 8 Jan 2017 06:19:14 +0000 (06:19 +0000)]
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

7 years agoAuto merge of #38822 - michaelwoerister:collect-fn-once-adapter, r=eddyb
bors [Sun, 8 Jan 2017 04:18:32 +0000 (04:18 +0000)]
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

7 years agoAuto merge of #38807 - comex:pprint-expr-attr, r=nrc
bors [Sun, 8 Jan 2017 02:10:26 +0000 (02:10 +0000)]
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() }')`

7 years agoAuto merge of #38798 - jsgf:fix-rpath, r=nikomatsakis
bors [Sun, 8 Jan 2017 00:10:15 +0000 (00:10 +0000)]
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.

7 years agoAuto merge of #38781 - SimonSapin:unishrink, r=alexcrichton
bors [Sat, 7 Jan 2017 21:28:47 +0000 (21:28 +0000)]
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.

7 years agothanks @eddyb
Steve Klabnik [Sat, 7 Jan 2017 19:27:04 +0000 (14:27 -0500)]
thanks @eddyb

7 years agoAuto merge of #38733 - sfackler:peek-mut-pop, r=alexcrichton
bors [Sat, 7 Jan 2017 19:21:49 +0000 (19:21 +0000)]
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

7 years agoImprove safety warning on ptr::swap
Steve Klabnik [Sat, 7 Jan 2017 18:41:16 +0000 (13:41 -0500)]
Improve safety warning on ptr::swap

7 years agorustbuild: Pass --retry 3 to curl
Alex Crichton [Sat, 7 Jan 2017 15:55:06 +0000 (07:55 -0800)]
rustbuild: Pass --retry 3 to curl

Try to handle spurious network failures on Travis by automatically
retrying failed downloads on Travis.

7 years agoAuto merge of #38551 - aidanhs:aphs-vec-in-place, r=brson
bors [Sat, 7 Jan 2017 13:02:52 +0000 (13:02 +0000)]
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.

7 years agoAuto merge of #38469 - tbu-:pr_writeln_no_args, r=brson
bors [Sat, 7 Jan 2017 10:59:46 +0000 (10:59 +0000)]
Auto merge of #38469 - tbu-:pr_writeln_no_args, r=brson

Allow `writeln!` without arguments, in symmetry with `println!`

CC #36825.

7 years agoAuto merge of #38327 - Yamakaky:into-ipaddr, r=brson
bors [Sat, 7 Jan 2017 09:00:52 +0000 (09:00 +0000)]
Auto merge of #38327 - Yamakaky:into-ipaddr, r=brson

Impl From<Ipv4Addr, Ipv6Addr> for IpAddr.

Fixes https://github.com/rust-lang/rfcs/issues/1816.

7 years agoAuto merge of #38859 - jonathandturner:E0088_fix, r=eddyb
bors [Sat, 7 Jan 2017 05:59:38 +0000 (05:59 +0000)]
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

7 years agotravis: Wrap submodules updates in travis_retry
Alex Crichton [Sat, 7 Jan 2017 05:28:57 +0000 (21:28 -0800)]
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.

7 years agostd: Add a nonblocking `Child::try_wait` method
Alex Crichton [Fri, 6 Jan 2017 06:47:09 +0000 (22:47 -0800)]
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.

7 years agoAuto merge of #38858 - ollie27:rustbuild_docs_std, r=alexcrichton
bors [Sat, 7 Jan 2017 04:02:43 +0000 (04:02 +0000)]
Auto merge of #38858 - ollie27:rustbuild_docs_std, r=alexcrichton

rustbuild: Stop building docs for std dependancies

Fixes: #38319
r? @alexcrichton

7 years agoAuto merge of #38855 - Mark-Simulacrum:immediate-fix, r=eddyb
bors [Sat, 7 Jan 2017 02:01:51 +0000 (02:01 +0000)]
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

7 years agoError message more like original
Kyle Aleshire [Sat, 7 Jan 2017 01:13:59 +0000 (19:13 -0600)]
Error message more like original

7 years agoAuto merge of #38835 - alexcrichton:less-overlapped, r=brson
bors [Fri, 6 Jan 2017 23:49:57 +0000 (23:49 +0000)]
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

7 years agoAuto merge of #38815 - cardoe:fix-print, r=nikomatsakis
bors [Fri, 6 Jan 2017 21:23:51 +0000 (21:23 +0000)]
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>
7 years agorustc: store ty::Tables separately for each body (except closures').
Eduard-Mihai Burtescu [Wed, 4 Jan 2017 02:01:58 +0000 (04:01 +0200)]
rustc: store ty::Tables separately for each body (except closures').

7 years agorustc: keep track of tables everywhere as if they were per-body.
Eduard-Mihai Burtescu [Fri, 6 Jan 2017 19:54:24 +0000 (21:54 +0200)]
rustc: keep track of tables everywhere as if they were per-body.

7 years agoAuto merge of #38792 - jseyfried:improve_macros_11_diagnostics, r=nikomatsakis
bors [Fri, 6 Jan 2017 19:23:06 +0000 (19:23 +0000)]
Auto merge of #38792 - jseyfried:improve_macros_11_diagnostics, r=nikomatsakis

proc macros 1.1: improve diagnostics

Fixes #38586.
r? @nrc

7 years agocompiletest: Fix flaky Android gdb test runs
Alex Crichton [Fri, 6 Jan 2017 18:26:40 +0000 (10:26 -0800)]
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

7 years agoAuto merge of #38304 - sfackler:no-ipv6only, r=alexcrichton
bors [Fri, 6 Jan 2017 16:55:06 +0000 (16:55 +0000)]
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

7 years agoAuto merge of #38833 - arielb1:constant-mir-overflow, r=eddyb
bors [Fri, 6 Jan 2017 09:43:37 +0000 (09:43 +0000)]
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

7 years agoAuto merge of #38793 - jseyfried:fix_macro_export_duplicates, r=nrc
bors [Fri, 6 Jan 2017 06:41:31 +0000 (06:41 +0000)]
Auto merge of #38793 - jseyfried:fix_macro_export_duplicates, r=nrc

Fix regression with duplicate `#[macro_export] macro_rules!`

Fixes #38715.
r? @nrc

7 years agoDeprecate TcpListener::set_only_v6
Steven Fackler [Sun, 11 Dec 2016 17:52:36 +0000 (09:52 -0800)]
Deprecate TcpListener::set_only_v6

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

7 years agoAdd a tracking issue
Steven Fackler [Fri, 6 Jan 2017 03:36:35 +0000 (19:36 -0800)]
Add a tracking issue

7 years agoMake members of {std,core}::{i128,u128} unstable
est31 [Fri, 6 Jan 2017 01:49:28 +0000 (02:49 +0100)]
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

7 years agoAuto merge of #38069 - canndrew:empty-sub-patterns-again, r=nikomatsakis
bors [Fri, 6 Jan 2017 00:17:41 +0000 (00:17 +0000)]
Auto merge of #38069 - canndrew:empty-sub-patterns-again, r=nikomatsakis

Fix handling of empty types in patterns.

Fix for #12609.

7 years agoFix tidy warning
Jonathan Turner [Thu, 5 Jan 2017 23:18:11 +0000 (10:18 +1100)]
Fix tidy warning

7 years agoAdd in test for E0090
Jonathan Turner [Thu, 5 Jan 2017 23:05:55 +0000 (10:05 +1100)]
Add in test for E0090

7 years agoAdd back in previous logic and remove span shrinking
Jonathan Turner [Thu, 5 Jan 2017 23:00:07 +0000 (10:00 +1100)]
Add back in previous logic and remove span shrinking

7 years agorustbuild: Stop building docs for std dependancies
Oliver Middleton [Thu, 5 Jan 2017 22:26:04 +0000 (22:26 +0000)]
rustbuild: Stop building docs for std dependancies

7 years agoAuto merge of #38689 - pnkfelix:dont-check-stability-on-private-items, r=nikomatsakis
bors [Thu, 5 Jan 2017 21:58:45 +0000 (21:58 +0000)]
Auto merge of #38689 - pnkfelix:dont-check-stability-on-private-items, r=nikomatsakis

Dont check stability for items that are not pub to universe.

Dont check stability for items that are not pub to universe.

In other words, skip it for private and even `pub(restricted)` items, because stability checks are only relevant to things visible in other crates.

Fix #38412.

7 years agoFix ICE on i686 when calling immediate() on OperandValue::Ref in return
Mark Simulacrum [Thu, 5 Jan 2017 19:22:51 +0000 (12:22 -0700)]
Fix ICE on i686 when calling immediate() on OperandValue::Ref in return

7 years agoAuto merge of #38817 - jseyfried:improve_unused_qualification_lint, r=petrochenkov
bors [Thu, 5 Jan 2017 19:56:31 +0000 (19:56 +0000)]
Auto merge of #38817 - jseyfried:improve_unused_qualification_lint, r=petrochenkov

resolve: don't `unused_qualifications`-check global paths

We started `unused_qualifications`-checking global paths in #38014, causing #38682.
Fixes #38682.
r? @nrc

7 years agorustbuild: Don't build target compilers in stage0
Alex Crichton [Thu, 5 Jan 2017 19:16:48 +0000 (11:16 -0800)]
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.

7 years agofix doc test for E0001
Andrew Cann [Thu, 5 Jan 2017 17:00:03 +0000 (01:00 +0800)]
fix doc test for E0001

7 years agoUn-remove E0001, put a notice on it instead
Andrew Cann [Thu, 5 Jan 2017 15:48:02 +0000 (23:48 +0800)]
Un-remove E0001, put a notice on it instead

7 years agoAuto merge of #38152 - arielb1:special-copy, r=nikomatsakis
bors [Thu, 5 Jan 2017 13:05:30 +0000 (13:05 +0000)]
Auto merge of #38152 - arielb1:special-copy, r=nikomatsakis

Fix associated types in copy implementations

Fixes an ICE and an error in checking copy implementations.

r? @nikomatsakis

7 years agoAuto merge of #38776 - eddyb:unsigned-means-unsigned, r=pnkfelix
bors [Thu, 5 Jan 2017 11:06:10 +0000 (11:06 +0000)]
Auto merge of #38776 - eddyb:unsigned-means-unsigned, r=pnkfelix

Properly ban the negation of unsigned integers in type-checking.

Lint-time banning of unsigned negation appears to be vestigial from a time it was feature-gated.
But now it always errors and we do have the ability to deref the checking of e.g. `-0`, through the trait obligation fulfillment context, which will only succeed/error when the `0` gets inferred to a specific type.

The two removed tests are the main reason for finally cleaning this up, they need changing all the time when refactoring the HIR-based `rustc_const_eval` and/or `rustc_passes::consts`, as warnings pile up.

7 years agoAuto merge of #38767 - est31:master, r=eddyb
bors [Thu, 5 Jan 2017 09:02:40 +0000 (09:02 +0000)]
Auto merge of #38767 - est31:master, r=eddyb

Some i128 tests

* Add some FFI tests for i128 on architectures where we have sort of working "C" FFI support. On all other architectures we ignore the test.
* enhance the u128 overflow tests

7 years agoAuto merge of #38756 - Mark-Simulacrum:2nd-trans-cleanup, r=eddyb
bors [Thu, 5 Jan 2017 06:01:24 +0000 (06:01 +0000)]
Auto merge of #38756 - Mark-Simulacrum:2nd-trans-cleanup, r=eddyb

Additional cleanup to rustc_trans

Removes `BlockAndBuilder`, `FunctionContext`, and `MaybeSizedValue`.

`LvalueRef` is used instead of `MaybeSizedValue`, which has the added benefit of making functions operating on `Lvalue`s be able to take just that (since it encodes the type with an `LvalueTy`, which can carry discriminant information) instead of a `MaybeSizedValue` and a discriminant.

r? @eddyb

7 years agoAuto merge of #38731 - alexcrichton:supafast-cross-dist, r=brson
bors [Thu, 5 Jan 2017 04:01:35 +0000 (04:01 +0000)]
Auto merge of #38731 - alexcrichton:supafast-cross-dist, r=brson

rustbuild: Quickly `dist` cross-host compilers

This commit optimizes the compile time for creating tarballs of cross-host
compilers and as a proof of concept adds two to the standard Travis matrix. Much
of this commit is further refactoring and refining of the `step.rs` definitions
along with the interpretation of `--target` and `--host` flags. This has gotten
confusing enough that I've also added a small test suite to
`src/bootstrap/step.rs` to ensure what we're doing works and doesn't regress.

After this commit when you execute:

    ./x.py dist --host $MY_HOST --target $MY_HOST

the build system will compile two compilers. The first is for the build platform
and the second is for the host platform. This second compiler is then packaged
up and placed into `build/dist` and is ready to go. With a fully cached LLVM and
docker image I was able to create a cross-host compiler in around 20 minutes
locally.

Eventually we plan to add a whole litany of cross-host entries to the Travis
matrix, but for now we're just adding a few before we eat up all the extra
capacity.

cc #38531

7 years agoWarn that the name is ignored if a link target is emitted
Kyle Aleshire [Thu, 5 Jan 2017 00:23:19 +0000 (18:23 -0600)]
Warn that the name is ignored if a link target is emitted

7 years agoAllow projections to be promoted to constants in MIR.
Eduard-Mihai Burtescu [Thu, 5 Jan 2017 00:33:09 +0000 (02:33 +0200)]
Allow projections to be promoted to constants in MIR.

7 years agoAuto merge of #38770 - steveklabnik:doc-custom-derive, r=alexcrichton
bors [Thu, 5 Jan 2017 00:11:37 +0000 (00:11 +0000)]
Auto merge of #38770 - steveklabnik:doc-custom-derive, r=alexcrichton

Document custom derive.

These are some bare-bones documentation for custom derive, needed
to stabilize "macros 1.1",
https://github.com/rust-lang/rust/issues/35900

The book chapter is based off of a blog post by @cbreeden,
https://cbreeden.github.io/Macros11/

Normally, we have a policy of not mentioning external crates in
documentation. However, given that syn/quote are basically neccesary
for properly using macros 1.1, I feel that not including them here
would make the documentation very bad. So the rules should be bent
in this instance.

So far, this PR includes only docs; @alexcrichton said in https://github.com/rust-lang/rust/issues/35900 that he'd be okay with landing them before stabilization; I don't mind either way.

7 years agostd: Don't pass overlapped handles to processes
Alex Crichton [Wed, 4 Jan 2017 23:32:39 +0000 (15:32 -0800)]
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

7 years agofix promotion of MIR terminators
Ariel Ben-Yehuda [Wed, 4 Jan 2017 23:19:54 +0000 (01:19 +0200)]
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.

Fixes #37991.

7 years agobook: use abort() over loop {} for panic
Robin Kruppe [Sat, 3 Dec 2016 01:10:59 +0000 (02:10 +0100)]
book: use abort() over loop {} for panic

Due to #28728 loop {} is very risky and can lead to fun debugging experiences like in #38136. Besides, aborting is probably better behavior than an infinite loop.

7 years agoDocument custom derive.
Steve Klabnik [Mon, 2 Jan 2017 01:33:37 +0000 (20:33 -0500)]
Document custom derive.

These are some bare-bones documentation for custom derive, needed
to stabilize "macros 1.1",
https://github.com/rust-lang/rust/issues/35900

The book chapter is based off of a blog post by @cbreeden,
https://cbreeden.github.io/Macros11/

Normally, we have a policy of not mentioning external crates in
documentation. However, given that syn/quote are basically neccesary
for properly using macros 1.1, I feel that not including them here
would make the documentation very bad. So the rules should be bent
in this instance.

7 years agotrans: Make the trans-item collector see through VTableFnPointer.
Michael Woerister [Wed, 4 Jan 2017 21:54:37 +0000 (16:54 -0500)]
trans: Make the trans-item collector see through VTableFnPointer.

7 years agoAuto merge of #38783 - alexcrichton:stabilize-proc-macro, r=nikomatsakis
bors [Wed, 4 Jan 2017 20:06:21 +0000 (20:06 +0000)]
Auto merge of #38783 - alexcrichton:stabilize-proc-macro, r=nikomatsakis

rustc: Stabilize the `proc_macro` feature

This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the
compiler to stabilize the "Macros 1.1" feature of the language. Many more
details can be found on the tracking issue, #35900.

Closes #35900

7 years agorustbuild: Quickly `dist` cross-host compilers
Alex Crichton [Sat, 31 Dec 2016 03:50:57 +0000 (19:50 -0800)]
rustbuild: Quickly `dist` cross-host compilers

This commit optimizes the compile time for creating tarballs of cross-host
compilers and as a proof of concept adds two to the standard Travis matrix. Much
of this commit is further refactoring and refining of the `step.rs` definitions
along with the interpretation of `--target` and `--host` flags. This has gotten
confusing enough that I've also added a small test suite to
`src/bootstrap/step.rs` to ensure what we're doing works and doesn't regress.

After this commit when you execute:

    ./x.py dist --host $MY_HOST --target $MY_HOST

the build system will compile two compilers. The first is for the build platform
and the second is for the host platform. This second compiler is then packaged
up and placed into `build/dist` and is ready to go. With a fully cached LLVM and
docker image I was able to create a cross-host compiler in around 20 minutes
locally.

Eventually we plan to add a whole litany of cross-host entries to the Travis
matrix, but for now we're just adding a few before we eat up all the extra
capacity.

cc #38531

7 years agoFix errors introduced during rebase
Mark Simulacrum [Wed, 4 Jan 2017 18:47:43 +0000 (11:47 -0700)]
Fix errors introduced during rebase

7 years agoSimplify handling of dropping structs.
Mark Simulacrum [Wed, 4 Jan 2017 03:54:22 +0000 (20:54 -0700)]
Simplify handling of dropping structs.

7 years agoPull out downcasting into caller of iter_variant
Mark Simulacrum [Wed, 4 Jan 2017 03:16:36 +0000 (20:16 -0700)]
Pull out downcasting into caller of iter_variant

Renames iter_variant to iter_variant_fields to more clearly communicate
the purpose of the function.

7 years agoRemove extraneous setting of builder positions.
Mark Simulacrum [Wed, 4 Jan 2017 03:10:45 +0000 (20:10 -0700)]
Remove extraneous setting of builder positions.

7 years agoSimplify code further
Mark Simulacrum [Mon, 2 Jan 2017 21:47:15 +0000 (14:47 -0700)]
Simplify code further

7 years agoInline and remove Builder::entry_block
Mark Simulacrum [Mon, 2 Jan 2017 20:51:09 +0000 (13:51 -0700)]
Inline and remove Builder::entry_block

7 years agoFix style nit
Mark Simulacrum [Mon, 2 Jan 2017 20:24:04 +0000 (13:24 -0700)]
Fix style nit

7 years agoBuilder.build_new_block -> Builder.build_sibling_block
Mark Simulacrum [Mon, 2 Jan 2017 20:18:38 +0000 (13:18 -0700)]
Builder.build_new_block -> Builder.build_sibling_block

7 years agoInline trans_switch to simplify code
Mark Simulacrum [Mon, 2 Jan 2017 20:05:42 +0000 (13:05 -0700)]
Inline trans_switch to simplify code

7 years agoMove trans_field_ptr and struct_field_ptr to mir/lvalue
Mark Simulacrum [Mon, 2 Jan 2017 19:13:59 +0000 (12:13 -0700)]
Move trans_field_ptr and struct_field_ptr to mir/lvalue

7 years agoMove trans_const to mir::constant
Mark Simulacrum [Mon, 2 Jan 2017 18:00:42 +0000 (11:00 -0700)]
Move trans_const to mir::constant

7 years agoChange trans_field_ptr to utilize LvalueTy to determine discriminant.
Mark Simulacrum [Mon, 2 Jan 2017 16:06:01 +0000 (09:06 -0700)]
Change trans_field_ptr to utilize LvalueTy to determine discriminant.

7 years agoUse LvalueRef instead of MaybeSizedValue
Mark Simulacrum [Sun, 1 Jan 2017 22:50:15 +0000 (15:50 -0700)]
Use LvalueRef instead of MaybeSizedValue

7 years agoSimpliy block creation in MirContext
Mark Simulacrum [Sun, 1 Jan 2017 18:13:50 +0000 (11:13 -0700)]
Simpliy block creation in MirContext

7 years agoAdd Builder::sess and Builder::tcx methods
Mark Simulacrum [Sun, 1 Jan 2017 15:46:34 +0000 (08:46 -0700)]
Add Builder::sess and Builder::tcx methods

7 years agoAdd method, new_block, to MirContext for block construction.
Mark Simulacrum [Sun, 1 Jan 2017 08:29:23 +0000 (01:29 -0700)]
Add method, new_block, to MirContext for block construction.

This makes a slow transition to block construction happening only from
MirContext easier.

7 years agoPurge FunctionContext
Mark Simulacrum [Sun, 1 Jan 2017 07:42:09 +0000 (00:42 -0700)]
Purge FunctionContext

7 years agoReplace BlockAndBuilder with Builder.
Mark Simulacrum [Sat, 31 Dec 2016 23:00:24 +0000 (16:00 -0700)]
Replace BlockAndBuilder with Builder.