]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoAuto merge of #41515 - eddyb:non-static-assoc-const, r=nikomatsakis
bors [Mon, 8 May 2017 23:02:30 +0000 (23:02 +0000)]
Auto merge of #41515 - eddyb:non-static-assoc-const, r=nikomatsakis

rustc: treat const bodies like fn bodies in middle::region.

Allows `T::ASSOC_CONST` to be used without a `T: 'static` bound.

cc @rust-lang/compiler @rust-lang/lang

7 years agoAuto merge of #41824 - Mark-Simulacrum:undo-yacc-removal, r=nagisa
bors [Mon, 8 May 2017 15:49:03 +0000 (15:49 +0000)]
Auto merge of #41824 - Mark-Simulacrum:undo-yacc-removal, r=nagisa

Readd LALR grammar

Reverts a portion of #41705. Please let me know if I missed anything.

r? @nagisa

7 years agoRe-add LALR grammar.
Mark Simulacrum [Mon, 8 May 2017 11:33:43 +0000 (05:33 -0600)]
Re-add LALR grammar.

7 years agoAuto merge of #41745 - oli-obk:diagnostics, r=jonathandturner
bors [Mon, 8 May 2017 12:00:22 +0000 (12:00 +0000)]
Auto merge of #41745 - oli-obk:diagnostics, r=jonathandturner

Remove need for &format!(...) or &&"" dances in `span_label` calls

These were always a thorn in my eye. Note that this will monomorphize to two impls, one for `String` and one for `&str`. But I think that cost is worth the ergonomics at the call sites that can be seen throughout this PR.

7 years agoRemove need for &format!(...) or &&"" dances in `span_label` calls
Oliver Schneider [Thu, 4 May 2017 12:17:23 +0000 (14:17 +0200)]
Remove need for &format!(...) or &&"" dances in `span_label` calls

7 years agoAuto merge of #41818 - michaelwu:hvx-v60, r=nagisa
bors [Mon, 8 May 2017 05:29:24 +0000 (05:29 +0000)]
Auto merge of #41818 - michaelwu:hvx-v60, r=nagisa

Add support for Hexagon v60 HVX intrinsics

HVX is a SIMD coprocessor available on newer hexagon cores. It can be configured for 512 or 1024 bit registers, and some instructions use pairs of registers. It only does integer operations, but it probably has every integer operation you'd want for 8/16/32 bit elements.

There are a lot of intrinsics. The generator outputs 582 of them. I probably got some wrong. I did some scripting to make sure that every llvm intrinsic name exists, but intrinsic names provided for programs have only been compared by eye to Qualcomm's own names. 64/128 is also appended to the names to select between 512/1024 bit. The C intrinsics don't do this, but they only expose one set, selected at compile time.

The json specifying the intrinsics required a bit of duplication since I didn't see an easy way to specify combinations of signed/unsigned types (eg. u(8-16) and s(16-32)). I also didn't see an easy way to specify variants of instructions like saturating or rounding.

Basic multiplication and load/store tested on the hexagon simulator.

7 years agoAuto merge of #41729 - ubsan:master, r=nrc
bors [Sun, 7 May 2017 22:59:30 +0000 (22:59 +0000)]
Auto merge of #41729 - ubsan:master, r=nrc

Delete features which are easily removed, in libsyntax

7 years agoAdd support for Hexagon v60 HVX intrinsics
Michael Wu [Tue, 18 Apr 2017 20:13:10 +0000 (16:13 -0400)]
Add support for Hexagon v60 HVX intrinsics

7 years agoAuto merge of #41811 - gamazeps:thread-panicking-doc, r=frewsxcv
bors [Sun, 7 May 2017 18:58:14 +0000 (18:58 +0000)]
Auto merge of #41811 - gamazeps:thread-panicking-doc, r=frewsxcv

[DOC] Improve `thread::panicking` documentaion.

Part of #29378

Takes care of: `panicking` could use some more advice on when to use this.

I mays have done a poor choice of introducing `Mutex`s.

r? @steveklabnik

7 years agoImprove `thread::panicking` documentaion.
Felix Raimundo [Sun, 7 May 2017 14:49:18 +0000 (16:49 +0200)]
Improve `thread::panicking` documentaion.

Part of #29378

7 years agoAuto merge of #41791 - Mark-Simulacrum:doc-guidelines, r=frewsxcv
bors [Sun, 7 May 2017 16:20:15 +0000 (16:20 +0000)]
Auto merge of #41791 - Mark-Simulacrum:doc-guidelines, r=frewsxcv

Minor cleanup of UX guidelines.

I think this fixes https://github.com/rust-lang/rust/issues/34808. It covers the [long error code explanations normalization] by linking to the RFC, and cleaning up the list where long diagnostics are defined. While the [error message overhaul] isn't covered directly, I'm not really sure that more than the [existing section] on the error/warning/help messages is warranted; the overhaul linked didn't really specify any new guidelines, primarily just changing the output format.

[Long error code explanations normalization]: https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md
[Error message overhaul]: https://github.com/rust-lang/rust/issues/33240
[existing section]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc-ux-guidelines.md#error-warning-help-note-messages

7 years agoAuto merge of #40857 - estebank:recursive, r=arielb1
bors [Sun, 7 May 2017 13:57:36 +0000 (13:57 +0000)]
Auto merge of #40857 - estebank:recursive, r=arielb1

Point at fields that make the type recursive

On recursive types of infinite size, point at all the fields that make
the type recursive.

```rust
struct Foo {
    bar: Bar,
}

struct Bar {
    foo: Foo,
}
```

outputs

```
error[E0072]: recursive type `Foo` has infinite size
 --> file.rs:1:1
1 | struct Foo {
  | ^^^^^^^^^^ recursive type has infinite size
2 |     bar: Bar,
  |     -------- recursive here
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable

error[E0072]: recursive type `Bar` has infinite size
 --> file.rs:5:1
  |
5 | struct Bar {
  | ^^^^^^^^^^ recursive type has infinite size
6 |     foo: Foo,
  |     -------- recursive here
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
```

7 years agoAuto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomez
bors [Sun, 7 May 2017 10:52:26 +0000 (10:52 +0000)]
Auto merge of #41785 - Mark-Simulacrum:issue-41783, r=GuillaumeGomez

Allow # to appear in rustdoc code output.

"##" at the start of a trimmed rustdoc line is now cut to "#" and then
shown. If the user wanted to show "##", they can type "###".

I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously, `##` had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where `##` would likely be correct in a code block, though of course I could be wrong.

Fixes #41783.

7 years agoAuto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez
bors [Sun, 7 May 2017 08:30:10 +0000 (08:30 +0000)]
Auto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez

Add links between `slice::{copy,clone}_from_slice` in docs.

None

7 years agofix the easy features in libsyntax
ubsan [Wed, 3 May 2017 17:54:03 +0000 (10:54 -0700)]
fix the easy features in libsyntax

7 years agoAuto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfried
bors [Sun, 7 May 2017 03:01:31 +0000 (03:01 +0000)]
Auto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfried

Increase macro recursion limit to 1024

Fixes #22552

7 years agoAuto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturner
bors [Sun, 7 May 2017 00:41:30 +0000 (00:41 +0000)]
Auto merge of #41668 - kennytm:fix-issue-41652, r=jonathandturner

Fix issue #41652

Fix issue #41652. Don't print anything in `render_source_line()` if no source code is given.

(cc @jonathandturner #34789)

7 years agoAllow # to appear in rustdoc code output.
Mark Simulacrum [Sat, 6 May 2017 13:08:41 +0000 (07:08 -0600)]
Allow # to appear in rustdoc code output.

"##" at the start of a trimmed rustdoc line is now cut to "#" and then
shown. If the user wanted to show "##", they can type "###".

7 years agoAuto merge of #41787 - jsheard:ulongptr, r=alexcrichton
bors [Sat, 6 May 2017 22:14:43 +0000 (22:14 +0000)]
Auto merge of #41787 - jsheard:ulongptr, r=alexcrichton

Fix definitions of ULONG_PTR

The Windows type `ULONG_PTR` is supposed to be equivalent to `usize`, but several parts of the codebase currently define it as `u64`. Evidently this hasn't broken anything yet but it might cause annoying 32-bit-specific breakage in future.

See https://msdn.microsoft.com/en-gb/library/windows/desktop/aa383751(v=vs.85).aspx

r? @alexcrichton

7 years agoMinor cleanup of UX guidelines.
Mark Simulacrum [Sat, 6 May 2017 20:17:26 +0000 (14:17 -0600)]
Minor cleanup of UX guidelines.

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 agoAdd links between `slice::{copy,clone}_from_slice` in docs.
Corey Farwell [Sat, 6 May 2017 13:31:00 +0000 (09:31 -0400)]
Add links between `slice::{copy,clone}_from_slice` in docs.

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 agorustc: treat const bodies like fn bodies in middle::region.
Eduard-Mihai Burtescu [Mon, 24 Apr 2017 19:03:47 +0000 (22:03 +0300)]
rustc: treat const bodies like fn bodies in middle::region.

7 years agoFix definitions of ULONG_PTR
Joshua Sheard [Sat, 6 May 2017 14:46:16 +0000 (15:46 +0100)]
Fix definitions of ULONG_PTR

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

7 years agoMove logic to `is_representable` instead of climbing HIR
Esteban Küber [Sat, 15 Apr 2017 23:18:09 +0000 (16:18 -0700)]
Move logic to `is_representable` instead of climbing HIR

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 agoOnly point at the fields that cause infinite size
Esteban Küber [Mon, 27 Mar 2017 21:21:27 +0000 (14:21 -0700)]
Only point at the fields that cause infinite size

* clean up code
* point only fields that cause the type to be of infinite size
* fix unittests

7 years agoPoint at fields that make the type recursive
Esteban Küber [Mon, 27 Mar 2017 16:35:27 +0000 (09:35 -0700)]
Point at fields that make the type recursive

On recursive types of infinite size, point at all the fields that make
the type recursive.

```rust
struct Foo {
    bar: Bar,
}

struct Bar {
    foo: Foo,
}
```

outputs

```
error[E0072]: recursive type `Foo` has infinite size
 --> file.rs:1:1
1 |   struct Foo {
  |  _^ starting here...
2 | |     bar: Bar,
  | |     -------- recursive here
3 | | }
  | |_^ ...ending here: recursive type has infinite size
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable

error[E0072]: recursive type `Bar` has infinite size
 --> file.rs:5:1
  |
5 |   struct Bar {
  |  _^ starting here...
6 | |     foo: Foo,
  | |     -------- recursive here
7 | | }
  | |_^ ...ending here: recursive type has infinite size
  |
  = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
```

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