Commit Graph

64269 Commits

Author SHA1 Message Date
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
Marco A L Barbosa
3acfa81e6b bootstrap: openssl android support 2017-05-05 17:12:05 -03:00
achernyak
d561d4c9eb propper trait of item impl 2017-05-05 14:40:26 -05: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
achernyak
5a7946df70 is_foreign_item 2017-05-05 08:15:08 -05: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
Brian Anderson
f59931dc17 Update rust-installer to fix rust-lang-nursery/rustup.rs#1092 2017-05-05 00:03:30 -07:00
Jon Gjengset
68ae6173fe
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.
2017-05-04 23:59:55 -04:00
bors
a6ab049ed1 Auto merge of #41762 - frewsxcv:rollup, r=frewsxcv
Rollup of 4 pull requests

- Successful merges: #41741, #41746, #41749, #41754
- Failed merges:
2017-05-05 03:56:34 +00:00
Alexis Beingessner
e8234e0e47 update to latest nomicon 2017-05-04 23:54:55 -04:00
Alexis Beingessner
c7cffc5f4e Deprecate heap::EMPTY in favour of Unique::empty or otherwise. 2017-05-04 23:54:54 -04:00
Alexis Beingessner
4ff583b116 fallout from NonZero/Unique/Shared changes 2017-05-04 23:54:54 -04:00
Scott McMurray
e8fad325fe Make [u8]::reverse() 5x faster
Since LLVM doesn't vectorize the loop for us, do unaligned reads
of a larger type and use LLVM's bswap intrinsic to do the
reversing of the actual bytes.  cfg!-restricted to x86 and
x86_64, as I assume it wouldn't help on things like ARMv5.

Also makes [u16]::reverse() a more modest 1.5x faster by
loading/storing u32 and swapping the u16s with ROT16.

Thank you ptr::*_unaligned for making this easy :)
2017-05-04 20:28:34 -07:00
Corey Farwell
ed1b78c16b 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-04 22:37:55 -04:00
Esteban Küber
f7108e18cd 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
2017-05-04 19:11:59 -07:00
Esteban Küber
ed6ad0952f 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
```
2017-05-04 19:11:58 -07:00
Corey Farwell
3cd7f37482 Rollup merge of #41754 - nikomatsakis:incr-comp-cleanup-cell, r=arielb1
kill some unused fields in TyCtxt
2017-05-04 21:35:31 -04:00
Corey Farwell
9659c806b8 Rollup merge of #41749 - frewsxcv:option-simplify-types, r=GuillaumeGomez
Simplify types in `std::option` doc comment example.

None
2017-05-04 21:35:30 -04:00
Corey Farwell
a9b0b5e4c3 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.
2017-05-04 21:35:29 -04:00
Corey Farwell
63e477d51d Rollup merge of #41741 - rap2hpoutre:patch-3, r=steveklabnik
join method returns a thread::Result

Join method returns a std:🧵: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.
2017-05-04 21:35:28 -04:00
bors
50b9858718 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
2017-05-05 01:00:13 +00:00
Andy Russell
4c1a5054f0
add regression test for issue #24106
Fixes #24106.
2017-05-04 19:34:48 -04:00
Alex Crichton
5013952e4a rustc: Stabilize -C target-feature=+crt-static
This commit stabilizes the `crt-static` feature accepted by the compiler. Note
that this does not stabilize the `#[cfg]` attribute for `crt-static` as
that's going to be covered by #29717. This only stabilizes a few small pieces:

* The `crt-static` feature as accepted by the `-C target-feature` flag, and its
  connection with the platform-specific definition of `crt-static`.
* The semantics of `--print cfg` printing out activated `crt-static` feature, if
  available.

This should be enough to get the benefits of `crt-static` on stable Rust with
MSVC and with musl, but sidsteps the issue of stabilizing #29717 first.

Closes #37406
2017-05-04 14:03:04 -07:00
Alexis Beingessner
6e2efe3aa4 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
2017-05-04 14:56:02 -04:00
bors
59f1a2f948 Auto merge of #41739 - TimNN:update-llvm, r=aturon
Update llvm to pull in various backports

Fixes #41672
Fixes #41630
Fixes #41685
2017-05-04 18:46:17 +00:00
Alex Crichton
ccbcc720a6 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
2017-05-04 11:04:20 -07:00
achernyak
5b71d769ff moved metadata provider impls to decoder 2017-05-04 12:45:56 -05:00
Niko Matsakis
0f6d4ac88d kill some unused fields in TyCtxt 2017-05-04 13:14:24 -04:00
Corey Farwell
7b94d6cf19 Simplify types in std::option doc comment example. 2017-05-04 11:53:24 -04:00
bors
838e9c5123 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.
2017-05-04 14:50:33 +00:00
achernyak
03fe10d91d impl_parent 2017-05-04 09:37:34 -05:00
achernyak
aa5a532046 trait_of_item 2017-05-04 08:27:48 -05:00
Tommy Ip
05329e5780 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.
2017-05-04 13:19:36 +01:00
Raphaël Huchet
93e179a8c1 Update mod.rs 2017-05-04 14:04:03 +02:00
bors
222971f7d2 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.
2017-05-04 11:51:34 +00:00
Mátyás Mustoha
b194def3a2 Add remote device testing support 2017-05-04 12:43:22 +02:00
Raphaël Huchet
3a07155a9d create link to Result 2017-05-04 11:33:26 +02:00
bors
ac46091e82 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
2017-05-04 09:15:23 +00:00
Raphaël Huchet
a3998ad6e5 Join method returns a thread::Result 2017-05-04 11:11:14 +02:00
Tim Neumann
16ad2c8fad Update llvm to pull in various backports 2017-05-04 08:12:17 +02:00
Niko Matsakis
3f2dd4d24a remove ast_ty_to_ty_cache entirely 2017-05-03 21:33:17 -04:00
Niko Matsakis
3039398c68 convert save-analysis to use ItemCtxt and not ast_ty_to_ty_cache 2017-05-03 21:33:15 -04:00