Commit Graph

80043 Commits

Author SHA1 Message Date
Esteban Küber
2636b314ec Fix incorrect type mismatch label pointing at return type 2018-06-29 10:36:32 -07:00
bors
2c1a715cbd Auto merge of #51569 - SimonSapin:liballoc, r=sfackler
Make the public API of the alloc crate a subset of std

This only affects **unstable** APIs.

I plan to submit an RFC proposing to stabilize the crate. The reason it isn’t stable yet (https://github.com/rust-lang/rust/issues/27783) is in case we end up merging the standard library crates into one. However the `core` crate is already stable, so if that happens we’ll need to keep it working somehow (likely by making replacing its contents by `pub use` items). We can do the same for `alloc`. This PR will hopefully make this easier, but even if that doesn’t happen consistency with `std` seems good.
2018-06-29 16:48:57 +00:00
bors
5fdcd3aa38 Auto merge of #51891 - glandium:llvm, r=alexcrichton
Update LLVM to 1c817c7a0c828b8fc8e8e462afbe5db41c7052d1

https://github.com/rust-lang/llvm/pull/118
https://github.com/rust-lang/llvm/pull/119
2018-06-29 14:43:40 +00:00
bors
ab8a67c12a Auto merge of #51729 - matthewjasper:move-errors, r=nikomatsakis
[NLL] Better move errors

Make a number of changes to improve the quality of NLL cannot move errors.

* Group errors that occur in the same `match` with the same cause.
* Suggest `ref`, `&` or removing `*` to avoid the move.
* Show the place being matched on.

Differences from AST borrowck:

* `&` is suggested over `ref` when matching on a place that can't be moved from.
* Removing `*` is suggested instead of adding `&` when applicable.
* Sub-pattern spans aren't used, this would probably need Spans on Places.

Closes #45699
Closes #46627
Closes #51187
Closes #51189

r? @pnkfelix
2018-06-29 12:40:12 +00:00
Simon Sapin
15bb6c431d liballoc docs: Remove “not intended for general usage” 2018-06-29 14:01:33 +02:00
Simon Sapin
c7638edf52 Rename alloc::arc to alloc::sync, to match std::sync 2018-06-29 14:01:33 +02:00
Simon Sapin
3394fb7bb7 Remove the Vec and String reexports at the root of the alloc crate
… since `std` has no corresponding reexports.

Use `alloc::vec::Vec` and `alloc::string::String` instead.
2018-06-29 14:01:33 +02:00
Simon Sapin
b0547cea0a Move core::alloc::CollectionAllocErr to alloc::collections 2018-06-29 14:01:33 +02:00
Simon Sapin
121b57b87a Move some alloc crate top-level items to a new alloc::collections module
This matches std::collections
2018-06-29 14:01:33 +02:00
Simon Sapin
26324d0abe Remove the unstable alloc::allocator module reexport, deprecated since 1.27 2018-06-29 14:01:33 +02:00
Simon Sapin
1acbb0a935 Make raw_vec perma-unstable and hidden 2018-06-29 14:01:33 +02:00
Gabriel Majeri
fbd3c92a88 Add run-pass test 2018-06-29 14:50:00 +03:00
Gabriel Majeri
fdcee4da79 Fix stability attributes 2018-06-29 14:50:00 +03:00
Gabriel Majeri
02503029b8 Implement PartialEq between &str and OsString
Allows for example `os_string == "something"`
2018-06-29 14:50:00 +03:00
bors
6e5e63a48c Auto merge of #50526 - moxian:just-fix, r=alexcrichton
Add a fallback for stacktrace printing for older Windows versions.

Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends.

Tested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace.

Fixes #50138
2018-06-29 09:42:40 +00:00
bors
2eb6969c6a Auto merge of #51290 - Pslydhh:master, r=alexcrichton
park/park_timeout: prohibit spurious wakeups in next park

<pre><code>
// The implementation currently uses the trivial strategy of a Mutex+Condvar
// with wakeup flag, which does not actually allow spurious wakeups.
</pre></code>

Because does not actually allow spurious wakeups.
so we have let thread.inner.cvar.wait(m) in the loop to prohibit spurious wakeups.
but if notified after we locked, this notification doesn't be consumed, it return, the next park will consume this notification...this is also 'spurious wakeup' case, 'one unpark() wakeups two  park()'.

We should improve this situation:
`thread.inner.state.store(EMPTY, SeqCst);`
2018-06-29 07:34:13 +00:00
Mike Hommey
998ce108df Update LLVM to 1c817c7a0c828b8fc8e8e462afbe5db41c7052d1
https://github.com/rust-lang/llvm/pull/118
https://github.com/rust-lang/llvm/pull/119
2018-06-29 13:58:17 +09:00
bors
3b50455c61 Auto merge of #50357 - seanmonstar:arc-weak-null, r=KodrAus
Arc: remove unused allocation from Weak::new()

It seems non-obvious that calling `Weak::new()` actually allocates space for the entire size of `T`, even though you can **never** access that data from such a constructed weak pointer. Besides that, if someone were to create many `Weak:new()`s, they could be unknowingly wasting a bunch of memory.

This change makes it so that `Weak::new()` allocates no memory at all. Instead, it is created with a null pointer. The only things done with a `Weak` are trying to upgrade, cloning, and dropping, meaning there are very few places that the code actually needs to check if the pointer is null.
2018-06-29 04:09:02 +00:00
Ixrec
d6cf1821bf
Fix inconsequential typo in GlobalAlloc doc example 2018-06-29 03:12:02 +01:00
bors
775ce97497 Auto merge of #51592 - GuillaumeGomez:fix-macro-doc-search, r=GuillaumeGomez
Fix macro missing from doc search

Fixes #51095.

r? @QuietMisdreavus
2018-06-29 01:05:02 +00:00
Nicholas Nethercote
08683f003c Rename IdxSet::clone_from.
The current situation is something of a mess.

- `IdxSetBuf` derefs to `IdxSet`.
- `IdxSetBuf` implements `Clone`, and therefore has a provided `clone_from`
  method, which does allocation and so is expensive.
- `IdxSet` has a `clone_from` method that is non-allocating and therefore
  cheap, but this method is not from the `Clone` trait.

As a result, if you have an `IdxSetBuf` called `b`, if you call
`b.clone_from(b2)` you'll get the expensive `IdxSetBuf` method, but if you call
`(*b).clone_from(b2)` you'll get the cheap `IdxSetBuf` method.
`liveness_of_locals()` does the former, presumably unintentionally, and
therefore does lots of unnecessary allocations.

Having a `clone_from` method that isn't from the `Clone` trait is a bad idea in
general, so this patch renames it as `overwrite`. This avoids the unnecessary
allocations in `liveness_of_locals()`, speeding up most NLL benchmarks, the
best by 1.5%. It also means that calls of the form `(*b).clone_from(b2)` can be
rewritten as `b.overwrite(b2)`.
2018-06-29 09:57:19 +10:00
bors
57dd722606 Auto merge of #51884 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 6 pull requests

Successful merges:

 - #51636 (Refactor error reporting of constants)
 - #51765 (Use assert_eq! in copy_from_slice)
 - #51822 (Provide existing ref suggestions for more E0308 errors)
 - #51839 (Detect overflows of non u32 shifts)
 - #51868 (Remove process::id from 'Stabilized APIs' in 1.27.0 release notes)
 - #51875 (Explicitely disable WASM code generation for Emscripten)

Failed merges:

r? @ghost
2018-06-28 22:20:14 +00:00
Mark Rousskov
3332c0c7e1
Rollup merge of #51875 - badboy:emscripten-no-wasm, r=nikomatsakis
Explicitely disable WASM code generation for Emscripten

Emscripten changed the default behavior recently:
bd050e64bb/ChangeLog.markdown (v1381-05172018)

It now defaults to WebAssembly and requires an explicit flag to generate asm.js.
WASM=0 is also valid for older emcc and thus doesn't break it.
2018-06-28 16:07:16 -06:00
Mark Rousskov
7c0dd79e02
Rollup merge of #51868 - Lireer:master, r=pietroalbini
Remove process::id from 'Stabilized APIs' in 1.27.0 release notes

process::id was already stabilized in 1.26.0 and is marked as such in the docs.
2018-06-28 16:07:15 -06:00
Mark Rousskov
7b8fc87733
Rollup merge of #51839 - oli-obk:const_shift_overflow, r=nikomatsakis
Detect overflows of non u32 shifts
2018-06-28 16:07:14 -06:00
Mark Rousskov
e0179dfdce
Rollup merge of #51822 - estebank:suggest-more, r=nikomatsakis
Provide existing ref suggestions for more E0308 errors
2018-06-28 16:07:13 -06:00
Mark Rousskov
85804f66be
Rollup merge of #51765 - jonas-schievink:patch-1, r=KodrAus
Use assert_eq! in copy_from_slice

This will print both lengths when the assertion fails instead of just saying that they're different.

Output of current stable and nightly (modulo the exact line number):
```
thread 'main' panicked at 'destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Output after this PR:
```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `123`,
 right: `456`: destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Note that I have not run the tests locally.
2018-06-28 16:07:12 -06:00
Mark Rousskov
57aceeecc0
Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddyb
Refactor error reporting of constants

cc @eddyb

This PR should not change any behaviour. It solely simplifies the internal handling of the errors
2018-06-28 16:07:10 -06:00
Esteban Küber
23d59d00be Suggest correct comparison against negative literal
When parsing as emplacement syntax (`x<-1`), suggest the correct syntax
for comparison against a negative value (`x< -1`).
2018-06-28 14:58:54 -07:00
moxian
be7f619870 Change traits to bare FnMut where possible. 2018-06-28 21:57:08 +00:00
moxian
9d426ac387 Make msvc symbol extraction/printing functions generic. 2018-06-28 21:57:03 +00:00
moxian
a0b15012a1 Make stackwalking generic instead of matching on enum variants. 2018-06-28 21:56:58 +00:00
moxian
c0b280f5f5 Load backtrace-related functions only once
.. and pass them around in BacktraceContext.
2018-06-28 21:56:53 +00:00
moxian
3245a475ab Split separate stackwalk variants into their own functions
.. rather than having them be one giant match statement.
2018-06-28 21:56:48 +00:00
moxian
d39c66bf4f Add a fallback for stacktrace printing for older Windows versions.
PR #47252 switched stack inspection functions of dbghelp.dll
to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older
dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll
version 6.1.7601 from 2010, that lacks StackWalkEx and friends.

Fixes #50138
2018-06-28 21:56:42 +00:00
varkor
4071adfcb5 Always check type_dependent_defs 2018-06-28 22:52:44 +01:00
Esteban Küber
8449c5ab8a Fix rebase 2018-06-28 12:52:58 -07:00
Sean McArthur
24ce259782 Arc: remove unused allocation from Weak::new() 2018-06-28 11:49:47 -07:00
Esteban Küber
54a04b3b03 Provide existing ref suggestions for more E0308 errors 2018-06-28 11:37:15 -07:00
Esteban Küber
9a9b747371 review comments: unify duplicated code 2018-06-28 11:12:45 -07:00
Esteban Küber
03bcebbc60 Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
Esteban Küber
3005162f98 Extend support to get_generics for all NodeItems 2018-06-28 11:12:43 -07:00
Esteban Küber
5436a5c55a Point to lifetime in fn definition on lifetime error note 2018-06-28 11:12:42 -07:00
Esteban Küber
cd8ca26257 Point at lifetimes instead of def span for E0195 2018-06-28 11:12:41 -07:00
bors
e3bf634e06 Auto merge of #51687 - japaric:gh51671, r=alexcrichton
translate / export weak lang items

see #51671 for details

fixes #51671
fixes #51342

r? @michaelwoerister or @alexcrichton
2018-06-28 15:34:17 +00:00
Eh2406
6e0cefe3db add comments 2018-06-28 10:18:35 -04:00
Eh2406
ad71cbfe66 use deref instead of inner 2018-06-28 10:18:33 -04:00
Eh2406
4b44db126e each_affected_by_dirty 2018-06-28 10:18:32 -04:00
Eh2406
9bd2a63f29 remove inner_mut as it can mess up invariants 2018-06-28 10:18:31 -04:00
Eh2406
497a3b4fd5 fix typo and tidy 2018-06-28 10:18:30 -04:00