]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoAuto merge of #41786 - acdenisSK:an_to_a, r=frewsxcv
bors [Sat, 6 May 2017 19:45:10 +0000 (19:45 +0000)]
Auto merge of #41786 - acdenisSK:an_to_a, r=frewsxcv

Fix "an" usage

Since the pr i reviewed on got merged way before the author had a chance to quickly change it, i just did it myself. (Or well, someone else asked me to, if you want me to be honest)

7 years agoAuto merge of #41788 - TimNN:trigger-llvm, r=Mark-Simulacrum
bors [Sat, 6 May 2017 17:18:11 +0000 (17:18 +0000)]
Auto merge of #41788 - TimNN:trigger-llvm, r=Mark-Simulacrum

Trigger llvm rebuild

This was missing from #41739, thanks @tedhorst for noticing!

7 years agoUpdate the .stderr file for the "an" changes
acdenisSK [Sat, 6 May 2017 16:49:01 +0000 (18:49 +0200)]
Update the .stderr file for the "an" changes

7 years agotrigger llvm rebuild
Tim Neumann [Sat, 6 May 2017 15:39:03 +0000 (17:39 +0200)]
trigger llvm rebuild

7 years agoFix "an" usage
acdenisSK [Sat, 6 May 2017 14:06:38 +0000 (16:06 +0200)]
Fix "an" usage

7 years agoAuto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv
bors [Sat, 6 May 2017 02:01:00 +0000 (02:01 +0000)]
Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv

Add an example to std::thread::Result type

This PR is a part of https://github.com/rust-lang/rust/issues/29378. I submit this PR with the help (mentoring) of @steveklabnik. I'm still not sure my request is good enough but I don't want to spoil the issue with too much questions so I continue here. r? @steveklabnik

7 years agoAuto merge of #41773 - frewsxcv:rollup, r=frewsxcv
bors [Fri, 5 May 2017 23:20:32 +0000 (23:20 +0000)]
Auto merge of #41773 - frewsxcv:rollup, r=frewsxcv

Rollup of 9 pull requests

- Successful merges: #41064, #41307, #41512, #41582, #41678, #41722, #41734, #41761, #41763
- Failed merges:

7 years agoRollup merge of #41763 - frewsxcv:unicode-py, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:30 +0000 (17:35 -0400)]
Rollup merge of #41763 - frewsxcv:unicode-py, r=alexcrichton

Move unicode Python script into libstd_unicode crate.

The only place this Python script is used is inside the libstd_unicode
crate, so lets move it there.

7 years agoRollup merge of #41761 - euclio:24106-test, r=estebank
Corey Farwell [Fri, 5 May 2017 21:35:29 +0000 (17:35 -0400)]
Rollup merge of #41761 - euclio:24106-test, r=estebank

Add regression test for issue #24106

Fixes #24106.

7 years agoRollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix
Corey Farwell [Fri, 5 May 2017 21:35:29 +0000 (17:35 -0400)]
Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix

Refactor variance and remove last `[pub]` map

This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this:

- We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate
- We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change)
- When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation`
    - this lets us gin up the correct dependencies when requesting variance of a single item

Ah damn, just remembered, one TODO:

- [x] Update the variance README -- ah, I guess the README updates I did are sufficient

r? @michaelwoerister

7 years agoRollup merge of #41722 - F001:warnTilde, r=petrochenkov
Corey Farwell [Fri, 5 May 2017 21:35:28 +0000 (17:35 -0400)]
Rollup merge of #41722 - F001:warnTilde, r=petrochenkov

Suggest `!` for bitwise negation when encountering a `~`

Fix #41679

Here is a program

```rust
fn main() {
    let x = ~1;
}
```

It's output:
```
error: `~` can not be used as an unary operator
 --> /home/fcc/temp/test.rs:4:13
  |
4 |     let x = ~1;
  |             ^^
  |
  = help: use `!` instead of `~` if you meant to bitwise negation
```

cc @bstrie

7 years agoRollup merge of #41678 - GuillaumeGomez:rustdoc-test-warnings, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:27 +0000 (17:35 -0400)]
Rollup merge of #41678 - GuillaumeGomez:rustdoc-test-warnings, r=alexcrichton

Add option to display warnings in rustdoc

Part of #41574.

r? @alexcrichton

The output for this file:

```rust
/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// panic!();
/// ```
fn foo() {}

/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// ```
fn foo2() {}

/// ```
/// fn foo(x: u32) {}
///
/// foo(2);
/// let x = 1;
/// panic!();
/// ```
fn foo3() {}

fn main() {
}
```

is the following:

```
> ./build/x86_64-apple-darwin/stage1/bin/rustdoc -Z unstable-options --display-warnings --test test.rs

running 3 tests
test test.rs - foo (line 1) ... FAILED
test test.rs - foo3 (line 18) ... FAILED
test test.rs - foo2 (line 10) ... ok

successes:

---- test.rs - foo2 (line 10) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

successes:
    test.rs - foo2 (line 10)

failures:

---- test.rs - foo (line 1) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

thread 'rustc' panicked at 'test executable failed:

thread 'main' panicked at 'explicit panic', <anon>:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', src/librustdoc/test.rs:317
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- test.rs - foo3 (line 18) stdout ----
warning: unused variable: `x`
 --> <anon>:2:8
  |
2 | fn foo(x: u32) {}
  |        ^
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `x`
 --> <anon>:5:5
  |
5 | let x = 1;
  |     ^
  |
  = note: #[warn(unused_variables)] on by default

thread 'rustc' panicked at 'test executable failed:

thread 'main' panicked at 'explicit panic', <anon>:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', src/librustdoc/test.rs:317

failures:
    test.rs - foo (line 1)
    test.rs - foo3 (line 18)

test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured
```

7 years agoRollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:26 +0000 (17:35 -0400)]
Rollup merge of #41582 - jonhoo:reread-nameservers-on-lookup-fail, r=alexcrichton

Reload nameserver information on lookup failure

As discussed in #41570, UNIX systems often cache the contents of `/etc/resolv.conf`, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd.

Fixes #41570.
Depends on rust-lang/libc#585.

r? @alexcrichton

7 years agoRollup merge of #41512 - alexcrichton:fix-windows-tls-deadlock, r=BurntSushi
Corey Farwell [Fri, 5 May 2017 21:35:25 +0000 (17:35 -0400)]
Rollup merge of #41512 - alexcrichton:fix-windows-tls-deadlock, r=BurntSushi

std: Avoid locks during TLS destruction on Windows

Gecko recently had a bug reported [1] with a deadlock in the Rust TLS
implementation for Windows. TLS destructors are implemented in a sort of ad-hoc
fashion on Windows as it doesn't natively support destructors for TLS keys. To
work around this the runtime manages a list of TLS destructors and registers a
hook to get run whenever a thread exits. When a thread exits it takes a look at
the list and runs all destructors.

Unfortunately it turns out that there's a lock which is held when our "at thread
exit" callback is run. The callback then attempts to acquire a lock protecting
the list of TLS destructors. Elsewhere in the codebase while we hold a lock over
the TLS destructors we try to acquire the same lock held first before our
special callback is run. And as a result, deadlock!

This commit sidesteps the issue with a few small refactorings:

* Removed support for destroying a TLS key on Windows. We don't actually ever
  exercise this as a public-facing API, and it's only used during `lazy_init`
  during racy situations. To handle that we just synchronize `lazy_init`
  globally on Windows so we never have to call `destroy`.

* With no need to support removal the global synchronized `Vec` was tranformed
  to a lock-free linked list. With the removal of locks this means that
  iteration no long requires a lock and as such we won't run into the deadlock
  problem mentioned above.

Note that it's still a general problem that you have to be extra super careful
in TLS destructors. For example no code which runs a TLS destructor on Windows
can call back into the Windows API to do a dynamic library lookup. Unfortunately
I don't know of a great way around that, but this at least fixes the immediate
problem that Gecko was seeing which is that with "well behaved" destructors the
system would still deadlock!

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151

7 years agoRollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcv
Corey Farwell [Fri, 5 May 2017 21:35:24 +0000 (17:35 -0400)]
Rollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcv

Remove jquery dependency

r? @rust-lang/docs

Fixes #39159.

7 years agoRollup merge of #41064 - Gankro:ptr-redux, r=alexcrichton
Corey Farwell [Fri, 5 May 2017 21:35:24 +0000 (17:35 -0400)]
Rollup merge of #41064 - Gankro:ptr-redux, r=alexcrichton

refactor NonZero, Shared, and Unique APIs

Major difference is that I removed Deref impls, as apparently LLVM has
trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited
as a blocker for ever stabilizing this API. It wasn't that ergonomic
anyway.

* Added `get` to NonZero to replace Deref impl
* Added `ptr` getter to Shared/Unique to replace Deref impl
* Added Unique's `get` and `get_mut` conveniences to Shared
* Deprecated `as_mut_ptr` on Shared in favour of `ptr`

Note that Shared used to primarily expose only `*const` but there isn't
a good justification for that, so I made it `*mut`.

7 years agoAuto merge of #41769 - alexcrichton:fix-doc-test, r=aturon
bors [Fri, 5 May 2017 20:44:15 +0000 (20:44 +0000)]
Auto merge of #41769 - alexcrichton:fix-doc-test, r=aturon

std: Prevent deadlocks in doctests on Windows

Windows historically has problems with threads panicking and the main thread
exiting at the same time, typically causing deadlocks. In the past (#25824)
we've joined on threads but this just prevents running the test for now to avoid
tampering with the example.

7 years agochange various uses of `item_variances` to `variances_of`
Niko Matsakis [Fri, 5 May 2017 18:34:42 +0000 (14:34 -0400)]
change various uses of `item_variances` to `variances_of`

7 years agostd: Prevent deadlocks in doctests on Windows
Alex Crichton [Fri, 5 May 2017 14:02:48 +0000 (07:02 -0700)]
std: Prevent deadlocks in doctests on Windows

Windows historically has problems with threads panicking and the main thread
exiting at the same time, typically causing deadlocks. In the past (#25824)
we've joined on threads but this just prevents running the test for now to avoid
tampering with the example.

7 years agoAuto merge of #41765 - brson:installer, r=alexcrichton
bors [Fri, 5 May 2017 17:48:50 +0000 (17:48 +0000)]
Auto merge of #41765 - brson:installer, r=alexcrichton

Update rust-installer to fix rust-lang-nursery/rustup.rs#1092

r? @TimNN

cc @alexcrichton @ranma42

7 years agostd: Avoid locks during TLS destruction on Windows
Alex Crichton [Mon, 24 Apr 2017 18:34:16 +0000 (11:34 -0700)]
std: Avoid locks during TLS destruction on Windows

Gecko recently had a bug reported [1] with a deadlock in the Rust TLS
implementation for Windows. TLS destructors are implemented in a sort of ad-hoc
fashion on Windows as it doesn't natively support destructors for TLS keys. To
work around this the runtime manages a list of TLS destructors and registers a
hook to get run whenever a thread exits. When a thread exits it takes a look at
the list and runs all destructors.

Unfortunately it turns out that there's a lock which is held when our "at thread
exit" callback is run. The callback then attempts to acquire a lock protecting
the list of TLS destructors. Elsewhere in the codebase while we hold a lock over
the TLS destructors we try to acquire the same lock held first before our
special callback is run. And as a result, deadlock!

This commit sidesteps the issue with a few small refactorings:

* Removed support for destroying a TLS key on Windows. We don't actually ever
  exercise this as a public-facing API, and it's only used during `lazy_init`
  during racy situations. To handle that we just synchronize `lazy_init`
  globally on Windows so we never have to call `destroy`.

* With no need to support removal the global synchronized `Vec` was tranformed
  to a lock-free linked list. With the removal of locks this means that
  iteration no long requires a lock and as such we won't run into the deadlock
  problem mentioned above.

Note that it's still a general problem that you have to be extra super careful
in TLS destructors. For example no code which runs a TLS destructor on Windows
can call back into the Windows API to do a dynamic library lookup. Unfortunately
I don't know of a great way around that, but this at least fixes the immediate
problem that Gecko was seeing which is that with "well behaved" destructors the
system would still deadlock!

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151

7 years agoUpdate mod.rs
Raphaël Huchet [Fri, 5 May 2017 10:07:14 +0000 (12:07 +0200)]
Update mod.rs

7 years agoAdd an example to std::thread::Result type
Raphaël Huchet [Fri, 5 May 2017 10:02:02 +0000 (12:02 +0200)]
Add an example to std::thread::Result type

7 years agoSuggest `!` for bitwise negation when encountering a `~`
F001 [Wed, 3 May 2017 06:31:47 +0000 (23:31 -0700)]
Suggest `!` for bitwise negation when encountering a `~`

7 years agoAdd Options type in libtest and remove argument
Guillaume Gomez [Thu, 4 May 2017 21:53:48 +0000 (23:53 +0200)]
Add Options type in libtest and remove argument

7 years agoUpdate rust-installer to fix rust-lang-nursery/rustup.rs#1092
Brian Anderson [Fri, 5 May 2017 07:03:30 +0000 (00:03 -0700)]
Update rust-installer to fix rust-lang-nursery/rustup.rs#1092

7 years agoReload nameserver information on lookup failure
Jon Gjengset [Thu, 27 Apr 2017 16:58:52 +0000 (12:58 -0400)]
Reload nameserver information on lookup failure

As discussed in #41570, UNIX systems often cache the contents of
/etc/resolv.conf, which can cause lookup failures to persist even after
a network connection becomes available. This patch modifies lookup_host
to force a reload of the nameserver entries following a lookup failure.
This is in line with what many C programs already do (see #41570 for
details). On systems with nscd, this should not be necessary, but not
all systems run nscd.

Introduces an std linkage dependency on libresolv on macOS/iOS (which
also makes it necessary to update run-make/tools.mk).

Fixes #41570.
Depends on rust-lang/libc#585.

7 years agoAuto merge of #41762 - frewsxcv:rollup, r=frewsxcv
bors [Fri, 5 May 2017 03:56:34 +0000 (03:56 +0000)]
Auto merge of #41762 - frewsxcv:rollup, r=frewsxcv

Rollup of 4 pull requests

- Successful merges: #41741, #41746, #41749, #41754
- Failed merges:

7 years agoupdate to latest nomicon
Alexis Beingessner [Thu, 4 May 2017 22:02:33 +0000 (18:02 -0400)]
update to latest nomicon

7 years agoDeprecate heap::EMPTY in favour of Unique::empty or otherwise.
Alexis Beingessner [Thu, 4 May 2017 18:48:58 +0000 (14:48 -0400)]
Deprecate heap::EMPTY in favour of Unique::empty or otherwise.

7 years agofallout from NonZero/Unique/Shared changes
Alexis Beingessner [Tue, 4 Apr 2017 16:31:38 +0000 (12:31 -0400)]
fallout from NonZero/Unique/Shared changes

7 years agoMove unicode Python script into libstd_unicode crate.
Corey Farwell [Fri, 5 May 2017 02:36:48 +0000 (22:36 -0400)]
Move unicode Python script into libstd_unicode crate.

The only place this Python script is used is inside the libstd_unicode
crate, so lets move it there.

7 years agoRollup merge of #41754 - nikomatsakis:incr-comp-cleanup-cell, r=arielb1
Corey Farwell [Fri, 5 May 2017 01:35:31 +0000 (21:35 -0400)]
Rollup merge of #41754 - nikomatsakis:incr-comp-cleanup-cell, r=arielb1

kill some unused fields in TyCtxt

7 years agoRollup merge of #41749 - frewsxcv:option-simplify-types, r=GuillaumeGomez
Corey Farwell [Fri, 5 May 2017 01:35:30 +0000 (21:35 -0400)]
Rollup merge of #41749 - frewsxcv:option-simplify-types, r=GuillaumeGomez

Simplify types in `std::option` doc comment example.

None

7 years agoRollup merge of #41746 - tommyip:master, r=petrochenkov
Corey Farwell [Fri, 5 May 2017 01:35:29 +0000 (21:35 -0400)]
Rollup merge of #41746 - tommyip:master, r=petrochenkov

Remove use of `Self: Sized` from libsyntax

The bound is not required for compiling but it prevents using `next_token()` from a trait object.

Fixes #33506.

7 years agoRollup merge of #41741 - rap2hpoutre:patch-3, r=steveklabnik
Corey Farwell [Fri, 5 May 2017 01:35:28 +0000 (21:35 -0400)]
Rollup merge of #41741 - rap2hpoutre:patch-3, r=steveklabnik

join method returns a thread::Result

Join method returns a std::thread::Result, not a std::result::Result: https://doc.rust-lang.org/std/thread/struct.JoinHandle.html#method.join Maybe I misunderstood something.

I have seen this mistake(?) because I wanted to tackle this issue https://github.com/rust-lang/rust/issues/29378 (about Result). It's still one of my first PR. Sorry if I missed something.

7 years agoAuto merge of #41751 - alexcrichton:unstable-flags, r=eddyb
bors [Fri, 5 May 2017 01:00:13 +0000 (01:00 +0000)]
Auto merge of #41751 - alexcrichton:unstable-flags, r=eddyb

rustc: Forbid `-Z` flags on stable/beta channels

First deprecated in rustc 1.8.0 the intention was to never allow `-Z` flags make
their way to the stable channel (or unstable options). After a year of warnings
we've seen one of the main use cases, `-Z no-trans`, stabilized as `cargo
check`. Otherwise while other use cases remain the sentiment is that now's the
time to start forbidding `-Z` by default on stable/beta.

Closes #31847

7 years agoadd regression test for issue #24106
Andy Russell [Thu, 4 May 2017 20:13:52 +0000 (16:13 -0400)]
add regression test for issue #24106

Fixes #24106.

7 years agorefactor NonZero, Shared, and Unique APIs
Alexis Beingessner [Tue, 4 Apr 2017 16:31:03 +0000 (12:31 -0400)]
refactor NonZero, Shared, and Unique APIs

Major difference is that I removed Deref impls, as apparently LLVM has
trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited
as a blocker for ever stabilizing this API. It wasn't that ergonomic
anyway.

* Added `get` to NonZero to replace Deref impl
* Added `as_ptr` to Shared/Unique to replace Deref impl
* Added Unique's `as_ref` and `as_mut` conveniences to Shared
* Added `::empty()` convenience constructor for Unique/Shared
* Deprecated `as_mut_ptr` on Shared in favour of `as_ptr`
* Improved documentation of types

Note that Shared now only refers to *mut, and not *const

7 years agoAuto merge of #41739 - TimNN:update-llvm, r=aturon
bors [Thu, 4 May 2017 18:46:17 +0000 (18:46 +0000)]
Auto merge of #41739 - TimNN:update-llvm, r=aturon

Update llvm to pull in various backports

Fixes #41672
Fixes #41630
Fixes #41685

7 years agorustc: Forbid `-Z` flags on stable/beta channels
Alex Crichton [Thu, 4 May 2017 16:34:44 +0000 (09:34 -0700)]
rustc: Forbid `-Z` flags on stable/beta channels

First deprecated in rustc 1.8.0 the intention was to never allow `-Z` flags make
their way to the stable channel (or unstable options). After a year of warnings
we've seen one of the main use cases, `-Z no-trans`, stabilized as `cargo
check`. Otherwise while other use cases remain the sentiment is that now's the
time to start forbidding `-Z` by default on stable/beta.

Closes #31847

7 years agokill some unused fields in TyCtxt
Niko Matsakis [Thu, 4 May 2017 17:14:24 +0000 (13:14 -0400)]
kill some unused fields in TyCtxt

7 years agoSimplify types in `std::option` doc comment example.
Corey Farwell [Thu, 4 May 2017 15:53:24 +0000 (11:53 -0400)]
Simplify types in `std::option` doc comment example.

7 years agoAuto merge of #41268 - mmatyas:test_on_device, r=alexcrichton
bors [Thu, 4 May 2017 14:50:33 +0000 (14:50 +0000)]
Auto merge of #41268 - mmatyas:test_on_device, r=alexcrichton

Run non-native tests on real device

After #40733, I've made some hacks to the QEMU client-server tools to allow running the tests on a real device when cross compiling Rust. The address and port of the remote server can be set using an environment variable.

I've made this mainly for local testing purposes, if you're interested in merging this, I'd clean it a bit more (eg. renaming the functions from `qemu-` to something else). I'm not asking for CI integration or adding ARM boards to the build system; it's just that I used these modifications and I was wondering if you'd find them useful too.

7 years agoRemove use of `Self: Sized` from libsyntax
Tommy Ip [Thu, 4 May 2017 12:14:39 +0000 (13:14 +0100)]
Remove use of `Self: Sized` from libsyntax

The bound is not required for compiling but it prevents using `next_token()` from a trait object.

Fixes #33506.

7 years agoUpdate mod.rs
Raphaël Huchet [Thu, 4 May 2017 12:04:03 +0000 (14:04 +0200)]
Update mod.rs

7 years agoAuto merge of #41687 - rillian:no-elf-tls, r=aturon
bors [Thu, 4 May 2017 11:51:34 +0000 (11:51 +0000)]
Auto merge of #41687 - rillian:no-elf-tls, r=aturon

Remove obsolete --disable-elf-tls configure switch.

Support for disabling ELF-style thread local storage in
the standard library at configure time was removed in
pulls #30417 and #30678, in favour of a member in
the TargetOptions database. The new mentod respects
MACOSX_DEPLOYMENT_TARGET on macOS, addressing the
original use case for this configure optionl

However, those commits left the configure option itself
in place. It's no longer referenced anywhere and can
be removed.

7 years agoAdd remote device testing support
Mátyás Mustoha [Tue, 11 Apr 2017 10:10:05 +0000 (12:10 +0200)]
Add remote device testing support

7 years agocreate link to Result
Raphaël Huchet [Thu, 4 May 2017 09:33:26 +0000 (11:33 +0200)]
create link to Result

7 years agoAuto merge of #41733 - nikomatsakis:incr-comp-remove-ast-ty-to-ty-cache, r=eddyb
bors [Thu, 4 May 2017 09:15:23 +0000 (09:15 +0000)]
Auto merge of #41733 - nikomatsakis:incr-comp-remove-ast-ty-to-ty-cache, r=eddyb

Remove ast-ty-to-ty cache

As discussed on IRC, this basically just removes the cache, and rewrites rustdoc and save-analysis so call into the astconv code. It *might* make sense for this to be a more fine-grained query, but that would (at least) require us to be using `HirId` and not `NodeId`.

(Perhaps I should open a FIXME?)

I didn't measure perf impact (yet?). I did observe that the cache seems to hit *rarely* -- and only in between items (I experimented with a cache "per def-id", but that had zero hits). In other words, every single hit on the cache is a dependency bug, since it is "shuttling" information between items without dependency edges.

r? @eddyb

7 years agoJoin method returns a thread::Result
Raphaël Huchet [Thu, 4 May 2017 09:11:14 +0000 (11:11 +0200)]
Join method returns a thread::Result

7 years agoUpdate llvm to pull in various backports
Tim Neumann [Thu, 4 May 2017 06:12:17 +0000 (08:12 +0200)]
Update llvm to pull in various backports

7 years agoremove `ast_ty_to_ty_cache` entirely
Niko Matsakis [Wed, 3 May 2017 17:23:41 +0000 (13:23 -0400)]
remove `ast_ty_to_ty_cache` entirely

7 years agoconvert save-analysis to use `ItemCtxt` and not `ast_ty_to_ty_cache`
Niko Matsakis [Wed, 3 May 2017 16:18:04 +0000 (12:18 -0400)]
convert save-analysis to use `ItemCtxt` and not `ast_ty_to_ty_cache`

7 years agoremove use of `ast_ty_to_ty_cache` from librustdoc
Niko Matsakis [Wed, 3 May 2017 15:53:06 +0000 (11:53 -0400)]
remove use of `ast_ty_to_ty_cache` from librustdoc

7 years agoexpose a method for converting `hir::Ty` to `Ty<'tcx>`
Niko Matsakis [Wed, 3 May 2017 15:28:22 +0000 (11:28 -0400)]
expose a method for converting `hir::Ty` to `Ty<'tcx>`

Also, remove a lot of `pub` things from `librustc_typeck`.

7 years agoAuto merge of #41735 - frewsxcv:rollup, r=frewsxcv
bors [Wed, 3 May 2017 23:05:07 +0000 (23:05 +0000)]
Auto merge of #41735 - frewsxcv:rollup, r=frewsxcv

Rollup of 6 pull requests

- Successful merges: #41543, #41600, #41715, #41720, #41721, #41730
- Failed merges:

7 years agoRollup merge of #41730 - bholley:arc_comment, r=aturon
Corey Farwell [Wed, 3 May 2017 22:34:04 +0000 (18:34 -0400)]
Rollup merge of #41730 - bholley:arc_comment, r=aturon

Document the reasoning for the Acquire/Release handshake when dropping Arcs.

Split out from #41714. r? @aturon

7 years agoRollup merge of #41721 - mgattozzi:stdin-stdout-update, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:34:03 +0000 (18:34 -0400)]
Rollup merge of #41721 - mgattozzi:stdin-stdout-update, r=steveklabnik

Update ChildStdin/ChildStdout docs to be clearer

This is part of https://github.com/rust-lang/rust/issues/29370 and continues the work from https://github.com/rust-lang/rust/pull/40829

7 years agoRollup merge of #41720 - frewsxcv:duration-doc-examples, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:34:02 +0000 (18:34 -0400)]
Rollup merge of #41720 - frewsxcv:duration-doc-examples, r=steveklabnik

Improvements to `std::time::Duration` doc examples.

Opened primarily for the last commit, in response to comments in https://github.com/rust-lang/rust/issues/39949.

7 years agoRollup merge of #41715 - martinhath:master, r=aturon
Corey Farwell [Wed, 3 May 2017 22:34:01 +0000 (18:34 -0400)]
Rollup merge of #41715 - martinhath:master, r=aturon

Fix @martinhath's mailmap entry

I stumbled upon a name duplication issue in [rust-lang-nursery/thanks](https://github.com/rust-lang-nursery/thanks/), and realized that this problem is easily fixable. I've (hopefully) done the right thing here. It works locally (`git shortlog | grep "Thoresen"` only returns one entry instead of two).

I didn't bother creating an issue in the `thanks` repository, since I did the `.mailmap` editing myself.

7 years agoRollup merge of #41600 - ranma42:xz-dist, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 22:34:00 +0000 (18:34 -0400)]
Rollup merge of #41600 - ranma42:xz-dist, r=alexcrichton

Generate XZ-compressed tarballs

Integrate the new `rust-installer` and extend manifests with keys for xz-compressed tarballs.

One of the steps required for https://github.com/rust-lang/rust/issues/21724

7 years agoRollup merge of #41543 - z1mvader:master, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 22:33:59 +0000 (18:33 -0400)]
Rollup merge of #41543 - z1mvader:master, r=steveklabnik

Rewrote the thread struct docs

https://github.com/rust-lang/rust/issues/29378

7 years agoremove `pub` modifier (and last use thereof)
Niko Matsakis [Wed, 3 May 2017 20:42:46 +0000 (16:42 -0400)]
remove `pub` modifier (and last use thereof)

7 years agocorrect the new graphs resulting from various tests
Niko Matsakis [Tue, 2 May 2017 21:47:38 +0000 (17:47 -0400)]
correct the new graphs resulting from various tests

(Now that variances are not part of signature.)

7 years agoallow dep-graph assertions on fields
Niko Matsakis [Tue, 25 Apr 2017 13:08:21 +0000 (09:08 -0400)]
allow dep-graph assertions on fields

7 years agoallow tests to refer to `ItemVariances`
Niko Matsakis [Tue, 25 Apr 2017 09:46:29 +0000 (05:46 -0400)]
allow tests to refer to `ItemVariances`

7 years agoadd back variance testing mechanism
Niko Matsakis [Tue, 25 Apr 2017 09:45:59 +0000 (05:45 -0400)]
add back variance testing mechanism

make it work for traits etc uniformly

7 years agokill the old `visit_all_item_likes` infrastructure
Niko Matsakis [Tue, 2 May 2017 15:22:03 +0000 (11:22 -0400)]
kill the old `visit_all_item_likes` infrastructure

7 years agofactor variances into a proper query
Niko Matsakis [Mon, 24 Apr 2017 15:15:12 +0000 (11:15 -0400)]
factor variances into a proper query

There are now two queries: crate and item. The crate one computes the
variance of all items in the crate; it is sort of an implementation
detail, and not meant to be used. The item one reads from the crate one,
synthesizing correct deps in lieu of the red-green algorithm.

At the same time, remove the `variance_computed` flag, which was a
horrible hack used to force invariance early on (e.g. when type-checking
constants). This is only needed because of trait applications, and
traits are always invariant anyway. Therefore, we now change to take
advantage of the query system:

- When asked to compute variances for a trait, just return a vector
  saying 'all invariant'.
- Remove the corresponding "inferreds" from traits, and tweak the
  constraint generation code to understand that traits are always
  inferred.

7 years agoRetry `brew` commands upon failure
Andrea Canciani [Wed, 3 May 2017 20:38:41 +0000 (22:38 +0200)]
Retry `brew` commands upon failure

Wrap the installation on macOS with `travis_retry`.

7 years agoAuto merge of #41728 - sirideain:inference-failure-for-loops-test, r=alexcrichton
bors [Wed, 3 May 2017 19:58:35 +0000 (19:58 +0000)]
Auto merge of #41728 - sirideain:inference-failure-for-loops-test, r=alexcrichton

Add test for an inference failure.

Fixes #22066

7 years agotrack `CurrentItem`, not just `Generics`
Niko Matsakis [Sun, 23 Apr 2017 09:44:02 +0000 (05:44 -0400)]
track `CurrentItem`, not just `Generics`

7 years agomake transitive relation use a hash map
Niko Matsakis [Sun, 23 Apr 2017 09:14:10 +0000 (05:14 -0400)]
make transitive relation use a hash map

7 years agoDocument the reasoning for the Acquire/Release handshake when dropping Arcs.
Bobby Holley [Tue, 2 May 2017 19:38:12 +0000 (12:38 -0700)]
Document the reasoning for the Acquire/Release handshake when dropping Arcs.

7 years agoAdd test for an inference failure.
Charlie Sheridan [Wed, 3 May 2017 17:07:30 +0000 (13:07 -0400)]
Add test for an inference failure.

7 years agoAuto merge of #41711 - sirideain:add-static-methods-test, r=aturon
bors [Wed, 3 May 2017 08:26:49 +0000 (08:26 +0000)]
Auto merge of #41711 - sirideain:add-static-methods-test, r=aturon

Add test for Inherent static methods

Fixes #28848

7 years agoFix MacOSX build
Andrea Canciani [Mon, 1 May 2017 23:42:30 +0000 (01:42 +0200)]
Fix MacOSX build

MacOSX does not ship `7z` nor `xz`. Let's use `xz`, just like on the
other *nix systems.

7 years agoEmit information about XZ packages in manifest
Andrea Canciani [Tue, 25 Apr 2017 14:14:28 +0000 (16:14 +0200)]
Emit information about XZ packages in manifest

7 years agoAuto merge of #41713 - cuviper:cmake-sanitizers, r=alexcrichton
bors [Wed, 3 May 2017 06:04:12 +0000 (06:04 +0000)]
Auto merge of #41713 - cuviper:cmake-sanitizers, r=alexcrichton

rustbuild: Sanity-check cmake for sanitizers too

It's possible to build the sanitizers when using an external LLVM, but
we still need cmake for this.  Extend the sanity check to look for cmake
whenever sanitizers are enabled too.

7 years agoUpdate ChildStdin/ChildStdout docs to be clearer
Michael Gattozzi [Wed, 3 May 2017 05:13:18 +0000 (01:13 -0400)]
Update ChildStdin/ChildStdout docs to be clearer

7 years agoAdd doc example for how to determine total number of secs in Duration.
Corey Farwell [Wed, 3 May 2017 04:04:59 +0000 (00:04 -0400)]
Add doc example for how to determine total number of secs in Duration.

7 years agoUpdate Duration::as_secs doc example to demonstrate truncation.
Corey Farwell [Wed, 3 May 2017 03:58:39 +0000 (23:58 -0400)]
Update Duration::as_secs doc example to demonstrate truncation.

7 years agoUpdate Duration::from_millis doc example to show underlying values.
Corey Farwell [Wed, 3 May 2017 03:56:29 +0000 (23:56 -0400)]
Update Duration::from_millis doc example to show underlying values.

7 years agoUpdate Duration::from_secs doc example to show underlying values.
Corey Farwell [Wed, 3 May 2017 03:55:40 +0000 (23:55 -0400)]
Update Duration::from_secs doc example to show underlying values.

7 years agoAuto merge of #41717 - frewsxcv:rollup, r=frewsxcv
bors [Wed, 3 May 2017 03:24:35 +0000 (03:24 +0000)]
Auto merge of #41717 - frewsxcv:rollup, r=frewsxcv

Rollup of 7 pull requests

- Successful merges: #41217, #41625, #41640, #41653, #41656, #41657, #41705
- Failed merges:

7 years agoRollup merge of #41705 - Mark-Simulacrum:remove-grammar, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:22 +0000 (21:21 -0400)]
Rollup merge of #41705 - Mark-Simulacrum:remove-grammar, r=nikomatsakis

Remove ANTLR grammar

I *think* that nothing in-tree references this, but I may be wrong. If anyone thinks of anything, please let me know and I'll work on removing.

Fixes #15677.

7 years agoRollup merge of #41657 - malbarbo:android-armv7-linker, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 01:21:22 +0000 (21:21 -0400)]
Rollup merge of #41657 - malbarbo:android-armv7-linker, r=alexcrichton

Add -march=armv7-a parameter to armv7 android linker

Without this option, the linker fails to link any library that uses `std::future`. The error points some undefined references, like `std::__future_base::_Result_base`.

For example, it fails to link rustc because llvm 4.0 uses `std::future`.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735

7 years agoRollup merge of #41656 - malbarbo:android-armeabi, r=alexcrichton
Corey Farwell [Wed, 3 May 2017 01:21:21 +0000 (21:21 -0400)]
Rollup merge of #41656 - malbarbo:android-armeabi, r=alexcrichton

Change arm-linux-androideabi to correspond to the armeabi official ABI

Fixes #40941.

7 years agoRollup merge of #41653 - achernyak:master, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:20 +0000 (21:21 -0400)]
Rollup merge of #41653 - achernyak:master, r=nikomatsakis

Queries for Crate Metadata

This resolves following parts of #41417:
* `fn stability(&self, def: DefId) -> Option<attr::Stability>;`
* `fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;`

r? @nikomatsakis

7 years agoRollup merge of #41640 - gaurikholkar:master, r=nikomatsakis
Corey Farwell [Wed, 3 May 2017 01:21:19 +0000 (21:21 -0400)]
Rollup merge of #41640 - gaurikholkar:master, r=nikomatsakis

Consider changing to & for let bindings #40402

This is a fix for #40402

For the example
```
fn main() {
    let v = vec![String::from("oh no")];

    let e = v[0];
}
```

It gives
```
error[E0507]: cannot move out of indexed content
 --> ex1.rs:4:13
  |
4 |     let e = v[0];
  |             ^^^^ cannot move out of indexed content
  |
  = help: consider changing to `&v[0]`

error: aborting due to previous error
```

Another alternative is
```
error[E0507]: cannot move out of indexed content
 --> ex1.rs:4:13
  |
4 |     let e = v[0];
  |             ^^^^ consider changing to `&v[0]`

error: aborting due to previous error
```
Also refer to #41564 for more details.

r? @nikomatsakis

7 years agoRollup merge of #41625 - nikomatsakis:incr-comp-dep-tracking-cell-mir, r=eddyb
Corey Farwell [Wed, 3 May 2017 01:21:18 +0000 (21:21 -0400)]
Rollup merge of #41625 - nikomatsakis:incr-comp-dep-tracking-cell-mir, r=eddyb

rework the queries for the MIR pipeline

This PR refashions the MIR pipeline. There are a number of changes:

* We no longer have "MIR passes" and the pass manager is completely reworked. Unless we are doing the interprocedural optimization (meaning, right now, the inline pass), we will process a single MIR from beginning to finish in a completely on-demand fashion; i.e., when you request `optimized_mir(D)`, that will trigger the MIR for `D` to actually be built and optimized, but no other functions are built or touched.
* We no longer use `&'tcx RefCell<Mir<'tcx>>` as the result of queries, since that spoils the view of queries as "pure functions". To avoid however copying the MIR, we use a `&'tcx Steal<Mir<'tcx>>` -- this is something like a ref-cell, in that you can use `borrow()` to read it, but it has no `borrow_mut()`. Instead, it has `steal()`, which will take the contents and then panic if any further read attempt occurs.
* We now support `[multi]` queries, which can optionally yield not just one result but a sequence of (K, V) pairs. This is used for the inlining pass. If inlining is enabled, then when it is invoked on **any** def-id D, it will go and read the results for **all** def-ids and transform them, and then return the results for all of them at once. This isn't ideal, and we'll probably want to rework this further, but it seems ok for now (note that MIR inlining is not enabled by default).

**Tips for the reviewer:** The commits here are meant to build individually, but the path is a *bit* meandering. In some cases, for example, I introduce a trait in one commit, and then tweak it in a later commit as I actually try to put it to use. You may want to read the README in the final commit to get a sense of where the overall design is headed.

@eddyb I did not wind up adding support for queries that produce more than one *kind* of result. Instead, I decided to just insert judicious use of the `force()` command. In other words, we had talked about e.g. having a query that produced not only the MIR but also the `const_qualif` result for the MIR in one sweep. I realized you can also have the same effect by having a kind of meta-query that forces the const-qualif pass and then reads the result. See the README for a description. (We can still do these "multi-query results" later if we want, I'm not sure though if it is necessary.)

r? @eddyb

cc @michaelwoerister @matthewhammer @arielb1, who participated in the IRC discussion.

7 years agoRollup merge of #41217 - topecongiro:docs/atomic-fence, r=steveklabnik
Corey Farwell [Wed, 3 May 2017 01:21:17 +0000 (21:21 -0400)]
Rollup merge of #41217 - topecongiro:docs/atomic-fence, r=steveklabnik

Update docs of 'fence'

This PR updates the docs for `std::sync::atomic::fence` with an example and a diagram.
Part of #29377.
r? @steveklabnik

7 years agoAuto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichton
bors [Wed, 3 May 2017 00:18:26 +0000 (00:18 +0000)]
Auto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichton

MutexGuard<T> may be Sync only if T is Sync

Fixes #41622

This is a breaking change. Does that imply any further process?

I am not sure whether I wrote that "compilation must fail"-test correctly, but at least it is passing here with the patch applied. Same for the `since = "1.18.0"`, I just picked it because I had to pick something.

7 years agoAuto merge of #41605 - tschottdorf:param-env, r=nikomatsakis
bors [Tue, 2 May 2017 20:44:03 +0000 (20:44 +0000)]
Auto merge of #41605 - tschottdorf:param-env, r=nikomatsakis

Store interned predicates in ParameterEnvironment

See #41444. As a first step towards untangling `ParameterEnvironment`, change
its `caller_bounds` field from a `Vec` into an interned slice of
`ty::Predicate`s.

This change is intentionally well-contained and doesn't pull on any of the
loose ends. In particular, you'll note that `normalize_param_env_or_error`
now interns twice.

7 years agoadd FIXME to `Steal`
Niko Matsakis [Tue, 2 May 2017 17:59:15 +0000 (13:59 -0400)]
add FIXME to `Steal`

7 years agoremove `mir_passes` from `Session` and add a FIXME
Niko Matsakis [Tue, 2 May 2017 17:58:49 +0000 (13:58 -0400)]
remove `mir_passes` from `Session` and add a FIXME

7 years agofix librustc_driver
Niko Matsakis [Tue, 2 May 2017 15:31:10 +0000 (11:31 -0400)]
fix librustc_driver

7 years agohave borrowck fetch MIR, which will perform some errors
Niko Matsakis [Tue, 2 May 2017 13:52:12 +0000 (09:52 -0400)]
have borrowck fetch MIR, which will perform some errors

7 years agoremove temporary variable
Niko Matsakis [Tue, 2 May 2017 10:34:29 +0000 (06:34 -0400)]
remove temporary variable