Commit Graph

63893 Commits

Author SHA1 Message Date
Corey Farwell
c104db4801 Rollup merge of #41293 - est31:floating_literal_match, r=nikomatsakis
Implement the illegal_floating_point_literal_pattern compat lint

Adds a future-compatibility lint for the [breaking-change] introduced by issue #41620 . cc issue #41255 .
2017-05-08 22:34:46 -04:00
bors
f1140a3317 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
2017-05-08 23:02:30 +00:00
bors
20de961226 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
2017-05-08 15:49:03 +00:00
Mark Simulacrum
6ebbe0ef50 Re-add LALR grammar. 2017-05-08 09:47:05 -06:00
bors
198917bb4f 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.
2017-05-08 12:00:22 +00:00
Oliver Schneider
dd87eabd83 Remove need for &format!(...) or &&"" dances in span_label calls 2017-05-08 12:56:15 +02:00
bors
70198a0a44 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.
2017-05-08 05:29:24 +00:00
bors
9956e81c19 Auto merge of #41729 - ubsan:master, r=nrc
Delete features which are easily removed, in libsyntax
2017-05-07 22:59:30 +00:00
Michael Wu
cc4efd1370 Add support for Hexagon v60 HVX intrinsics 2017-05-07 15:07:36 -04:00
bors
d985625b3c 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
2017-05-07 18:58:14 +00:00
Felix Raimundo
12efc9d0fa Improve thread::panicking documentaion.
Part of #29378
2017-05-07 18:40:06 +02:00
bors
8d19877ece 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
2017-05-07 16:20:15 +00:00
bors
a478e46eb7 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
```
2017-05-07 13:57:36 +00:00
bors
ced823e267 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.
2017-05-07 10:52:26 +00:00
bors
892be3f307 Auto merge of #41784 - frewsxcv:slice-clone-copy-links, r=GuillaumeGomez
Add links between `slice::{copy,clone}_from_slice` in docs.

None
2017-05-07 08:30:10 +00:00
ubsan
0be875827f fix the easy features in libsyntax 2017-05-07 01:20:15 -07:00
bors
0c2f34dd02 Auto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfried
Increase macro recursion limit to 1024

Fixes #22552
2017-05-07 03:01:31 +00:00
bors
5b31bf8511 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)
2017-05-07 00:41:30 +00:00
Mark Simulacrum
ffe12b1274 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 "###".
2017-05-06 18:07:04 -06:00
bors
2527f41baf 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
2017-05-06 22:14:43 +00:00
Mark Simulacrum
7f2f780f95 Minor cleanup of UX guidelines. 2017-05-06 14:17:26 -06:00
bors
c1a960a031 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)
2017-05-06 19:45:10 +00:00
bors
2cf6af1755 Auto merge of #41788 - TimNN:trigger-llvm, r=Mark-Simulacrum
Trigger llvm rebuild

This was missing from #41739, thanks @tedhorst for noticing!
2017-05-06 17:18:11 +00:00
Corey Farwell
65e56fad98 Add links between slice::{copy,clone}_from_slice in docs. 2017-05-06 13:07:18 -04:00
acdenisSK
bb34a3e16b Update the .stderr file for the "an" changes 2017-05-06 18:49:01 +02:00
Tim Neumann
f5e3427b9c trigger llvm rebuild 2017-05-06 17:39:03 +02:00
Eduard-Mihai Burtescu
90af729a97 rustc: treat const bodies like fn bodies in middle::region. 2017-05-06 18:35:43 +03:00
Joshua Sheard
db8be04e49 Fix definitions of ULONG_PTR 2017-05-06 15:46:16 +01:00
acdenisSK
a257d5afb0 Fix "an" usage 2017-05-06 16:06:38 +02:00
Esteban Küber
a4fc925192 Move logic to is_representable instead of climbing HIR 2017-05-05 21:58:26 -07:00
bors
8aad3a3524 Auto merge of #41768 - rap2hpoutre:patch-4, r=frewsxcv
Add an example to std:🧵: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
2017-05-06 02:01:00 +00:00
bors
42a4f373c9 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:
2017-05-05 23:20:32 +00:00
Corey Farwell
5bed9dc320 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.
2017-05-05 17:35:30 -04:00
Corey Farwell
1ef0aef777 Rollup merge of #41761 - euclio:24106-test, r=estebank
Add regression test for issue #24106

Fixes #24106.
2017-05-05 17:35:29 -04:00
Corey Farwell
26e067b058 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
2017-05-05 17:35:29 -04:00
Corey Farwell
9b2aacfdbe 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
2017-05-05 17:35:28 -04:00
Corey Farwell
ecd7b48b25 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
```
2017-05-05 17:35:27 -04:00
Corey Farwell
b091d6ed42 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
2017-05-05 17:35:26 -04:00
Corey Farwell
69f4e318a0 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
2017-05-05 17:35:25 -04:00
Corey Farwell
31a4d73e73 Rollup merge of #41307 - GuillaumeGomez:jquery-removal, r=frewsxcv
Remove jquery dependency

r? @rust-lang/docs

Fixes #39159.
2017-05-05 17:35:24 -04:00
Corey Farwell
6ace8a76cb 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`.
2017-05-05 17:35:24 -04:00
bors
f4209651ec 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.
2017-05-05 20:44:15 +00:00
Niko Matsakis
3da5daf425 change various uses of item_variances to variances_of 2017-05-05 14:34:42 -04:00
Alex Crichton
94e4b459ef 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.
2017-05-05 11:27:45 -07:00
bors
302dfd6c9d Auto merge of #41765 - brson:installer, r=alexcrichton
Update rust-installer to fix rust-lang-nursery/rustup.rs#1092

r? @TimNN

cc @alexcrichton @ranma42
2017-05-05 17:48:50 +00:00
Alex Crichton
495c998508 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
2017-05-05 06:59:49 -07:00
Raphaël Huchet
71aaab1c36 Update mod.rs 2017-05-05 12:07:14 +02:00
Raphaël Huchet
68bb541462 Add an example to std:🧵:Result type 2017-05-05 12:02:02 +02:00
F001
a9d3b3498e Suggest ! for bitwise negation when encountering a ~ 2017-05-05 02:38:58 -07:00
Guillaume Gomez
d5863e9985 Add Options type in libtest and remove argument 2017-05-05 10:52:10 +02:00