]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #59390 - czipperz:ptr_eq_smart_pointer, r=Centril,steveklabnik
Josh Stone [Thu, 28 Mar 2019 01:15:30 +0000 (18:15 -0700)]
Rollup merge of #59390 - czipperz:ptr_eq_smart_pointer, r=Centril,steveklabnik

Make `ptr::eq` documentation mention fat-pointer behavior

Resolves #59214

5 years agoRollup merge of #59372 - euclio:rename-trim, r=rkruppe
Josh Stone [Thu, 28 Mar 2019 01:15:28 +0000 (18:15 -0700)]
Rollup merge of #59372 - euclio:rename-trim, r=rkruppe

add rustfix-able suggestions to trim_{left,right} deprecations

Fixes #53802 (technically already fixed by #58002, but that issue is about these methods).

5 years agoRollup merge of #59284 - RalfJung:maybe-uninit, r=sfackler
Josh Stone [Thu, 28 Mar 2019 01:15:27 +0000 (18:15 -0700)]
Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfackler

adjust MaybeUninit API to discussions

uninitialized -> uninit
into_initialized -> assume_init
read_initialized -> read
set -> write

5 years agoRollup merge of #59283 - SimonSapin:branchless-ascii-case, r=joshtriplett
Josh Stone [Thu, 28 Mar 2019 01:15:25 +0000 (18:15 -0700)]
Rollup merge of #59283 - SimonSapin:branchless-ascii-case, r=joshtriplett

Make ASCII case conversions more than 4× faster

Reformatted output of `./x.py bench src/libcore --test-args ascii` below. The `libcore` benchmark calls `[u8]::make_ascii_lowercase`. `lookup` has code (effectively) identical to that before this PR, and ~~`branchless`~~ `mask_shifted_bool_match_range` after this PR.

~~See [code comments](https://github.com/rust-lang/rust/pull/59283/commits/ce933f77c865a15670855ac5941fe200752b739f#diff-01076f91a26400b2db49663d787c2576R3796) in `u8::to_ascii_uppercase` in `src/libcore/num/mod.rs` for an explanation of the branchless algorithm.~~

**Update:** the algorithm was simplified while keeping the performance. See `branchless` v.s. `mask_shifted_bool_match_range` benchmarks.

Credits to @raphlinus for the idea in https://twitter.com/raphlinus/status/1107654782544736261, which extends this algorithm to “fake SIMD” on `u32` to convert four bytes at a time. The `fake_simd_u32` benchmarks implements this with [`let (before, aligned, after) = bytes.align_to_mut::<u32>()`](https://doc.rust-lang.org/std/primitive.slice.html#method.align_to_mut). Note however that this is buggy when addition carries/overflows into the next byte (which does not happen if the input is known to be ASCII).

This could be fixed (to optimize `[u8]::make_ascii_lowercase` and `[u8]::make_ascii_uppercase` in `src/libcore/slice/mod.rs`) either with some more bitwise trickery that I didn’t quite figure out, or by using “real” SIMD intrinsics for byte-wise addition. I did not pursue this however because the current (incorrect) fake SIMD algorithm is only marginally faster than the one-byte-at-a-time branchless algorithm. This is because LLVM auto-vectorizes the latter, as can be seen on https://rust.godbolt.org/z/anKtbR.

Benchmark results on Linux x64 with Intel i7-7700K: (updated from https://github.com/rust-lang/rust/pull/59283#issuecomment-474146863)

```rust
6830 bytes string:

alloc_only                          ... bench:    112 ns/iter (+/- 0) = 62410 MB/s
black_box_read_each_byte            ... bench:  1,733 ns/iter (+/- 8) = 4033 MB/s
lookup_table                        ... bench:  1,766 ns/iter (+/- 11) = 3958 MB/s
branch_and_subtract                 ... bench:    417 ns/iter (+/- 1) = 16762 MB/s
branch_and_mask                     ... bench:    401 ns/iter (+/- 1) = 17431 MB/s
branchless                          ... bench:    365 ns/iter (+/- 0) = 19150 MB/s
libcore                             ... bench:    367 ns/iter (+/- 1) = 19046 MB/s
fake_simd_u32                       ... bench:    361 ns/iter (+/- 2) = 19362 MB/s
fake_simd_u64                       ... bench:    361 ns/iter (+/- 1) = 19362 MB/s
mask_mult_bool_branchy_lookup_table ... bench:  6,309 ns/iter (+/- 19) = 1107 MB/s
mask_mult_bool_lookup_table         ... bench:  4,183 ns/iter (+/- 29) = 1671 MB/s
mask_mult_bool_match_range          ... bench:    339 ns/iter (+/- 0) = 20619 MB/s
mask_shifted_bool_match_range       ... bench:    339 ns/iter (+/- 1) = 20619 MB/s

32 bytes string:

alloc_only                          ... bench:     15 ns/iter (+/- 0) = 2133 MB/s
black_box_read_each_byte            ... bench:     29 ns/iter (+/- 0) = 1103 MB/s
lookup_table                        ... bench:     24 ns/iter (+/- 4) = 1333 MB/s
branch_and_subtract                 ... bench:     16 ns/iter (+/- 0) = 2000 MB/s
branch_and_mask                     ... bench:     16 ns/iter (+/- 0) = 2000 MB/s
branchless                          ... bench:     16 ns/iter (+/- 0) = 2000 MB/s
libcore                             ... bench:     15 ns/iter (+/- 0) = 2133 MB/s
fake_simd_u32                       ... bench:     17 ns/iter (+/- 0) = 1882 MB/s
fake_simd_u64                       ... bench:     16 ns/iter (+/- 0) = 2000 MB/s
mask_mult_bool_branchy_lookup_table ... bench:     42 ns/iter (+/- 0) = 761 MB/s
mask_mult_bool_lookup_table         ... bench:     35 ns/iter (+/- 0) = 914 MB/s
mask_mult_bool_match_range          ... bench:     16 ns/iter (+/- 0) = 2000 MB/s
mask_shifted_bool_match_range       ... bench:     16 ns/iter (+/- 0) = 2000 MB/s

7 bytes string:

alloc_only                          ... bench:     14 ns/iter (+/- 0) = 500 MB/s
black_box_read_each_byte            ... bench:     22 ns/iter (+/- 0) = 318 MB/s
lookup_table                        ... bench:     16 ns/iter (+/- 0) = 437 MB/s
branch_and_subtract                 ... bench:     16 ns/iter (+/- 0) = 437 MB/s
branch_and_mask                     ... bench:     16 ns/iter (+/- 0) = 437 MB/s
branchless                          ... bench:     19 ns/iter (+/- 0) = 368 MB/s
libcore                             ... bench:     20 ns/iter (+/- 0) = 350 MB/s
fake_simd_u32                       ... bench:     18 ns/iter (+/- 0) = 388 MB/s
fake_simd_u64                       ... bench:     21 ns/iter (+/- 0) = 333 MB/s
mask_mult_bool_branchy_lookup_table ... bench:     20 ns/iter (+/- 0) = 350 MB/s
mask_mult_bool_lookup_table         ... bench:     19 ns/iter (+/- 0) = 368 MB/s
mask_mult_bool_match_range          ... bench:     19 ns/iter (+/- 0) = 368 MB/s
mask_shifted_bool_match_range       ... bench:     19 ns/iter (+/- 0) = 368 MB/s
```

5 years agoRollup merge of #59268 - estebank:from-string, r=QuietMisdreavus
Josh Stone [Thu, 28 Mar 2019 01:15:24 +0000 (18:15 -0700)]
Rollup merge of #59268 - estebank:from-string, r=QuietMisdreavus

Add suggestion to use `&*var` when `&str: From<String>` is expected

Fix #53879.

5 years agoRollup merge of #58837 - Centril:librustc_interface_2018, r=petrochenkov
Josh Stone [Thu, 28 Mar 2019 01:15:22 +0000 (18:15 -0700)]
Rollup merge of #58837 - Centril:librustc_interface_2018, r=petrochenkov

librustc_interface => 2018

r? @oli-obk

This will likely produce an ICE for some reason... so super-WIP.

5 years agoRollup merge of #58253 - taiki-e:librustc_driver-2018, r=petrochenkov
Josh Stone [Thu, 28 Mar 2019 01:15:21 +0000 (18:15 -0700)]
Rollup merge of #58253 - taiki-e:librustc_driver-2018, r=petrochenkov

librustc_driver => 2018

Transitions `librustc_driver` to Rust 2018; cc #58099

r? @Centril

5 years agoRollup merge of #57565 - petrochenkov:turbowarn, r=Centril
Josh Stone [Thu, 28 Mar 2019 01:15:19 +0000 (18:15 -0700)]
Rollup merge of #57565 - petrochenkov:turbowarn, r=Centril

syntax: Remove warning for unnecessary path disambiguators

`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced).
One hardcoded warning less.

Closes https://github.com/rust-lang/rust/issues/58055

r? @nikomatsakis

5 years agoRollup merge of #57293 - Zoxc:incr-passes3, r=michaelwoerister
Josh Stone [Thu, 28 Mar 2019 01:15:18 +0000 (18:15 -0700)]
Rollup merge of #57293 - Zoxc:incr-passes3, r=michaelwoerister

Make some lints incremental

Blocked on https://github.com/rust-lang/rust/pull/57253

r? @michaelwoerister

5 years agoAuto merge of #59415 - varkor:values_since_snapshot, r=eddyb
bors [Wed, 27 Mar 2019 13:20:16 +0000 (13:20 +0000)]
Auto merge of #59415 - varkor:values_since_snapshot, r=eddyb

Refactor InferenceFudger (née RegionFudger)

- Rename `RegionFudger` (and related methods) to `InferenceFudger`.
- Take integer and float inference variables into account.
- Refactor `types_created_since_snapshot` and `vars_created_since_snapshot` with the [new version of ena](https://github.com/rust-lang-nursery/ena/pull/21).
- Some other refactoring in the area.

r? @eddyb

5 years agoUse Vec instead of FxHashMap
varkor [Mon, 25 Mar 2019 22:26:37 +0000 (22:26 +0000)]
Use Vec instead of FxHashMap

5 years agoLookup region variable origin instead of choosing one
varkor [Mon, 25 Mar 2019 21:28:39 +0000 (21:28 +0000)]
Lookup region variable origin instead of choosing one

5 years agoStore type variable origins in InferenceFudger
varkor [Mon, 25 Mar 2019 21:28:15 +0000 (21:28 +0000)]
Store type variable origins in InferenceFudger

5 years agoPropitiate tidy
varkor [Mon, 25 Mar 2019 16:48:57 +0000 (16:48 +0000)]
Propitiate tidy

5 years agoUpdate ena to version 0.13.0
varkor [Mon, 25 Mar 2019 15:45:44 +0000 (15:45 +0000)]
Update ena to version 0.13.0

5 years agoUse `eq_relations`
varkor [Thu, 21 Mar 2019 17:11:42 +0000 (17:11 +0000)]
Use `eq_relations`

5 years agoAdd `next_int_var` and `next_float_var`
varkor [Thu, 21 Mar 2019 13:47:57 +0000 (13:47 +0000)]
Add `next_int_var` and `next_float_var`

5 years agoSimplify `fudge_inference_if_ok`
varkor [Thu, 21 Mar 2019 13:43:37 +0000 (13:43 +0000)]
Simplify `fudge_inference_if_ok`

5 years agoAdd int variables and float variables to `InferenceFudger`
varkor [Thu, 21 Mar 2019 13:39:57 +0000 (13:39 +0000)]
Add int variables and float variables to `InferenceFudger`

5 years agoRename `RegionFudger` to `InferenceFudger`
varkor [Thu, 21 Mar 2019 12:39:05 +0000 (12:39 +0000)]
Rename `RegionFudger` to `InferenceFudger`

5 years agoRemove `TypeVariableMap`
varkor [Thu, 21 Mar 2019 12:38:05 +0000 (12:38 +0000)]
Remove `TypeVariableMap`

5 years agoUse Ranges for vars_since_snapshot
varkor [Thu, 21 Mar 2019 12:37:31 +0000 (12:37 +0000)]
Use Ranges for vars_since_snapshot

5 years agoSimplify `TypeVariableTable::vars_since_snapshot`
varkor [Wed, 20 Mar 2019 10:07:30 +0000 (10:07 +0000)]
Simplify `TypeVariableTable::vars_since_snapshot`

5 years agoSimplify `RegionConstraintCollector::vars_since_snapshot`
varkor [Wed, 20 Mar 2019 01:54:53 +0000 (01:54 +0000)]
Simplify `RegionConstraintCollector::vars_since_snapshot`

5 years agoMake `vars_since_snapshot` naming consistent
varkor [Wed, 20 Mar 2019 00:57:25 +0000 (00:57 +0000)]
Make `vars_since_snapshot` naming consistent

5 years agoUpdate ena
varkor [Tue, 19 Mar 2019 21:30:07 +0000 (21:30 +0000)]
Update ena

5 years agoAuto merge of #55780 - ogoffart:span_source_text, r=petrochenkov
bors [Wed, 27 Mar 2019 08:58:40 +0000 (08:58 +0000)]
Auto merge of #55780 - ogoffart:span_source_text, r=petrochenkov

Introduce proc_macro::Span::source_text

A function to extract the actual source behind a Span.

Background: I would like to use `syn` in a `build.rs` script to parse the rust code, and extract part of the source code. However, `syn` only gives access to proc_macro2::Span, and i would like to get the source code behind that.
I opened an issue on proc_macro2 bug tracker for this feature https://github.com/alexcrichton/proc-macro2/issues/110  and @alexcrichton said the feature should first go upstream in proc_macro.  So there it is!

Since most of the Span API is unstable anyway, this is guarded by the same `proc_macro_span` feature as everything else.

5 years agolibrustc_interface => 2018; rename rustc-rayon to rayon in Cargo.toml
Mazdak Farrokhzad [Wed, 27 Mar 2019 08:48:50 +0000 (09:48 +0100)]
librustc_interface => 2018; rename rustc-rayon to rayon in Cargo.toml

5 years agolibrustc_interface => 2018
Mazdak Farrokhzad [Tue, 26 Mar 2019 18:07:13 +0000 (19:07 +0100)]
librustc_interface => 2018

5 years agoMinor rewordings and add `dyn` keyword
Chris Gregory [Wed, 27 Mar 2019 05:46:24 +0000 (01:46 -0400)]
Minor rewordings and add `dyn` keyword

5 years agoAuto merge of #59447 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 27 Mar 2019 05:25:50 +0000 (05:25 +0000)]
Auto merge of #59447 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #59004 ([rustdoc] Improve "in parameters" search and search more generally)
 - #59026 (Fix moving text in search tabs headers)
 - #59197 (Exclude old book redirect stubs from search engines)
 - #59330 (Improve the documentation for std::convert (From, Into, AsRef and AsMut))
 - #59424 (Fix code block display in portability element in dark theme)
 - #59427 (Link to PhantomData in NonNull documentation)
 - #59432 (Improve some compiletest documentation)

Failed merges:

r? @ghost

5 years agoAuto merge of #59285 - cuviper:llvm-8.0.0, r=alexcrichton
bors [Wed, 27 Mar 2019 01:56:14 +0000 (01:56 +0000)]
Auto merge of #59285 - cuviper:llvm-8.0.0, r=alexcrichton

Rebase LLVM to 8.0.0 final

r? @alexcrichton

5 years agoRollup merge of #59432 - phansch:compiletest_docs, r=alexcrichton
Guillaume Gomez [Tue, 26 Mar 2019 21:26:46 +0000 (22:26 +0100)]
Rollup merge of #59432 - phansch:compiletest_docs, r=alexcrichton

Improve some compiletest documentation

This adds some missing documentation for rustfix related things and adds
a test for the `is_test` function.

5 years agoRollup merge of #59427 - czipperz:non_null_doc_links, r=Mark-Simulacrum
Guillaume Gomez [Tue, 26 Mar 2019 21:26:45 +0000 (22:26 +0100)]
Rollup merge of #59427 - czipperz:non_null_doc_links, r=Mark-Simulacrum

Link to PhantomData in NonNull documentation

5 years agoRollup merge of #59424 - GuillaumeGomez:fix-stability-css, r=QuietMisdreavus
Guillaume Gomez [Tue, 26 Mar 2019 21:26:43 +0000 (22:26 +0100)]
Rollup merge of #59424 - GuillaumeGomez:fix-stability-css, r=QuietMisdreavus

Fix code block display in portability element in dark theme

Fixes #59261.

r? @QuietMisdreavus

A little screenshot:

<img width="521" alt="Screenshot 2019-03-26 at 00 37 49" src="https://user-images.githubusercontent.com/3050060/54961082-9a41c600-4f5f-11e9-8040-ae6f26d368ff.png">

5 years agoRollup merge of #59330 - DevQps:improve-std-convert-documentation, r=steveklabnik
Guillaume Gomez [Tue, 26 Mar 2019 21:26:42 +0000 (22:26 +0100)]
Rollup merge of #59330 - DevQps:improve-std-convert-documentation, r=steveklabnik

Improve the documentation for std::convert (From, Into, AsRef and AsMut)

# Description
In this PR I updated the documentation of From, Into, AsRef and AsMut, as well as the general std::convert module documentation. The discussion in #59163 provided information that was not yet present in the docs, or was not expressed clearly enough. I tried to clarify the examples that were already present in the docs as well as add more information about considered best-practices that came out of the discussion in #59163

@steveklabnik I hope I didn't change too much. This is an initial version! I will scan through everything tomorrow as well again to see if I made any typo's or errors, and maybe make some small changes here and there.

All suggestions are welcome!

closes #59163

5 years agoRollup merge of #59197 - kornelski:redir, r=steveklabnik
Guillaume Gomez [Tue, 26 Mar 2019 21:26:40 +0000 (22:26 +0100)]
Rollup merge of #59197 - kornelski:redir, r=steveklabnik

Exclude old book redirect stubs from search engines

Adds `<meta name="robots" content="noindex,follow">` to the `<head>` of old stub pages pointing to the second edition of the book.

This is continuation of https://github.com/rust-lang/book/pull/1788

5 years agoRollup merge of #59026 - GuillaumeGomez:search-tabs-header, r=QuietMisdreavus
Guillaume Gomez [Tue, 26 Mar 2019 21:26:39 +0000 (22:26 +0100)]
Rollup merge of #59026 - GuillaumeGomez:search-tabs-header, r=QuietMisdreavus

Fix moving text in search tabs headers

Fixes #59005.

Now, the text in the search tabs headers isn't moving anymore.

r? @QuietMisdreavus

5 years agoRollup merge of #59004 - GuillaumeGomez:generics-handling, r=QuietMisdreavus
Guillaume Gomez [Tue, 26 Mar 2019 21:26:36 +0000 (22:26 +0100)]
Rollup merge of #59004 - GuillaumeGomez:generics-handling, r=QuietMisdreavus

[rustdoc] Improve "in parameters" search and search more generally

Fixes #58230.

r? @QuietMisdreavus

5 years agolibrustc_driver => 2018
Taiki Endo [Tue, 26 Mar 2019 20:35:18 +0000 (05:35 +0900)]
librustc_driver => 2018

5 years agoAuto merge of #59433 - Centril:rollup, r=Centril
bors [Tue, 26 Mar 2019 17:25:16 +0000 (17:25 +0000)]
Auto merge of #59433 - Centril:rollup, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #59150 (Expand suggestions for type ascription parse errors)
 - #59232 (Merge `Promoted` and `Static` in `mir::Place`)
 - #59267 (Provide suggestion when using field access instead of path)
 - #59315 (Add no_hash to query macro and move some queries over)
 - #59334 (Update build instructions in README.md)
 - #59362 (Demo `FromIterator` short-circuiting)
 - #59374 (Simplify checked_duration_since)
 - #59389 (replace redundant note in deprecation warning)
 - #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
 - #59419 (Utilize `?` instead of `return None`.)

Failed merges:

r? @ghost

5 years agoExclude UnusedBrokenConst from module lints
John Kåre Alsaker [Tue, 26 Mar 2019 16:04:00 +0000 (17:04 +0100)]
Exclude UnusedBrokenConst from module lints

5 years agoAuto merge of #59434 - Centril:bootstrap-to-2019-03-20, r=Mark-Simulacrum
bors [Tue, 26 Mar 2019 13:58:30 +0000 (13:58 +0000)]
Auto merge of #59434 - Centril:bootstrap-to-2019-03-20, r=Mark-Simulacrum

Bump bootstrap compiler to 2019-03-20

Includes https://github.com/rust-lang/rust/pull/59295 and by extension https://github.com/rust-lang/rust/pull/59047, which unblocks https://github.com/rust-lang/rust/pull/58253, https://github.com/rust-lang/rust/pull/58837, and possibly https://github.com/rust-lang/rust/pull/59336, and so therefore:

@bors p=50

r? @Mark-Simulacrum

cc @pietroalbini

5 years agobump bootstrap; adjust stage0 uses in libsyntax_pos
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:57:42 +0000 (09:57 +0100)]
bump bootstrap; adjust stage0 uses in libsyntax_pos

5 years agobump bootstrap; adjust stage0 uses in core::ptr.
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:57:25 +0000 (09:57 +0100)]
bump bootstrap; adjust stage0 uses in core::ptr.

5 years agobump bootstrap => 2019-03-20
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:53:47 +0000 (09:53 +0100)]
bump bootstrap => 2019-03-20

5 years agofix some uses I missed
Ralf Jung [Tue, 19 Mar 2019 08:46:11 +0000 (09:46 +0100)]
fix some uses I missed

5 years agoadjust MaybeUninit API to discussions
Ralf Jung [Mon, 18 Mar 2019 21:45:02 +0000 (22:45 +0100)]
adjust MaybeUninit API to discussions

uninitialized -> uninit
into_initialized -> assume_init
read_initialized -> read
set -> write

5 years agoRollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:53 +0000 (09:05 +0100)]
Rollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor

Utilize `?` instead of `return None`.

None

5 years agoRollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:52 +0000 (09:05 +0100)]
Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett

Clarify `{Ord,f32,f64}::clamp` docs a little

Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.

5 years agoRollup merge of #59389 - euclio:deprecated-suggestion, r=varkor
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:51 +0000 (09:05 +0100)]
Rollup merge of #59389 - euclio:deprecated-suggestion, r=varkor

replace redundant note in deprecation warning

5 years agoRollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmaster
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:48 +0000 (09:05 +0100)]
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmaster

Simplify checked_duration_since

This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top.

Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method".

Added two test cases:
* Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`.
* Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.

5 years agoRollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting, r=Centril
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:47 +0000 (09:05 +0100)]
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting, r=Centril

Demo `FromIterator` short-circuiting

while looking at a FIXME in `FromIterator for Option` and `FromIterator for Result`, I realized that the current documentation does not have example code showing exactly what is meant by "no further elements are taken."

The code snippets provided here are meant to correct that.

5 years agoRollup merge of #59334 - ewk:readme, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:46 +0000 (09:05 +0100)]
Rollup merge of #59334 - ewk:readme, r=Mark-Simulacrum

Update build instructions in README.md

Add additional instructions when `sudo ./x.py install` fails to
complete the build.

This resolves issues #40108 and #49269.

r? @steveklabnik

5 years agoRollup merge of #59315 - Zoxc:move-query, r=oli-obk
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:44 +0000 (09:05 +0100)]
Rollup merge of #59315 - Zoxc:move-query, r=oli-obk

Add no_hash to query macro and move some queries over

r? @oli-obk

5 years agoRollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwco
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:43 +0000 (09:05 +0100)]
Rollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwco

Provide suggestion when using field access instead of path

When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.

Fix #57316.

5 years agoRollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:40 +0000 (09:05 +0100)]
Rollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk

Merge `Promoted` and `Static` in `mir::Place`

fixes #53848

5 years agoRollup merge of #59150 - estebank:type-ascription, r=varkor
Mazdak Farrokhzad [Tue, 26 Mar 2019 08:05:39 +0000 (09:05 +0100)]
Rollup merge of #59150 - estebank:type-ascription, r=varkor

Expand suggestions for type ascription parse errors

Fix #51222. CC #48016, #47666, #54516, #34255.

5 years agoImprove some compiletest documentation
Philipp Hansch [Tue, 26 Mar 2019 06:47:38 +0000 (07:47 +0100)]
Improve some compiletest documentation

This adds some missing documentation for rustfix related things and adds
a test for the `is_test` function.

5 years agoAuto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiyn
bors [Tue, 26 Mar 2019 01:48:34 +0000 (01:48 +0000)]
Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiyn

SGX target: fix std unit tests

This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass.

#59009 must be merged first.

5 years agoFix code block display in portability element in dark theme
Guillaume Gomez [Mon, 25 Mar 2019 23:30:33 +0000 (00:30 +0100)]
Fix code block display in portability element in dark theme

5 years agoUtilize `?` instead of `return None`.
Corey Farwell [Mon, 25 Mar 2019 22:16:40 +0000 (23:16 +0100)]
Utilize `?` instead of `return None`.

5 years agoLink to PhantomData in NonNull documentation
Chris Gregory [Mon, 25 Mar 2019 22:04:42 +0000 (18:04 -0400)]
Link to PhantomData in NonNull documentation

5 years agoUpdate tests
John Kåre Alsaker [Wed, 13 Mar 2019 01:55:37 +0000 (02:55 +0100)]
Update tests

5 years agoMake more lints incremental
John Kåre Alsaker [Sun, 3 Mar 2019 17:47:54 +0000 (18:47 +0100)]
Make more lints incremental

5 years agoMake some lints incremental
John Kåre Alsaker [Mon, 11 Jun 2018 06:48:15 +0000 (08:48 +0200)]
Make some lints incremental

5 years agoFormatting changes, including better wrapping and creating short summary lines.
Christian [Mon, 25 Mar 2019 21:21:05 +0000 (22:21 +0100)]
Formatting changes, including better wrapping and creating short summary lines.

5 years agoRework documentation into examples
Chris Gregory [Mon, 25 Mar 2019 21:19:47 +0000 (17:19 -0400)]
Rework documentation into examples

5 years agoRework documentation to be about fat pointers
Chris Gregory [Mon, 25 Mar 2019 20:38:12 +0000 (16:38 -0400)]
Rework documentation to be about fat pointers

5 years agoSGX target: fix std unit tests
Jethro Beekman [Tue, 12 Mar 2019 17:58:30 +0000 (10:58 -0700)]
SGX target: fix std unit tests

5 years agoAuto merge of #59258 - euclio:suggestions-filter-crate, r=oli-obk
bors [Mon, 25 Mar 2019 16:34:15 +0000 (16:34 +0000)]
Auto merge of #59258 - euclio:suggestions-filter-crate, r=oli-obk

filter suggestions from extern prelude

Fixes #59027.

Modifies the candidate gathering code to call `filter_fn` on extern crates, which causes them to be filtered out when looking for a type.

5 years agoAuto merge of #59256 - petrochenkov:derval2, r=Zoxc
bors [Mon, 25 Mar 2019 12:21:46 +0000 (12:21 +0000)]
Auto merge of #59256 - petrochenkov:derval2, r=Zoxc

Make meta-item API compatible with `LocalInternedString::get` soundness fix

r? @Zoxc

5 years agoClarify `{Ord,f32,f64}::clamp` docs a little
Tobias Bucher [Mon, 25 Mar 2019 11:52:42 +0000 (12:52 +0100)]
Clarify `{Ord,f32,f64}::clamp` docs a little

Explicitly call out when it returns NaN, adhere to the panic doc
guidelines.

5 years agoadd missing braces
Felix S Klock II [Mon, 25 Mar 2019 10:50:11 +0000 (11:50 +0100)]
add missing braces

add missing braces analogous to those suggested by killercup

5 years agoUpdate src/libcore/option.rs
Pascal Hertleif [Mon, 25 Mar 2019 10:48:08 +0000 (11:48 +0100)]
Update src/libcore/option.rs

Co-Authored-By: pnkfelix <pnkfelix@pnkfx.org>
5 years agoAuto merge of #59242 - euclio:asm-ice, r=nagisa
bors [Mon, 25 Mar 2019 09:05:00 +0000 (09:05 +0000)]
Auto merge of #59242 - euclio:asm-ice, r=nagisa

make asm diagnostic instruction optional

`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.

Reopening from #55193. I was unable to trigger the assertion on Windows after rebasing.

Fixes #23458.
Fixes #55216.

5 years agoAuto merge of #59240 - euclio:struct-field-span, r=oli-obk
bors [Mon, 25 Mar 2019 05:40:12 +0000 (05:40 +0000)]
Auto merge of #59240 - euclio:struct-field-span, r=oli-obk

use the identifier span for missing struct field

5 years agoDeduplicate code for path suggestion
Esteban Küber [Wed, 20 Mar 2019 23:03:29 +0000 (16:03 -0700)]
Deduplicate code for path suggestion

5 years agoProvide suggestion when using field access instead of path
Esteban Küber [Mon, 18 Mar 2019 04:18:06 +0000 (21:18 -0700)]
Provide suggestion when using field access instead of path

When trying to access an associated constant as if it were a field of
an instance, provide a suggestion for the correct syntax.

5 years agoAuto merge of #59195 - estebank:for-loop-move, r=petrochenkov
bors [Mon, 25 Mar 2019 00:38:15 +0000 (00:38 +0000)]
Auto merge of #59195 - estebank:for-loop-move, r=petrochenkov

When moving out of a for loop head, suggest borrowing it

When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```

Fix #25534.

5 years agoAuto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkov
bors [Sun, 24 Mar 2019 21:26:57 +0000 (21:26 +0000)]
Auto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkov

Separate `DefId`s for variants and their constructors

Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion.

r? @petrochenkov

5 years agoAdd nll test
Esteban Küber [Sun, 24 Mar 2019 19:58:30 +0000 (12:58 -0700)]
Add nll test

5 years agoWhen moving out of a for loop head, suggest borrowing it
Esteban Küber [Thu, 14 Mar 2019 23:09:47 +0000 (16:09 -0700)]
When moving out of a for loop head, suggest borrowing it

When encountering code like the following, suggest borrowing the for loop
head to avoid moving it into the for loop pattern:

```
fn main() {
    let a = vec![1, 2, 3];
    for i in &a {
        for j in a {
            println!("{} * {} = {}", i, j, i * j);
        }
    }
}
```

5 years agoRe-order fields in `Def::Ctor`.
David Wood [Sun, 24 Mar 2019 18:16:44 +0000 (19:16 +0100)]
Re-order fields in `Def::Ctor`.

This commit moves the `DefId` field of `Def::Ctor` to be the first
field.

5 years agoMove `CtorOf` into `hir::def`.
David Wood [Sun, 24 Mar 2019 17:54:56 +0000 (18:54 +0100)]
Move `CtorOf` into `hir::def`.

This commit moves the definition of `CtorOf` from `rustc::hir` to
`rustc::hir::def` and adds imports wherever it is used.

5 years agoAuto merge of #59397 - kennytm:rollup, r=kennytm
bors [Sun, 24 Mar 2019 17:53:45 +0000 (17:53 +0000)]
Auto merge of #59397 - kennytm:rollup, r=kennytm

Rollup of 7 pull requests

Successful merges:

 - #59213 (Track changes to robots.txt)
 - #59239 (Remove inline assembly from hint::spin_loop)
 - #59251 (Use a valid name for graphviz graphs)
 - #59296 (Do not encode gensymed imports in metadata)
 - #59328 (Implement specialized nth_back() for Box and Windows.)
 - #59355 (Fix ICE with const generic param in struct)
 - #59377 (Correct minimum system LLVM version in tests)

5 years agoRemove `CtorOf` from `Node::Ctor`.
David Wood [Sun, 24 Mar 2019 17:21:59 +0000 (18:21 +0100)]
Remove `CtorOf` from `Node::Ctor`.

This commit removes `CtorOf` from `Node::Ctor` as the parent of the
constructor can be determined by looking at the node's parent in the few
places where knowing this is necessary.

5 years agomake asm diagnostic instruction optional
Andy Russell [Fri, 19 Oct 2018 00:34:01 +0000 (20:34 -0400)]
make asm diagnostic instruction optional

`DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so
the instruction shouldn't be blindly unwrapped.

5 years agoRevert changes to creation of fictive constructors for struct variants
Vadim Petrochenkov [Sun, 24 Mar 2019 15:41:09 +0000 (18:41 +0300)]
Revert changes to creation of fictive constructors for struct variants

5 years agoreplace redundant note in deprecation warning
Andy Russell [Sun, 24 Mar 2019 01:13:57 +0000 (21:13 -0400)]
replace redundant note in deprecation warning

5 years agoMerge `DefPathData::VariantCtor` and `DefPathData::StructCtor`
Vadim Petrochenkov [Sun, 24 Mar 2019 14:49:58 +0000 (17:49 +0300)]
Merge `DefPathData::VariantCtor` and `DefPathData::StructCtor`

5 years agoRollup merge of #59377 - smaeul:patch/system-llvm, r=nikic
kennytm [Sun, 24 Mar 2019 07:32:57 +0000 (15:32 +0800)]
Rollup merge of #59377 - smaeul:patch/system-llvm, r=nikic

Correct minimum system LLVM version in tests

Since commit 9452a8dfa3ba, the new debug info format is only generated
for LLVM 8 and newer versions. However, the tests still assume that LLVM
7 will use the new debug info format. Fix the tests (and a comment in
the code) to match the actual version check.

5 years agoSlightly more uniform treatment of struct and variant constructors
Vadim Petrochenkov [Sun, 24 Mar 2019 12:29:57 +0000 (15:29 +0300)]
Slightly more uniform treatment of struct and variant constructors

5 years agoAuto merge of #58305 - scalexm:chalk-continued, r=nikomatsakis
bors [Sun, 24 Mar 2019 14:26:11 +0000 (14:26 +0000)]
Auto merge of #58305 - scalexm:chalk-continued, r=nikomatsakis

(WIP) Small fixes in chalkification

Small fixes around region constraints and builtin impls. There are still some type inference errors, for example the following code errors out:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::new();
    //                    ^^^^^^^^ cannot infer type for `std::vec::Vec<_>`
}
```
but explicitly specifying `Vec::<i32>::new` works.

With these few fixes, the following code now passes type-checking:
```rust
fn main() {
    let mut x: Vec<i32> = Vec::<i32>::new();
    x.push(5);
    println!("{:?}", x);
}
```

I also fixed the implied bounds bug as discussed on Zulip and in https://github.com/rust-lang-nursery/chalk/pull/206

cc @tmandry
r? @nikomatsakis

5 years agoRemove `VariantDef::parent_did`
Vadim Petrochenkov [Sun, 24 Mar 2019 09:09:44 +0000 (12:09 +0300)]
Remove `VariantDef::parent_did`

5 years agoRollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkov
kennytm [Sun, 24 Mar 2019 07:32:54 +0000 (15:32 +0800)]
Rollup merge of #59355 - varkor:const-param-struct-ice, r=petrochenkov

Fix ICE with const generic param in struct

Fixes https://github.com/rust-lang/rust/issues/59340.

r? @petrochenkov

5 years agoRollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm
kennytm [Sun, 24 Mar 2019 07:32:52 +0000 (15:32 +0800)]
Rollup merge of #59328 - koalatux:iter-nth-back, r=scottmcm

Implement specialized nth_back() for Box and Windows.

Hi there, this is my first pull request to rust :-)

I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995.

I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.

5 years agoRollup merge of #59296 - petrochenkov:stdup, r=estebank
kennytm [Sun, 24 Mar 2019 07:32:49 +0000 (15:32 +0800)]
Rollup merge of #59296 - petrochenkov:stdup, r=estebank

Do not encode gensymed imports in metadata

(Unless they are underscore `_` imports which are re-gensymed on crate loading, see https://github.com/rust-lang/rust/pull/56392.)

We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream.
Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates.

A workaround that fixes https://github.com/rust-lang/rust/issues/59243.

5 years agoRollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov
kennytm [Sun, 24 Mar 2019 07:32:48 +0000 (15:32 +0800)]
Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkov

Use a valid name for graphviz graphs

Hiridification has broken graphviz output because `HirId` has a more complex display implemetation than `NodeId`. Since the id was just used to generate a distinct identifier, we just pull out the various constituent indexed.

5 years agoRemove methods is_struct/is_tuple/is_unit from VariantData
Vadim Petrochenkov [Sat, 23 Mar 2019 21:06:58 +0000 (00:06 +0300)]
Remove methods is_struct/is_tuple/is_unit from VariantData