Commit graph

65341 commits

Author SHA1 Message Date
bors
8503b3ff82 Auto merge of #46319 - nikomatsakis:nll-master-to-rust-master-2, r=pnkfelix
NLL: improve inference with flow results, represent regions with bitsets, and more

This PR begins with a number of edits to the NLL code and then includes a large number of smaller refactorings (these refactorings ought not to change behavior). There are a lot of commits here, but each is individually simple. The goal is to land everything up to but not including the changes to how we handle closures, which are conceptually more complex.

The NLL specific changes are as follows (in order of appearance):

**Modify the region inferencer's approach to free regions.** Previously, for each free region (lifetime parameter) `'a`, it would compute the set of other free regions that `'a` outlives (e.g., if we have `where 'a: 'b`, then this set would be `{'a, 'b}`). Then it would mark those free regions as "constants" and report an error if inference tried to extend `'a` to include any other region (e.g., `'c`) that is not in that outlives set. In this way, the value of `'a` would never grow beyond the maximum that could type check. The new approach is to allow `'a` to grow larger. Then, after the fact, we check over the value of `'a` and see what other free regions it is required to outlive, and we check that those outlives relationships are justified by the where clauses in scope etc.

**Modify constraint generation to consider maybe-init.** When we have a "drop-live" variable `x` (i.e., a variable that will be dropped but will not be otherwise used), we now consider whether `x` is "maybe initialized" at that point. If not, then we know the drop is a no-op, and we can allow its regions to be dead. Due to limitations in the fragment code, this currently only works at the level of entire variables.

**Change representation of regions to use a `BitMatrix`.** We used to use a `BTreeSet`, which was rather silly. We now use a MxN matrix of bits, where `M` is the number of variables and `N` is the number of possible elements in each set (size of the CFG + number of free regions).

The remaining commits (starting from
extract the `implied_bounds` code into a helper function ") are all "no-op" refactorings, I believe.

~~One concern I have is with the commit "with -Zverbose, print all details of closure substs"; this commit seems to include some "internal" stuff in the mir-dump files, such as internal interner numbers, that I fear may vary by platform. Annoying. I guess we will see.~~ (I removed this commit.)

As for reviewer, @arielb1 has been reviewing the PRs, and they are certainly welcome to review this one too. But I figured it'd maybe be good to have more people taking a look and being familiar with this code, so I'll "nominate" @pnkfelix .

r? @pnkfelix
2017-12-04 19:07:52 +00:00
Marco A L Barbosa
79b47a1f26 Rename cross(2) builder to dist-various-{1,2}
Follows the convention of the other builders.
2017-12-04 16:38:19 -02:00
Niko Matsakis
a6adc74e87 adopt longer and shorter rather than fr and outlived_fr 2017-12-04 11:30:39 -05:00
Niko Matsakis
ab2bc9f073 outlives/env: fix comment, say must and not should 2017-12-04 11:30:38 -05:00
bors
226656ff72 Auto merge of #46463 - nak3:fix-invalid-docs-path, r=kennytm
Fix invalid docs path for compiler plugins

The path to the docs `src/doc/guide-plugin.md` moved to
`src/doc/unstable-book/src/language-features/plugin.md`.

This patch updates it in the comment of WARNING message of the test
code.
2017-12-04 16:29:28 +00:00
Irina-Gabriela Popa
2c175df013 rustc_back: replace tempdir with crates.io version. 2017-12-04 18:25:31 +02:00
Irina-Gabriela Popa
dda924ab6a rustc_back: move dynamic_lib to rustc_metadata. 2017-12-04 18:25:29 +02:00
Irina-Gabriela Popa
d6f70359dc rustc_back: remove slice module in favor of std::slice::from_ref. 2017-12-04 18:25:06 +02:00
Niko Matsakis
271616088f transtive_relation: fix typo in comment for parents 2017-12-04 10:46:35 -05:00
Niko Matsakis
7409ffd17e outlives/env: Fix comment that lost surrounding context. 2017-12-04 10:42:46 -05:00
Niko Matsakis
a3935961f0 region_infer: Fix typo in comment 2017-12-04 10:36:54 -05:00
Niko Matsakis
14480b401a free_region_map: Fix typo in comment: r_a <= r_b 2017-12-04 10:36:38 -05:00
Niko Matsakis
c1708abb07 type_check.rs: rustfmt 2017-12-04 09:14:39 -05:00
Niko Matsakis
506e80c899 remove unused span from eq_types (and rustfmt slightly) 2017-12-04 09:14:39 -05:00
Niko Matsakis
18cc0f9f37 document closure_base_def_id 2017-12-04 09:14:38 -05:00
Niko Matsakis
2e63bb3419 fix debruijn account in for_each_free_region 2017-12-04 09:14:38 -05:00
Niko Matsakis
243bf3f718 rename "free region" to "universally quantified region"
This has been bugging me. All the regions appear free in the source;
the real difference is that some of them are universally quantified
(those in the function signature) and some are existentially
quantified (those for which we are inferring values).
2017-12-04 09:14:38 -05:00
Niko Matsakis
fa813f74a2 introduce closure_env_ty helper to compute ty of closure env arg
Previously the code was somewhat duplicated.
2017-12-04 09:14:38 -05:00
Niko Matsakis
7f247add41 move liberate_late_bound_regions to a method on the tcx
No reason for it to live on `Inherited`.
2017-12-04 09:14:37 -05:00
Niko Matsakis
e9067bd5cc MIR dump: restructure pretty to be more extensible by other code 2017-12-04 09:14:37 -05:00
Niko Matsakis
49d2274cfe constraint_generation: create liveness constraints more thoroughly
We now visit just the stuff in the CFG, and we add liveness
constraints for all the random types, regions etc that appear within
rvalues and statements.
2017-12-04 09:14:35 -05:00
Niko Matsakis
4de7336862 extend TransitiveRelation with parents function 2017-12-04 08:51:14 -05:00
Niko Matsakis
663e7a4f08 promote region_infer into its own module 2017-12-04 08:51:13 -05:00
Niko Matsakis
fb4b06ab3b rename greater_than to reachable_from 2017-12-04 08:51:13 -05:00
Niko Matsakis
45f6027196 break type-checking of aggregate-kind out into helper function 2017-12-04 08:51:13 -05:00
Niko Matsakis
31d61f1f86 rename implied_bounds module to bounds 2017-12-04 08:51:13 -05:00
Niko Matsakis
c45307fae1 extract the code to create OutlivesBounds into its own module
Now it can be reused by the NLL code.
2017-12-04 08:51:13 -05:00
Niko Matsakis
1f33145ae9 make no_late_bound_regions a method on Binder<T> 2017-12-04 08:51:12 -05:00
Niko Matsakis
5562663a6c make resolve_regions_and_report_errors take an OutlivesEnv
This revealed some shortcomings, one of which is fixed. Fixes #45937.
2017-12-04 08:51:12 -05:00
Niko Matsakis
abd7d88139 move free_regions_map into infer::outlives 2017-12-04 08:51:12 -05:00
Niko Matsakis
aa51603870 extract the implied_bounds code into a helper function 2017-12-04 08:51:12 -05:00
Zack M. Davis
22b31758ec region_infer: BitMatrix representation of region values
This should be more efficient than allocating two BTreeSets for every
region variable?—as it is written in #45670.
2017-12-04 08:51:11 -05:00
Paul Daniel Faria
a9cb25b23a inform constraint generation using maybe-init
In particular, if we see a variable is DROP-LIVE, but it is not
MAYBE-INIT, then we can ignore the drop. This leavess attempt to use
more complex refinements of the idea (e.g., for subpaths or subfields)
to future work.
2017-12-04 08:51:11 -05:00
Niko Matsakis
08c8d7e919 borrow_check.rs: rustfmt 2017-12-04 08:51:10 -05:00
Kenjiro Nakayama
3e46fa2c9a Fix invalid docs path for compiler plugins 2017-12-04 22:39:39 +09:00
Niko Matsakis
a96b0cf86d replace constant regions with a post-inference check
Rather than declaring some region variables to be constant, and
reporting errors when they would have to change, we instead populate
each free region X with a minimal set of points (the CFG plus end(X)),
and then we let inference do its thing. This may add other `end(Y)`
points into X; we can then check after the fact that indeed `X: Y`
holds.

This requires a bit of "blame" detection to find where the bad
constraint came from: we are currently using a pretty dumb
algorithm. Good place for later expansion.
2017-12-04 08:25:21 -05:00
Niko Matsakis
932452ecc7 separate out the liveness constraints from the final value
It will be useful later for diagnostics to be able to remember where
things were live.
2017-12-04 08:25:20 -05:00
bors
1a8282a9b4 Auto merge of #46486 - scottmcm:i128-target-option, r=nagisa
Add an i128_lowering flag in TargetOptions

Not actually enabled by default anywhere yet.

r? @nagisa

cc #45676 @est31
2017-12-04 12:38:27 +00:00
bors
c16f480fa6 Auto merge of #46485 - khuey:cursor-read_exact, r=Manishearth
Add a specialization of read_exact for Cursor.

The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy.  On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
2017-12-04 10:02:48 +00:00
Scott McMurray
1bc402fd80 Add an i128_lowering flag in TargetOptions
Not actually enabled by default anywhere yet.
2017-12-03 21:53:48 -08:00
Kyle Huey
02c1862fb5 Add a specialization of read_exact for Cursor.
The read_exact implementation for &[u8] is optimized and usually allows LLVM to reduce a read_exact call for small numbers of bytes to a bounds check and a register load instead of a generic memcpy.  On a workload I have that decompresses, deserializes (via bincode), and processes some data, this leads to a 40% speedup by essentially eliminating the deserialization overhead entirely.
2017-12-03 20:45:12 -08:00
bors
fdfbcf85d5 Auto merge of #46482 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #45957, #46260, #46432, #46442, #46454, #46462, #46465, #46473
- Failed merges:
2017-12-03 23:02:40 +00:00
Corey Farwell
48d38555e5 Rollup merge of #46473 - frewsxcv:frewsxcv-param-name, r=TimNN
Consistent parameter name for numeric ‘checked’ operations.

Some checked operations use `rhs` as a parameter name, and some use
`other`. For the sake of consistency, unify everything under the `rhs`
name.

Fixes https://github.com/rust-lang/rust/issues/46308.
2017-12-03 17:43:50 -05:00
Corey Farwell
909a8de953 Rollup merge of #46465 - nak3:fix-invalid-link, r=kennytm
Fix invalid link to lint_plugin_test.rs

The path to `lint_plugin_test.rs` was moved to `src/test/ui-fulldeps/`
from `src/test/run-pass-fulldeps/` in 38ef85696d

This patch updates it in the docs.
2017-12-03 17:43:49 -05:00
Corey Farwell
94dbbacd45 Rollup merge of #46462 - sinkuu:copyprop_reg2, r=arielb1
Fix CopyPropagation regression (2)

Remaining part of MIR copyprop regression by (I think) #45380, which I missed in #45753.

```rust
fn foo(mut x: i32) -> i32 {
    let y = x;
    x = 123; // `x` is assigned only once in MIR, but cannot be propagated to `y`
    y
}
```

So any assignment to an argument cannot be propagated.
2017-12-03 17:43:48 -05:00
Corey Farwell
7c4f74d16e Rollup merge of #46454 - GuillaumeGomez:search-overlap, r=QuietMisdreavus
Fix search results overlap

Fixes #46434.

r? @QuietMisdreavus
2017-12-03 17:43:47 -05:00
Corey Farwell
697c5ba0d9 Rollup merge of #46442 - est31:master, r=alexcrichton
Remove an unstable and dead compiler flag

The last use has been removed by commit fb9ca16b3b .
2017-12-03 17:43:46 -05:00
Corey Farwell
fcf1e73647 Rollup merge of #46432 - tromey:doc-fix-46307, r=estebank
Fix documentation for DecodeUtf16Error

Fixes #46307
2017-12-03 17:43:45 -05:00
Corey Farwell
b9ffbff959 Rollup merge of #46260 - ExpHP:builtin-macro-doc-sync, r=steveklabnik
Make doc stubs for builtin macros reflect existing support for trailing commas

This modifies the `macro_rules!` stubs in `std` for some of the compiler builtin macros in order to better reflect their currently supported grammar.  To my understanding these stubs have no impact on compiler output whatsoever, and only exist so that they may appear in the documentation.

P.S. It is in fact true that `env!` supports trailing commas while `option_env!` currently does not.  (I have another issue for this)

I don't imagine there's any way to automatically test these stubs, but I did *informally* test the new definitions on the playpen to see that they accept the desired invocations, as well as inspect the updated doc output.
2017-12-03 17:43:44 -05:00
Corey Farwell
82ee209492 Rollup merge of #45957 - dereckson:unix-agnosticity, r=shepmaster
Use more convenient and UNIX-agnostic shebang

When using bash-specific features, scripts using env to call bash
are more convenient, as bash be installed in different places
according the OS.
2017-12-03 17:43:43 -05:00
bors
1956d5535a Auto merge of #46435 - cuviper:min-llvm-3.9, r=rkruppe
Assume at least LLVM 3.9 in rustllvm and rustc_llvm

We bumped the minimum LLVM to 3.9 in #45326.  This just cleans up the conditional code in the `rustllvm` C++ wrappers to assume that minimum, and similarly cleans up the `rustc_llvm` build script.
2017-12-03 20:31:21 +00:00
bors
f2b11f30b2 Auto merge of #46393 - kennytm:45861-step-2-3-make-tools-job-not-fail-fast, r=alexcrichton
[auto-toolstate][2+3/8] Move external tools tests into its own job with --no-fail-fast

This PR performs these  things:

1. The `aux` job now performs "cargotest" and "pretty" tests. The clippy/rustfmt/rls/miri tests are moved into its own job.
2. These tests are run with `--no-fail-fast`, so that we can get the maximum number of failures of all tools from a single CI run.
3. The test results are stored into a JSON file, ready to be uploaded in the future.

This is step 2 and 3/8 of automatic management of broken tools #45861.
2017-12-03 18:01:29 +00:00
Corey Farwell
a2d87d83bf Consistent parameter name for numeric ‘checked’ operations.
Some checked operations use `rhs` as a parameter name, and some use
`other`. For the sake of consistency, unify everything under the `rhs`
name.

Fixes https://github.com/rust-lang/rust/issues/46308.
2017-12-03 11:24:00 -05:00
bors
0d11e51993 Auto merge of #46334 - mikhail-m1:slice_pattern_array_drop, r=arielb1
create a drop ladder for an array if any value is moved out

r? @arielb1
first commit for fix https://github.com/rust-lang/rust/issues/34708 (note: this still handles the subslice case in a very broken manner)
2017-12-03 15:31:32 +00:00
bors
9da2112238 Auto merge of #46320 - arielb1:always-resume, r=nikomatsakis
Always unwind through a Resume and other fixes

Should fix most of the small MIR borrowck issues.

r? @nikomatsakis
2017-12-03 13:01:47 +00:00
Ariel Ben-Yehuda
ff0b84df58 fix tests in wasm 2017-12-03 14:50:47 +02:00
kennytm
183964505b
Update the tools CI to use --no-fail-fast and --save-toolstates. 2017-12-03 18:36:56 +08:00
kennytm
971b1ba42b
Record build and test result of extended tools into toolstates.json. 2017-12-03 18:36:56 +08:00
kennytm
128199e39c
Move the swap the tools test and cargotest within check-aux.
The cargotest job is renamed to tools for clarification.
2017-12-03 18:36:56 +08:00
bors
d0ebb4dead Auto merge of #46433 - GuillaumeGomez:dedup-items, r=QuietMisdreavus
Fix deduplication of items

Fixes #45968.

r? @QuietMisdreavus
2017-12-03 10:33:15 +00:00
Kenjiro Nakayama
cac199fb27 Fix invalid link to lint_plugin_test.rs 2017-12-03 18:13:54 +09:00
Shotaro Yamada
17d6631c02 Fix MIR CopyPropagation regression 2017-12-03 17:42:52 +09:00
bors
0bae745cd8 Auto merge of #46290 - scottmcm:i128-from-compiler-builtins, r=nagisa
Update compiler-builtins and use it in the 128-bit lowering MIR test

This picks up the lang item implementations from https://github.com/rust-lang-nursery/compiler-builtins/pull/210

cc #45676 @est31 @nagisa
2017-12-03 07:42:31 +00:00
Scott McMurray
c0654ce815 Add ignore-emscripten too 2017-12-02 23:24:11 -08:00
bors
7e251390c7 Auto merge of #46428 - eddyb:scalar-pair-unpacking, r=arielb1
rustc: don't unpack newtypes of scalar-pairs with mismatched alignment.

This PR fixes a potential problem where a packed newtype of a pair was also considered a pair, even though it didn't have the required alignment of the pair.
cc @oli-obk It's possible miri hit something like this, with an unstable feature, but it's more general.
2017-12-03 05:14:24 +00:00
Scott McMurray
ad2a8e8356 Ignore the lower_128bit tests on asmjs 2017-12-02 20:21:50 -08:00
Scott McMurray
49ee16131e Remove the unneeded #![feature(lang_items)]s 2017-12-02 20:16:44 -08:00
Scott McMurray
d775d79a01 Update compiler-builtins and use it the 128-bit lowering MIR test 2017-12-02 20:16:44 -08:00
bors
16ba4591d7 Auto merge of #46384 - ollie27:rustdoc_inline_assoc, r=QuietMisdreavus
rustdoc: Fix issues with cross-crate inlined associated items

* Visibility was missing from impl items.
* Attributes and docs were missing from consts and types in impls.
* Const default values were missing from traits.

This unifies the code that handles associated items from impls and traits.
2017-12-03 00:54:52 +00:00
Ariel Ben-Yehuda
6594799b2d add and unignore tests 2017-12-03 02:47:44 +02:00
Ariel Ben-Yehuda
9dc396747b funnel all unwind paths through a single Resume block
This simplifies analysis and borrow-checking because liveness at the
resume point can always be simply propagated.

Later on, the "dead" Resumes are removed.
2017-12-03 02:47:44 +02:00
Ariel Ben-Yehuda
485476c25a add a pass to remove no-op landing pads 2017-12-03 02:47:44 +02:00
Ariel Ben-Yehuda
25416c7081 don't track borrows for empty regions
Region inference can create borrows for an empty region if the borrow is
dead. In that case, there's no reason to track the borrow, but because
there's no such thing as an EndRegion(ReEmpty) these borrows used to live
for the entire function.

Fixes #46161.
2017-12-03 02:29:04 +02:00
Ariel Ben-Yehuda
a6e24fc31f initialize the destination in unit statements
Fixes #46159.
2017-12-03 02:21:13 +02:00
Ariel Ben-Yehuda
af8c2339cf fix handling of borrows at a function's end 2017-12-03 02:21:13 +02:00
bors
088f328ec5 Auto merge of #46382 - alexcrichton:thinlto-default, r=michaelwoerister
rustc: Prepare to enable ThinLTO by default

This commit *almost* enables ThinLTO and multiple codegen units in release mode by
default but is blocked on #46346 now before pulling the trigger.
2017-12-02 22:27:24 +00:00
Guillaume Gomez
6afff9699a Fix search results overlap 2017-12-02 22:14:19 +01:00
bors
f9b0897c5d Auto merge of #46381 - estebank:expected-span, r=nikomatsakis
Point to next token when it is in the expected line

r? @nikomatsakis
2017-12-02 20:06:42 +00:00
Mikhail Modin
7be2fd853a create a drop ladder for an array if any value is moved out 2017-12-02 22:57:40 +03:00
bors
377decc352 Auto merge of #46368 - michaelwoerister:incr-comp-type-debuginfo-spans, r=eddyb
incr.comp.: Remove an unnecessary HIR access which enables hashing spans for type definitions.

r? @nikomatsakis
2017-12-02 17:37:56 +00:00
bors
9053fdd411 Auto merge of #46349 - estebank:highlight-ref, r=arielb1
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
2017-12-02 15:08:08 +00:00
est31
60a842f529 Remove an unstable and dead compiler flag
The last use has been removed by commit fb9ca16b3b .
2017-12-02 13:56:32 +01:00
bors
7a649872a9 Auto merge of #46347 - raventid:did-you-mean-increase-accuracy, r=estebank
Add case insensitive comparison, besides Levenstein for DYM

Closes #46332

Draft version. The idea is that Levenstein does not work for some cases when we have multiple equal weights for strings. I didn't understand the case with `if found != name => Some(found)` so it means that new code does not work correctly yet.

At least now I think that we might return all maximal weights from levenstein and think about next cases in priority order:

1) There is exact match -> None
2) There is exact match, but case insensitive -> Some(match)
3) There is some match from levenstein -> Some(matches.take_any)
4) There is no match -> None

@estebank WDYT?
2017-12-02 12:42:54 +00:00
Guillaume Gomez
dddf183333 Move colors to main.css 2017-12-02 13:25:23 +01:00
bors
e0d11f39d8 Auto merge of #46343 - jseyfried:fix_hygiene_bug, r=nrc
Fix hygiene bug.

Fixes #42708.
r? @nrc
2017-12-02 10:15:21 +00:00
bors
8bcbf91a86 Auto merge of #46326 - GuillaumeGomez:sidebar-text, r=QuietMisdreavus
Fix invalid HTML escape

Fixes #46289.

r? @QuietMisdreavus
2017-12-02 07:49:32 +00:00
bors
c3942e751c Auto merge of #46288 - alexcrichton:bump-bootstrap, r=Mark-Simulacrum
Bump to 1.24.0

* Update the in-tree version number
* Update the bootstrap compiler
* Remove `cfg(stage0)` annotations
* Update crate dependencies
* Update Cargo itself
2017-12-02 05:21:58 +00:00
bors
b15a8eafcd Auto merge of #46256 - estebank:suggest-deref, r=arielb1
Use suggestions instead of notes ref mismatches

On type mismatch errors, use a suggestion when encountering minimal
differences in type differences due to refs, instead of a note.
2017-12-02 02:56:16 +00:00
Sébastien Santoro
a4b4a73328 Use more convenient and UNIX-agnostic shebang
When using bash-specific features, scripts using env to call bash
are more convenient, as bash be installed in different places
according the OS.

Same applies for other languages' interpreters.
2017-12-02 01:03:59 +00:00
bors
ddaebe938b Auto merge of #45904 - sunjay:gat-parser, r=nikomatsakis
Generic Associated Types Parsing & Name Resolution

Hi!
This PR adds parsing for generic associated types! 🎉 🎉 🎉

Tracking Issue: #44265

## Notes For Reviewers
* [x] I still need to add the stdout and stderr files to my ui tests. It takes me a *long* time to compile the compiler locally, so I'm going to add this as soon as possible in the next day or so.
* [ ] My current ui tests aren't very good or very thorough. I'm reusing the `parse_generics` and `parse_where_clause` methods from elsewhere in the parser, so my changes work without being particularly complex. I'm not sure if I should duplicate all of the generics test cases for generic associated types. It might actually be appropriate to duplicate everything here, since we don't want to rely on an implementation detail in case it changes in the future. If you think so too, I'll adapt all of the generics test cases into the generic associated types test cases.
* [ ] There is still more work required to make the run-pass tests pass here. In particular, we need to make the following errors disappear:
```
error[E0110]: lifetime parameters are not allowed on this type
  --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:23:41
   |
23 |     bar: <T as StreamingIterator>::Item<'static>,
   |                                         ^^^^^^^ lifetime parameter not allowed on this type
```
```
error[E0261]: use of undeclared lifetime name `'a`
  --> ./src/test/run-pass/rfc1598-generic-associated-types/iterable.rs:15:47
   |
15 |     type Iter<'a>: Iterator<Item = Self::Item<'a>>;
   |                                               ^^ undeclared lifetime
```
There is a FIXME comment in streaming_iterator. If you uncomment that line, you get the following:
```
error: expected one of `!`, `+`, `,`, `::`, or `>`, found `=`
  --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:29:45
   |
29 | fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ }
   |                                             ^ expected one of `!`, `+`, `,`, `::`, or `>` here
```

r? @nikomatsakis
2017-12-02 00:15:19 +00:00
Josh Stone
5c4452aaaf rustc_llvm: Assume at least LLVM 3.9 in build.rs 2017-12-01 14:37:23 -08:00
Josh Stone
51342f1fd7 rustllvm: Remove conditional code for LLVM < 3.9
We bumped the minimum LLVM to 3.9 in #45326.  This just cleans up the
conditional code in the rustllvm C++ wrappers to assume at least 3.9.
2017-12-01 14:37:23 -08:00
Eduard-Mihai Burtescu
d455955445 rustc: don't unpack newtypes of scalar-pairs with mismatched alignment. 2017-12-02 00:29:56 +02:00
bors
70517540da Auto merge of #46430 - kennytm:rollup, r=kennytm
Rollup of 13 pull requests

- Successful merges: #45880, #46280, #46373, #46376, #46385, #46386, #46387, #46392, #46400, #46401, #46405, #46412, #46421
- Failed merges:
2017-12-01 21:29:27 +00:00
Guillaume Gomez
30734c4e68 Fix deduplication of items 2017-12-01 20:55:25 +01:00
Tobias Bucher
e1e1dcc8d8 Changed the wording for the warnings lint 2017-12-01 20:28:01 +01:00
bors
bb42071f63 Auto merge of #46425 - eddyb:mir-place, r=nikomatsakis
MIR: change "lvalue" terminology to "place".

As pointed out elsewhere, "lvalue" vs "rvalue" is a misleading/obscure distinction and several other choices have been proposed, the one I prefer being "place" vs "value".

This PR only touches the "lvalue" side, and only in MIR-related code, as it's already a lot and could rot.
2017-12-01 18:48:20 +00:00
Esteban Küber
36faafee8d Use suggestions instead of notes ref mismatches
On type mismatch errors, use a suggestion when encountering minimal
differences in type differences due to refs, instead of a note.
2017-12-01 10:44:29 -08:00
Tom Tromey
47acc4bd84 Fix documentation for DecodeUtf16Error
Fixes #46307
2017-12-01 11:33:42 -07:00
kennytm
5617477502 Rollup merge of #46421 - mnd:fix-build-for-guix, r=alexcrichton
build_helper: destination file can't be up to date when not exists

Function "up_to_date" return incorrect result if mtime for all fetched sources is set to epoch time. Add existence check to function.

This fix required for a [Guix](https://www.gnu.org/software/guix/) package because a Nix builder set mtime of all sources to epoch time.
2017-12-02 01:39:04 +08:00
kennytm
662f902746 Rollup merge of #46412 - chrisduerr:issue-46380, r=QuietMisdreavus
Hide private trait type params and show hidden items with document-private

As discussed in #46380, this PR removes the `strip-hidden` pass from `--document-private-items` which allows showing `#[doc(hidden)]` with rustdoc.

The second commit removes the trait implementation from the docs if the trait's parameter is private.
2017-12-02 01:39:03 +08:00
kennytm
3f99b7c993 Rollup merge of #46405 - alexcrichton:fix-rustdoc, r=estebank
rustc: Filter out bogus extern crate warnings

Rustdoc has for some time now used the "everybody loops" pass in the compiler to
avoid typechecking and otherwise avoid looking at implementation details.
In #46115 the placement of this pass was pushed back in the compiler to after
macro expansion to ensure that it works with macro-expanded code as well. This
in turn caused the regression in #46271.

The bug here was that the resolver was producing `def_id` instances for
"possibly unused extern crates" which would then later get processed during
typeck to actually issue lint warnings. The problem was that *after* resolution
these `def_id` nodes were actually removed from the AST by the "everybody loops"
pass. This later, when we tried to take a look at `def_id`, caused the compiler
to panic.

The fix applied here is a bit of a heavy hammer which is to just, in this one
case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way
(basically if it looks like the node was removed after resolution). The real
underlying bug here is probably that the "everybody loops" AST pass is being
stressed to much beyond what it was originally intended to do, but this should
at least fix the ICE for now...

Closes #46271
2017-12-02 01:39:02 +08:00
kennytm
bd5a4af5cd Rollup merge of #46401 - alexcrichton:wasm-tests, r=arielb1
wasm: Update LLVM to fix a test

This commit updates LLVM with some tweaks to the integer <-> floating point
conversion instructions to ensure that `as` in Rust doesn't trap.

Closes #46298
2017-12-02 01:39:01 +08:00
kennytm
b86a47f860 Rollup merge of #46400 - michaelwoerister:vtable-encodable, r=eddyb
incr.comp.: Make traits::VTable encodable and decodable.

Make vtables encodable so we can cache the `trans_fulfill_obligation` query at some point.

r? @eddyb
2017-12-02 01:39:00 +08:00
kennytm
edaec072b9 Rollup merge of #46392 - GuillaumeGomez:fix-tooltip, r=QuietMisdreavus
Invert colors in important traits tooltip

Part of #46352.

r? @QuietMisdreavus
2017-12-02 01:38:59 +08:00
kennytm
bc8e8fabbf Rollup merge of #46387 - chrisduerr:master, r=QuietMisdreavus
Fix rustdoc item summaries that are headers

Rustoc item summaries that are headers were not displayed at all because
they started with whitespace.

This PR fixes this and now removes the whitespace and then displays the
block.

I'm not sure if the rustdoc test is written correctly, if there's anything to improve, just let me know. :)

This fixes #46377.

This is how it looks when rendered out now:
![Rendered](https://i.imgur.com/7u8jUAM.png)
2017-12-02 01:38:58 +08:00
kennytm
ae24366251 Rollup merge of #46386 - Aaron1011:fix_rustdoc_log, r=Mark-Simulacrum
Remove librustdoc dependency on env_logger

We want librustdoc to pickup the env_logger dependency from
the sysroot. This ensures that the same copy of env_logger is used
for both internal crates (e.g. librustc_driver, libsyntax) and
librustdoc

Closes #46383
2017-12-02 01:38:57 +08:00
kennytm
2341f6c4e5 Rollup merge of #46385 - alexcrichton:fix-cargo-book, r=Mark-Simulacrum
rustbuild: Fix a typo with the Cargo book

The usage of `Path::new` prevented out-of-tree builds (like the bots do) from
working by accident!

Closes #46195
2017-12-02 01:38:56 +08:00
kennytm
613da5c1f4 Rollup merge of #46376 - SimonSapin:cargoup, r=kennytm
Update Cargo to Wed Nov 29 15:19:05 2017 +0000

5bb478a518

Pick up `workspace.default-members` support: https://github.com/rust-lang/cargo/pull/4743
2017-12-02 01:38:55 +08:00
kennytm
9493d4b95c Rollup merge of #46373 - jakllsch:netbsd-kern_proc_pathname, r=kennytm
NetBSD: add sysctl backend for std::env::current_exe

Use the CTL_KERN.KERN_PROC_ARGS.-1.KERN_PROC_PATHNAME sysctl in
preference over the /proc/curproc/exe symlink.

Additionally, perform more validation of aformentioned symlink.
Particularly on pre-8.x NetBSD this symlink will point to '/' when
accurate information is unavailable.
2017-12-02 01:38:54 +08:00
kennytm
263eb4d7ef Rollup merge of #46280 - tamird:remove-old-refs, r=alexcrichton
rustc_llvm: remove stale references

...that were removed in 77c3bfa742.

r? @alexcrichton
2017-12-02 01:38:53 +08:00
kennytm
95f465d535 Rollup merge of #45880 - arielb1:never-coerce, r=nikomatsakis
make coercions to `!` in unreachable code a hard error

This was added to cover up a lazy extra semicolon in #35849, but does
not actually make sense. This is removed as a part of the stabilization
of `never_type`.
2017-12-02 01:38:52 +08:00
Eduard-Mihai Burtescu
473f044225 MIR: s/lv(al(ue)?)?/place in function/variable/module names. 2017-12-01 18:48:57 +02:00
Eduard-Mihai Burtescu
511743c438 MIR: s/Lvalue/Place in type names. 2017-12-01 18:47:36 +02:00
bors
6805b016ef Auto merge of #46338 - michaelwoerister:lazy-diagnostics, r=nikomatsakis
incr.comp.: Load cached diagnostics lazily and allow more things in the cache.

This PR implements makes two changes:
1. Diagnostics are loaded lazily from the incr. comp. cache now. This turned out to be necessary for correctness because diagnostics contain `Span` values and deserializing those requires that the source file they point to is still around in the current compilation session. Obviously this isn't always the case. Loading them lazily allows for never touching diagnostics that are not valid anymore.
2. The compiler can now deal with there being no cache entry for a given query invocation. Before, all query results of a cacheable query were always expected to be present in the cache. Now, the compiler can fall back to re-computing the result if there is no cache entry found. This allows for caching things that we cannot force from dep-node (like the `symbol_name` query). In such a case we'll just have a "best effort" caching strategy.

~~This PR is based on https://github.com/rust-lang/rust/pull/46301 (=first 2 commits), so please don't merge until that has landed. The rest of the commits are ready for review though.~~

r? @nikomatsakis
2017-12-01 16:01:22 +00:00
Michael Woerister
8129c53958 incr.comp.: Incorporate the stable commandline arg hash and SVHs of upstream crates in the SVH. 2017-12-01 15:56:37 +01:00
Michael Woerister
966eead9ec incr.comp.: Fix merge fallout. 2017-12-01 14:29:20 +01:00
bors
e3ed21272d Auto merge of #46236 - davidtwco:issue-46023, r=arielb1
MIR-borrowck: immutable unique closure upvars can be mutated

Fixes #46023 and #46160 (see [this comment](https://github.com/rust-lang/rust/pull/46236#issuecomment-347204874)).
2017-12-01 13:26:10 +00:00
Michael Woerister
410f8509b5 incr.comp.: Use the awesome new '_ in a few places. 2017-12-01 13:48:59 +01:00
Michael Woerister
c531d9f733 incr.comp.: Allow for recovering from missing on-disk cache entries. 2017-12-01 13:48:59 +01:00
Michael Woerister
059bd80526 incr.comp.: Load diagnostics from previous session lazily and clean up on-disk-cache persistence code. 2017-12-01 13:48:59 +01:00
Michael Woerister
64e109327d incr.comp.: Add a newtype for byte positions within the incr. comp. cache. 2017-12-01 13:48:19 +01:00
Michael Woerister
45439945c9 incr.comp.: Store Spans as (file,line,col,length) in incr.comp. cache.
The previous method ran into problems because ICH would treat Spans
as (file,line,col) but the cache contained byte offsets and its
possible for the latter to change while the former stayed stable.
2017-12-01 13:48:19 +01:00
Michael Woerister
409e39285d incr.comp.: Properly hash and encode macro expansion information. 2017-12-01 13:48:19 +01:00
Nikolay Merinov
f2df1f5ec6 build_helper: destination file can't be up to date when not exists
Function "up_to_date" return incorrect result if mtime for all fetched
sources is set to epoch time. Add existence check to function.
2017-12-01 14:55:02 +05:00
bors
315fbf7518 Auto merge of #46211 - snipsco:master, r=pnkfelix
disable jemalloc on executables for ios targets

This is a (temporary ?) workaround for issue #45262
2017-12-01 08:44:42 +00:00
Julian Kulesh
f18446e78d add magic comment for ui test, remove newline 2017-12-01 11:38:30 +03:00
Sunjay Varma
9d5592b436 Updated generic-associated-types-where stderr 2017-12-01 01:26:29 -05:00
Sunjay Varma
f0ecdfb1ab Added case for when impl generic associated type has a where clause 2017-12-01 01:26:29 -05:00
Sunjay Varma
fdf6c652ce Moved all of the tests over to ui and annotated why they are failing with appropriate fixme comments 2017-12-01 01:26:29 -05:00
Sunjay Varma
db4408a3ce Removed FIXME on a line that actually works for some reason... 2017-12-01 01:26:29 -05:00
Sunjay Varma
cc52e412f8 Adding error line so that test passes 2017-12-01 01:26:29 -05:00
Sunjay Varma
3bac9ff386 added must-compile-successfully 2017-12-01 01:26:29 -05:00
Sunjay Varma
38c2a73017 Testing and fixes 2017-12-01 01:26:29 -05:00
Sunjay Varma
1c023b3cec Renaming MethodRibKind to TraitOrImplItemRibKind and removing its field which was never used. Lifting the HasTypeParameters rib to all trait item kinds and all impl item kinds 2017-12-01 01:26:29 -05:00
Sunjay Varma
e0621a1786 Adding type paramter ribs for generic associated types 2017-12-01 01:26:29 -05:00
Sunjay Varma
4a69ce99fa Preventing moving out of the trait item kind 2017-12-01 01:26:29 -05:00
Sunjay Varma
223d091744 Parsing where clauses correctly and documenting the grammar being parsed 2017-12-01 01:26:29 -05:00
Sunjay Varma
c2aaba9b44 Specifically gating generic_associated_types feature on associated Type declarations 2017-12-01 01:26:29 -05:00
Niko Matsakis
e565b5bbdd demonstrate how we can write "successful parse" tests quite easily 2017-12-01 01:26:29 -05:00
Sunjay Varma
1b196fa324 Added stderr files for ui tests 2017-12-01 01:26:29 -05:00
Sunjay Varma
332a3cb169 More testing for generic associated types parsing 2017-12-01 01:26:29 -05:00
Sunjay Varma
83efebc539 Fixed tidy errors 2017-12-01 01:26:29 -05:00
Sunjay Varma
f29613437f Adding feature gate 2017-12-01 01:26:29 -05:00
Sunjay Varma
6bd8ea1a6b Added run-pass tests for associated generic types 2017-12-01 01:24:53 -05:00
Sunjay Varma
19e25b61d1 Parsing generics in both trait items and impl items 2017-12-01 01:24:53 -05:00
bors
d1364a65c0 Auto merge of #45997 - estebank:pub-ident, r=nikomatsakis
Account for missing keyword in fn/struct definition

Fix #38911.
2017-12-01 06:06:06 +00:00
Liigo Zhuang
9e281cc6a5 doc: macro cfg! evaluating at compile-time 2017-12-01 13:32:56 +08:00
bors
804b15be82 Auto merge of #45846 - pietroalbini:use-nested-groups, r=petrochenkov
Add nested groups in imports

This PR adds support for nested groups in imports (rust-lang/rfcs#2128, tracking issue #44494).

r? @petrochenkov
2017-12-01 03:25:54 +00:00
bors
d8a60c9611 Auto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddyb
incr.comp.: Remove ability to produce incr. comp. hashes during metadata export.

This functionality has been superseded by on-import hashing, which can be less conservative and does not require extra infrastructure.

r? @nikomatsakis
2017-12-01 00:46:08 +00:00
David Wood
c6b1ba56d7
Fixed spurious cannot borrow immutable item error with a closure. 2017-11-30 23:19:06 +00:00
David Wood
dedbb4edd1
Immutable unique closure upvars cannot be mutated. 2017-11-30 23:18:38 +00:00
David Wood
c3459b0c9c
Added test for spurious cannot borrow immutable item error with a closure 2017-11-30 23:16:17 +00:00
David Wood
347f631325
Added test for immutable unique closure upvar mutation. 2017-11-30 23:15:10 +00:00
Mathieu Poumeyrol
3b18e29d2c explanatory note for the workaround 2017-11-30 23:14:29 +01:00
Julian Kulesh
537f2a6e1e move comparator into +find_best_match_name+ function 2017-12-01 00:39:47 +03:00
Christian Duerr
5f47c7f531
Fix htmldocck naming
After renaming the structs and enums the htmldocck strings still
contained the old names. This lead to test failure.

These htmldocck tests have been updated to use the proper names of the
rust structs and traits.
2017-11-30 21:43:21 +01:00
Christian Duerr
1df13c057a
Hide trait impl with private trait type parameter
Trait's implementations with private type parameters were displayed in
the implementing struct's documentation until now.

With this change any trait implementation that uses a private type
parameter is now hidden in the docs.
2017-11-30 21:18:36 +01:00
Christian Duerr
ec337b613e
Show hidden items with rustdoc's document-private
When using `#[doc(hidden)]` elements are hidden from docs even when the
rustdoc flag `--document-private-items` is set.

This behavior has been changed to display all hidden items when the flag
is active.
2017-11-30 21:18:00 +01:00
Jonathan A. Kollasch
ccef9696f1 NetBSD: add sysctl backend for std::env::current_exe
Use the CTL_KERN.KERN_PROC_ARGS.-1.KERN_PROC_PATHNAME sysctl in
preference over the /proc/curproc/exe symlink.

Additionally, perform more validation of aformentioned symlink.
Particularly on pre-8.x NetBSD this symlink will point to '/' when
accurate information is unavailable.
2017-11-30 12:17:44 -06:00
Alex Crichton
4e74eb5ba0 rustc: Filter out bogus extern crate warnings
Rustdoc has for some time now used the "everybody loops" pass in the compiler to
avoid typechecking and otherwise avoid looking at implementation details.
In #46115 the placement of this pass was pushed back in the compiler to after
macro expansion to ensure that it works with macro-expanded code as well. This
in turn caused the regression in #46271.

The bug here was that the resolver was producing `def_id` instances for
"possibly unused extern crates" which would then later get processed during
typeck to actually issue lint warnings. The problem was that *after* resolution
these `def_id` nodes were actually removed from the AST by the "everybody loops"
pass. This later, when we tried to take a look at `def_id`, caused the compiler
to panic.

The fix applied here is a bit of a heavy hammer which is to just, in this one
case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way
(basically if it looks like the node was removed after resolution). The real
underlying bug here is probably that the "everybody loops" AST pass is being
stressed to much beyond what it was originally intended to do, but this should
at least fix the ICE for now...

Closes #46271
2017-11-30 08:03:04 -08:00
Oliver Schneider
9e062c85bb
Report a targeted note for generic parameters 2017-11-30 16:33:27 +01:00
Alex Crichton
855f6d1483 rustc: Prepare to enable ThinLTO by default
This commit prepares to enable ThinLTO and multiple codegen units in release
mode by default. We've still got a debuginfo bug or two to sort out before
actually turning it on by default.
2017-11-30 07:17:53 -08:00
Alex Crichton
7df4683cc0 Rename long test names to be a bit shorter
Helps to avoid hitting path limits on Windows
2017-11-30 07:14:10 -08:00
Alex Crichton
01c47c2545 rustc: Tweak the isExported callback for ThinLTO
Previously we were too eagerly exporting almost all symbols used in ThinLTO
which can cause a whole host of problems downstream! This commit instead fixes
this error by aligning more closely with `lib/LTO/LTO.cpp` in LLVM's codebase
which is to only change the linkage of summaries which are computed as dead.

Closes #46374
2017-11-30 07:14:10 -08:00
Oliver Schneider
208deac1c9
Reenable clippy 2017-11-30 16:12:24 +01:00
Oliver Schneider
12697fa998
Remove unused method from TyS 2017-11-30 16:11:27 +01:00
Michael Woerister
780f4ed882 incr.comp.: Make traits::VTable encodable and decodable. 2017-11-30 14:53:35 +01:00
Alex Crichton
666bb90300 wasm: Update LLVM to fix a test
This commit updates LLVM with some tweaks to the integer <-> floating point
conversion instructions to ensure that `as` in Rust doesn't trap.

Closes #46298
2017-11-30 05:39:57 -08:00
Ariel Ben-Yehuda
5a00b7cb74 make coercions to ! in unreachable code a hard error
This was added to cover up a lazy extra semicolon in #35849, but does
not actually make sense. This is removed as a part of the stabilization
of `never_type`.
2017-11-30 15:18:25 +02:00
Pietro Albini
f7f69512c8
Mark rustfmt and rls as broken 2017-11-30 13:24:59 +01:00
Pietro Albini
91ba8b42fc
Implement RFC 2128 (use_nested_groups)
This commit adds support for nested groups inside `use` declarations,
such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-30 13:10:26 +01:00
bors
4fa202d23b Auto merge of #46299 - michaelwoerister:incr-comp-krimskrams, r=nikomatsakis
incr.comp.: Some preparatory work for caching more query results.

This PR
* adds and updates some encoding/decoding routines for various query result types so they can be cached later, and
* adds missing `[input]` annotations for a few `DepNode` variants.

The situation around having to explicitly mark dep-nodes/queries as inputs is not really satisfactory. I hope we can find a way of making this more fool-proof in the future.

r? @nikomatsakis
2017-11-30 10:57:21 +00:00
Simon Sapin
2544b9fbf0 Update Cargo to Wed Nov 29 15:19:05 2017 +0000
5bb478a518

Pick up `workspace.default-members` support:
https://github.com/rust-lang/cargo/pull/4743
2017-11-30 09:02:23 +01:00
bors
d6b010f98b Auto merge of #46226 - arielb1:special-region-obligation, r=nikomatsakis
avoid type-live-for-region obligations on dummy nodes

Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes #46069.

Beta-nominating because this is a regression for our new beta.
r? @nikomatsakis
2017-11-30 08:00:27 +00:00
bors
909b94b5cc Auto merge of #46041 - zilbuz:issue-44837, r=arielb1
MIR borrowck: finalize `check_access_permissions()`

Fix #44837 (hopefully for good)

r? @arielb1
2017-11-30 05:26:28 +00:00
Alex Crichton
a850bb0e5d Update bootstrap compiler
Also remove a number of `stage0` annotations and such
2017-11-29 21:11:20 -08:00
Christian Duerr
91a4106911
Fix rustoc item summaries that are headers
Rustoc item summaries that are headers were not displayed at all because
they started with whitespace.

This PR fixes this and now removes the whitespace and then displays the
block.
2017-11-30 00:28:59 +01:00
Aaron Hill
21228a82b0
Remove librustdoc dependency on env_logger
We want librustdoc to pickup the env_logger dependency from
the sysroot. This ensures that the same copy of env_logger is used
for both internal crates (e.g. librustc_driver, libsyntax) and
librustdoc

Closes #46383
2017-11-29 18:10:42 -05:00
Alex Crichton
326eb79cf6 rustbuild: Fix a typo with the Cargo book
The usage of `Path::new` prevented out-of-tree builds (like the bots do) from
working by accident!

Closes #46195
2017-11-29 15:00:52 -08:00
bors
74bc14d0fe Auto merge of #46144 - nrc:rls-update, r=alexcrichton
Update RLS and Rustfmt

r? @alexcrichton
2017-11-29 22:41:05 +00:00
Oliver Middleton
b4448435f9 rustdoc: Fix issues with cross-crate inlined associated items
* Visibility was missing from impl items.
* Attributes and docs were missing from consts and types in impls.
* Const default values were missing from traits.

This unifies the code that handles associated items from impls and traits.
2017-11-29 22:05:38 +00:00
Esteban Küber
fe89740957 Point to next token when it is in the expected line 2017-11-29 13:28:47 -08:00
John-John Tedro
9bea79bd5e Fix use of rand in liballoc benches 2017-11-29 20:14:52 +01:00
Guillaume Gomez
35f5be6646 Fix invalid HTML escape 2017-11-29 19:33:04 +01:00
Guillaume Gomez
c00ba79f5c Invert colors in important traits tooltip 2017-11-29 19:23:41 +01:00
Esteban Küber
02808f1e9e Include lifetime on highlighted ref type mismatch 2017-11-29 08:55:45 -08:00
Michael Woerister
7ebccbb7a4 incr.comp.: Update test cases after metadata hashing removal. 2017-11-29 16:29:13 +01:00
Michael Woerister
c60b0e43c8 incr.comp.: Remove on-export crate metadata hashing. 2017-11-29 16:28:25 +01:00
Michael Woerister
89dc8ae205 incr.comp.: Remove an unnecessary HIR access which enables hashing spans for type definitions. 2017-11-29 15:24:18 +01:00
Simon Sapin
7e2f756583 Generalize fs::write from &[u8] to AsRef<[u8]> 2017-11-29 13:49:35 +01:00
kennytm
51bd916af4 Rollup merge of #46356 - daboross:patch-2, r=sfackler
Reject '2' as a binary digit in internals of b: number formatting

The `radix!` macro generates an implementation of the private trait `GenericRadix`, and the code replaced changes Binary's implementation to no longer accept '2' as a valid digit to print.

Granted, this code is literally only ever called from another method in this private trait, and that method has logic to never hand a '2' to the printing function. Even given this, the code's there, I thought it would be best to fix this for clarity of anyone reading it.
2017-11-29 18:37:54 +08:00
kennytm
30f1853649 Rollup merge of #46323 - ia0:fix_mpsc_error_conv, r=kennytm
Fix since for mpsc_error_conversions

This is a followup of #45506.
2017-11-29 18:37:51 +08:00
kennytm
a19c13a698 Rollup merge of #46322 - gnzlbg:mmx, r=alexcrichton
white list MMX and MSA target features

r? @alexcrichton
2017-11-29 18:37:50 +08:00
kennytm
fc9abbd7b7 Rollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushi
impl From<bool> for AtomicBool

This seems like an obvious omission from #45610. ~~I've used the same feature name and version in the hope that this can be backported to beta so it's stabilized with the other impls. If it can't be I'll change it to `1.24.0`.~~
2017-11-29 18:37:50 +08:00
kennytm
0e78c29bea Rollup merge of #46287 - SimonSapin:stable-constness, r=aturon
Stabilize const-calling existing const-fns in std

Fixes #46038
2017-11-29 18:37:47 +08:00
kennytm
6006c0f35f Rollup merge of #46219 - rust-lang:frewsxcv-issue-45636, r=GuillaumeGomez
Improve documentation for slice swap/copy/clone operations.

Fixes #45636.

- Demonstrate how to use these operations with slices of differing
  lengths
- Demonstrate how to swap/copy/clone sub-slices of a slice using
  `split_at_mut`
2017-11-29 18:37:45 +08:00
kennytm
963ab91dd4 Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichton
Stabilize some `ascii_ctype` methods

As discussed in #39658, this PR stabilizes those methods for `u8` and `char`. All inherent `ascii_ctype` for `[u8]` and `str` are removed as we prefer the more explicit version `s.chars().all(|c| c.is_ascii_())`.

This PR doesn't modify the `AsciiExt` trait. There, the `ascii_ctype` methods are still unstable. It is planned to remove those in the future (I think). I had to modify some code in `ascii.rs` to properly implement `AsciiExt` for all types.

Fixes #39658.
2017-11-29 18:37:44 +08:00
kennytm
0ec3aee569 Rollup merge of #45969 - ia0:mpsc_recv_deadline, r=alexcrichton
Add std::sync::mpsc::Receiver::recv_deadline()

Essentially renames recv_max_until to recv_deadline (mostly copying recv_timeout
documentation). This function is useful to avoid the often unnecessary call to
Instant::now in recv_timeout (e.g. when the user already has a deadline). A
concrete example would be something along those lines:

```rust
use std::sync::mpsc::Receiver;
use std::time::{Duration, Instant};

/// Reads a batch of elements
///
/// Returns as soon as `max_size` elements have been received or `timeout` expires.
fn recv_batch_timeout<T>(receiver: &Receiver<T>, timeout: Duration, max_size: usize) -> Vec<T> {
    recv_batch_deadline(receiver, Instant::now() + timeout, max_size)
}

/// Reads a batch of elements
///
/// Returns as soon as `max_size` elements have been received or `deadline` is reached.
fn recv_batch_deadline<T>(receiver: &Receiver<T>, deadline: Instant, max_size: usize) -> Vec<T> {
    let mut result = Vec::new();
    while let Ok(x) = receiver.recv_deadline(deadline) {
        result.push(x);
        if result.len() == max_size {
            break;
        }
    }
    result
}
```
2017-11-29 18:37:43 +08:00
Nick Cameron
1cec22e157 Update Rustfmt again 2017-11-29 20:34:06 +13:00