]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #57436 - Xanewok:save-analysis-access-ice-fix, r=nikomatsakis
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:47 +0000 (05:26 +0100)]
Rollup merge of #57436 - Xanewok:save-analysis-access-ice-fix, r=nikomatsakis

save-analysis: use a fallback when access levels couldn't be computed

Fixing an RLS regression I introduced in https://github.com/rust-lang/rust/pull/57343 :cry:

I missed a case where we get [called back with analysis when type checking fails](https://github.com/rust-lang/rust/blob/9d54812829e9d92dac35a4a0f358cdc5a2475371/src/librustc_driver/driver.rs#L1264). Since privacy checking normally is done afterwards, when we execute the `privacy_access_levels` query inside the save_analysis callback we'll calculate it for the first time and since typeck info isn't complete, we'll crash there.

Double-checked locally and it seems to have fixed the problem.

r? @nikomatsakis

5 years agoRollup merge of #57412 - JohnTitor:improve-the-wording-1, r=varkor
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:46 +0000 (05:26 +0100)]
Rollup merge of #57412 - JohnTitor:improve-the-wording-1, r=varkor

Improve the wording

I'm sorry but re-opened the PR because I failed to squash commits(#57397).

Fixes #55752.
r? @varkor

5 years agoRollup merge of #57353 - huonw:faster-finiteness-checks, r=KodrAus
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:44 +0000 (05:26 +0100)]
Rollup merge of #57353 - huonw:faster-finiteness-checks, r=KodrAus

Optimise floating point `is_finite` (2x) and `is_infinite` (1.6x).

These can both rely on IEEE754 semantics to be made faster, by folding
away the sign with an abs (left private for now), and then comparing
to infinity, letting the NaN semantics of a direct float comparison
handle NaN input properly.

The `abs` bit-fiddling is simple (a single and), and so these new
forms compile down to a few instructions, without branches, e.g. for
f32:

```asm
is_infinite:
        andps   xmm0, xmmword ptr [rip + .LCPI2_0] ; 0x7FFF_FFFF
        ucomiss xmm0, dword ptr [rip + .LCPI2_1]   ; 0x7F80_0000
        setae   al
        ret

is_finite:
        andps   xmm0, xmmword ptr [rip + .LCPI1_0] ; 0x7FFF_FFFF
        movss   xmm1, dword ptr [rip + .LCPI1_1]   ; 0x7F80_0000
        ucomiss xmm1, xmm0
        seta    al
        ret
```

When used in loops/repeatedly, they get even better: the memory
operations (loading the mask 0x7FFFFFFF for abs, and infinity
0x7F80_0000) are likely to be hoisted out of the individual calls, to
be shared, and the `seta`/`setae` are likely to be collapsed into
conditional jumps or moves (or similar).

The old `is_infinite` did two comparisons, and the old `is_finite` did
three (with a branch), and both of them had to check the flags after
every one of those comparison. These functions have had that old
implementation since they were added in
https://github.com/rust-lang/rust/commit/6284190ef9918e05cb9147a2a81100ddcb06fea8
7 years ago.

Benchmark (`abs` is the new form, `std` is the old):

```
test f32_is_finite_abs            ... bench:          55 ns/iter (+/- 10)
test f32_is_finite_std            ... bench:         118 ns/iter (+/- 5)

test f32_is_infinite_abs          ... bench:          53 ns/iter (+/- 1)
test f32_is_infinite_std          ... bench:          84 ns/iter (+/- 6)

test f64_is_finite_abs            ... bench:          52 ns/iter (+/- 12)
test f64_is_finite_std            ... bench:         128 ns/iter (+/- 25)

test f64_is_infinite_abs          ... bench:          54 ns/iter (+/- 5)
test f64_is_infinite_std          ... bench:          93 ns/iter (+/- 23)
```

```rust
 #![feature(test)]
extern crate test;

use std::{f32, f64};
use test::Bencher;

const VALUES_F32: &[f32] = &[0.910, 0.135, 0.735, -0.874, 0.518, 0.150, -0.527, -0.418, 0.449, -0.158, -0.064, -0.144, -0.948, -0.103, 0.225, -0.104, -0.795, 0.435, 0.860, 0.027, 0.625, -0.848, -0.454, 0.359, -0.930, 0.067, 0.642, 0.976, -0.682, -0.035, 0.750, 0.005, -0.825, 0.731, -0.850, -0.740, -0.118, -0.972, 0.888, -0.958, 0.086, 0.237, -0.580, 0.488, 0.028, -0.552, 0.302, 0.058, -0.229, -0.166, -0.248, -0.430, 0.789, -0.122, 0.120, -0.934, -0.911, -0.976, 0.882, -0.410, 0.311, -0.611, -0.758, 0.786, -0.711, 0.378, 0.803, -0.068, 0.932, 0.483, 0.085, 0.247, -0.128, -0.839, -0.737, -0.605, 0.637, -0.230, -0.502, 0.231, -0.694, -0.400, -0.441, 0.142, 0.174, 0.681, -0.763, -0.608, 0.848, -0.550, 0.883, -0.212, 0.876, 0.186, -0.909, 0.401, -0.533, -0.961, 0.539, -0.298, -0.448, 0.223, -0.307, -0.594, 0.629, -0.534, 0.959, 0.349, -0.926, -0.523, -0.895, -0.157, -0.074, -0.060, 0.513, -0.647, -0.649, 0.428, 0.401, 0.391, 0.426, 0.700, 0.880, -0.101, 0.862, 0.493, 0.819, -0.597];

 #[bench]
fn f32_is_infinite_std(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F32).iter().any(|x| x.is_infinite()));
}
 #[bench]
fn f32_is_infinite_abs(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F32).iter().any(|x| x.abs()== f32::INFINITY));
}
 #[bench]
fn f32_is_finite_std(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F32).iter().all(|x| x.is_finite()));
}
 #[bench]
fn f32_is_finite_abs(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F32).iter().all(|x| x.abs() < f32::INFINITY));
}

const VALUES_F64: &[f64] = &[0.910, 0.135, 0.735, -0.874, 0.518, 0.150, -0.527, -0.418, 0.449, -0.158, -0.064, -0.144, -0.948, -0.103, 0.225, -0.104, -0.795, 0.435, 0.860, 0.027, 0.625, -0.848, -0.454, 0.359, -0.930, 0.067, 0.642, 0.976, -0.682, -0.035, 0.750, 0.005, -0.825, 0.731, -0.850, -0.740, -0.118, -0.972, 0.888, -0.958, 0.086, 0.237, -0.580, 0.488, 0.028, -0.552, 0.302, 0.058, -0.229, -0.166, -0.248, -0.430, 0.789, -0.122, 0.120, -0.934, -0.911, -0.976, 0.882, -0.410, 0.311, -0.611, -0.758, 0.786, -0.711, 0.378, 0.803, -0.068, 0.932, 0.483, 0.085, 0.247, -0.128, -0.839, -0.737, -0.605, 0.637, -0.230, -0.502, 0.231, -0.694, -0.400, -0.441, 0.142, 0.174, 0.681, -0.763, -0.608, 0.848, -0.550, 0.883, -0.212, 0.876, 0.186, -0.909, 0.401, -0.533, -0.961, 0.539, -0.298, -0.448, 0.223, -0.307, -0.594, 0.629, -0.534, 0.959, 0.349, -0.926, -0.523, -0.895, -0.157, -0.074, -0.060, 0.513, -0.647, -0.649, 0.428, 0.401, 0.391, 0.426, 0.700, 0.880, -0.101, 0.862, 0.493, 0.819, -0.597];

 #[bench]
fn f64_is_infinite_std(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F64).iter().any(|x| x.is_infinite()));
}
 #[bench]
fn f64_is_infinite_abs(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F64).iter().any(|x| x.abs() == f64::INFINITY));
}
 #[bench]
fn f64_is_finite_std(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F64).iter().all(|x| x.is_finite()));
}
 #[bench]
fn f64_is_finite_abs(b: &mut Bencher) {
    b.iter(|| test::black_box(VALUES_F64).iter().all(|x| x.abs() < f64::INFINITY));
}
```

5 years agoRollup merge of #57351 - oli-obk:cheap_const_ops, r=RalfJung
Mazdak Farrokhzad [Sun, 13 Jan 2019 04:26:43 +0000 (05:26 +0100)]
Rollup merge of #57351 - oli-obk:cheap_const_ops, r=RalfJung

Don't actually create a full MIR stack frame when not needed

r? @dotdash

This should significantly reduce overhead during const propagation and reduce overhead *after* copy propagation (cc https://github.com/rust-lang/rust/issues/36673)

5 years agoMinor cosmetic changes
Alexander Regueiro [Sun, 13 Jan 2019 03:14:18 +0000 (03:14 +0000)]
Minor cosmetic changes

5 years agoUpdate documentation comment
Esteban Küber [Wed, 9 Jan 2019 00:32:52 +0000 (16:32 -0800)]
Update documentation comment

5 years agoDon't add label to the match expr when the type is not fully realized
Esteban Küber [Sun, 6 Jan 2019 22:31:39 +0000 (14:31 -0800)]
Don't add label to the match expr when the type is not fully realized

5 years agoReword label as per review comment
Esteban Küber [Sun, 6 Jan 2019 22:23:57 +0000 (14:23 -0800)]
Reword label as per review comment

5 years agotidy fix
Esteban Küber [Sun, 6 Jan 2019 22:08:08 +0000 (14:08 -0800)]
tidy fix

5 years agoPoint at the match discriminant when arm pattern has a type mismatch
Esteban Küber [Sun, 6 Jan 2019 01:08:15 +0000 (17:08 -0800)]
Point at the match discriminant when arm pattern has a type mismatch

5 years agoSuggest correct location for lifetime parameters in use
Esteban Küber [Sun, 13 Jan 2019 03:25:03 +0000 (19:25 -0800)]
Suggest correct location for lifetime parameters in use

5 years agoconst stabilize .
Mazdak Farrokhzad [Sun, 13 Jan 2019 03:00:03 +0000 (04:00 +0100)]
const stabilize .

5 years agoUpdate the const fn tracking issue to the new metabug
varkor [Sun, 13 Jan 2019 01:55:44 +0000 (01:55 +0000)]
Update the const fn tracking issue to the new metabug

5 years agoRemove unrelated errors from parse stderr tests
Esteban Küber [Sun, 13 Jan 2019 01:12:41 +0000 (17:12 -0800)]
Remove unrelated errors from parse stderr tests

5 years agoUpdate cargo
Eric Huss [Sat, 12 Jan 2019 23:26:02 +0000 (15:26 -0800)]
Update cargo

5 years agohygiene: Do not treat `Self` ctor as a local variable
Vadim Petrochenkov [Sat, 12 Jan 2019 22:59:51 +0000 (01:59 +0300)]
hygiene: Do not treat `Self` ctor as a local variable

5 years agoresolve: Mark extern crate items as used in more cases
Vadim Petrochenkov [Sat, 12 Jan 2019 21:58:45 +0000 (00:58 +0300)]
resolve: Mark extern crate items as used in more cases

5 years agoprivacy: Fix private-in-public check for existential types
Vadim Petrochenkov [Sat, 12 Jan 2019 21:41:11 +0000 (00:41 +0300)]
privacy: Fix private-in-public check for existential types

5 years agoAuto merge of #56759 - petrochenkov:prestabuni, r=nikomatsakis
bors [Sat, 12 Jan 2019 20:11:36 +0000 (20:11 +0000)]
Auto merge of #56759 - petrochenkov:prestabuni, r=nikomatsakis

Stabilize `uniform_paths`

Address all the things described in https://github.com/rust-lang/rust/issues/56417.

Assign visibilities to `macro_rules` items - `pub` to `macro_export`-ed macros and `pub(crate)` to non-exported macros, these visibilities determine how far these macros can be reexported with `use`.

Prohibit use of reexported inert attributes and "tool modules", after renaming (e.g. `use inline as imported_inline`) their respective tools and even compiler passes won't be able to recognize and properly check them.

Also turn use of uniform paths in 2015 macros into an error, I'd prefer to neither remove nor stabilize them right away because I still want to make some experiments in this area (uniform path fallback was added to 2015 macros used on 2018 edition in https://github.com/rust-lang/rust/pull/56053#issuecomment-441405140).

UPDATE: The last commit also stabilizes the feature `uniform_paths`.

Closes https://github.com/rust-lang/rust/issues/53130
Closes https://github.com/rust-lang/rust/issues/55618
Closes https://github.com/rust-lang/rust/issues/56326
Closes https://github.com/rust-lang/rust/issues/56398
Closes https://github.com/rust-lang/rust/issues/56417
Closes https://github.com/rust-lang/rust/issues/56821
Closes https://github.com/rust-lang/rust/issues/57252
Closes https://github.com/rust-lang/rust/issues/57422

5 years agoAdd #[must_use] message to Iterator and Future
Taiki Endo [Sat, 12 Jan 2019 17:57:27 +0000 (02:57 +0900)]
Add #[must_use] message to Iterator and Future

5 years agoUse `ptr::eq` where applicable
Igor Matuszewski [Sat, 12 Jan 2019 15:13:33 +0000 (16:13 +0100)]
Use `ptr::eq` where applicable

5 years agoFix a hole in generic parameter import future-proofing
Vadim Petrochenkov [Sun, 30 Dec 2018 17:07:43 +0000 (20:07 +0300)]
Fix a hole in generic parameter import future-proofing

Add some tests for buggy derive helpers

5 years agoStabilize `uniform_paths`
Vadim Petrochenkov [Thu, 27 Dec 2018 00:38:43 +0000 (03:38 +0300)]
Stabilize `uniform_paths`

5 years agoresolve: Prohibit use of imported tool modules
Vadim Petrochenkov [Wed, 12 Dec 2018 22:43:44 +0000 (01:43 +0300)]
resolve: Prohibit use of imported tool modules

5 years agoresolve: Prohibit use of imported non-macro attributes
Vadim Petrochenkov [Wed, 12 Dec 2018 01:11:46 +0000 (04:11 +0300)]
resolve: Prohibit use of imported non-macro attributes

5 years agoresolve: Prohibit use of uniform paths in macros originating from 2015 edition
Vadim Petrochenkov [Sun, 9 Dec 2018 19:58:51 +0000 (22:58 +0300)]
resolve: Prohibit use of uniform paths in macros originating from 2015 edition

...while still keeping ambiguity errors future-proofing for uniform paths.
This corner case is not going to be stabilized for 1.32 and needs some more general experiments about retrofitting 2018 import rules to 2015 edition

5 years agoresolve: Assign `pub` and `pub(crate)` visibilities to `macro_rules` items
Vadim Petrochenkov [Sun, 9 Dec 2018 18:49:21 +0000 (21:49 +0300)]
resolve: Assign `pub` and `pub(crate)` visibilities to `macro_rules` items

5 years agoAuto merge of #57542 - Centril:rollup, r=Centril
bors [Sat, 12 Jan 2019 11:22:20 +0000 (11:22 +0000)]
Auto merge of #57542 - Centril:rollup, r=Centril

Rollup of 26 pull requests

Successful merges:

 - #56425 (Redo the docs for Vec::set_len)
 - #56906 (Issue #56905)
 - #57042 (Don't call `FieldPlacement::count` when count is too large)
 - #57175 (Stabilize `let` bindings and destructuring in constants and const fn)
 - #57192 (Change std::error::Error trait documentation to talk about `source` instead of `cause`)
 - #57296 (Fixed the link to the ? operator)
 - #57368 (Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache)
 - #57400 (Rustdoc: update Source Serif Pro and replace Heuristica italic)
 - #57417 (rustdoc: use text-based doctest parsing if a macro is wrapping main)
 - #57433 (Add link destination for `read-ownership`)
 - #57434 (Remove `CrateNum::Invalid`.)
 - #57441 (Supporting backtrace for x86_64-fortanix-unknown-sgx.)
 - #57450 (actually take a slice in this example)
 - #57459 (Reference tracking issue for inherent associated types in diagnostic)
 - #57463 (docs: Fix some 'second-edition' links)
 - #57466 (Remove outdated comment)
 - #57493 (use structured suggestion when casting a reference)
 - #57498 (make note of one more normalization that Paths do)
 - #57499 (note that FromStr does not work for borrowed types)
 - #57505 (Remove submodule step from README)
 - #57510 (Add a profiles section to the manifest)
 - #57511 (Fix undefined behavior)
 - #57519 (Correct RELEASES.md for 1.32.0)
 - #57522 (don't unwrap unexpected tokens in `format!`)
 - #57530 (Fixing a typographical error.)
 - #57535 (Stabilise irrefutable if-let and while-let patterns)

Failed merges:

r? @ghost

5 years agoRollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=Centril
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:25 +0000 (10:55 +0100)]
Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=Centril

Stabilise irrefutable if-let and while-let patterns

This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495).

This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off.

Closes https://github.com/rust-lang/rust/pull/55639.

r? @Centril

5 years agoRollup merge of #57530 - insideoutclub:master, r=estebank
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:24 +0000 (10:55 +0100)]
Rollup merge of #57530 - insideoutclub:master, r=estebank

Fixing a typographical error.

5 years agoRollup merge of #57522 - euclio:format-ice, r=varkor
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:22 +0000 (10:55 +0100)]
Rollup merge of #57522 - euclio:format-ice, r=varkor

don't unwrap unexpected tokens in `format!`

Fixes #57512.

5 years agoRollup merge of #57519 - pthariensflame:patch-2, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:21 +0000 (10:55 +0100)]
Rollup merge of #57519 - pthariensflame:patch-2, r=alexcrichton

Correct RELEASES.md for 1.32.0

The `into_to_from_bytes` feature was stabilized for `i128` and `u128` just like for the other integer types, but they seem to have been missed.

5 years agoRollup merge of #57511 - jethrogb:jb/fix-undef, r=cramertj
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:20 +0000 (10:55 +0100)]
Rollup merge of #57511 - jethrogb:jb/fix-undef, r=cramertj

Fix undefined behavior

From the [`MaybeUninit::get_mut` docs](https://doc.rust-lang.org/std/mem/union.MaybeUninit.html):
> It is up to the caller to guarantee that the the MaybeUninit really is in an initialized state, otherwise this will immediately cause undefined behavior.

r? @joshtriplett

5 years agoRollup merge of #57510 - nrc:manifest-profiles, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:19 +0000 (10:55 +0100)]
Rollup merge of #57510 - nrc:manifest-profiles, r=alexcrichton

Add a profiles section to the manifest

This supports the profiles work for Rustup in a backwards compatible manner.

r? @alexcrichton

5 years agoRollup merge of #57505 - rust-lang:nrc-patch-1, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:18 +0000 (10:55 +0100)]
Rollup merge of #57505 - rust-lang:nrc-patch-1, r=alexcrichton

Remove submodule step from README

Since the bootstrap does it now

5 years agoRollup merge of #57499 - steveklabnik:gh47757, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:16 +0000 (10:55 +0100)]
Rollup merge of #57499 - steveklabnik:gh47757, r=Mark-Simulacrum

note that FromStr does not work for borrowed types

Fixes #47757

5 years agoRollup merge of #57498 - steveklabnik:gh29008, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:15 +0000 (10:55 +0100)]
Rollup merge of #57498 - steveklabnik:gh29008, r=alexcrichton

make note of one more normalization that Paths do

Fixes #29008

5 years agoRollup merge of #57493 - euclio:deref-suggest, r=oli-obk
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:13 +0000 (10:55 +0100)]
Rollup merge of #57493 - euclio:deref-suggest, r=oli-obk

use structured suggestion when casting a reference

5 years agoRollup merge of #57466 - king6cong:comment, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:12 +0000 (10:55 +0100)]
Rollup merge of #57466 - king6cong:comment, r=alexcrichton

Remove outdated comment

More here: https://github.com/rust-lang/rustc-guide/pull/261

5 years agoRollup merge of #57463 - phansch:fix_some_links, r=steveklabnik
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:11 +0000 (10:55 +0100)]
Rollup merge of #57463 - phansch:fix_some_links, r=steveklabnik

docs: Fix some 'second-edition' links

If I understand it correctly, we now want to link to

    https://doc.rust-lang.org/book/*.html

instead of

    https://doc.rust-lang.org/book/second-edition/*.html

because the second-edition page says that it's no longer distributed with
Rust's docs.

For example: https://doc.rust-lang.org/book/second-edition/ch13-01-closures.html

5 years agoRollup merge of #57459 - varkor:E0202-issue-reference, r=petrochenkov
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:09 +0000 (10:55 +0100)]
Rollup merge of #57459 - varkor:E0202-issue-reference, r=petrochenkov

Reference tracking issue for inherent associated types in diagnostic

This makes it clearer that associated types in inherent impls are an intended feature, like the diagnostic for equality constraints in where clauses. (This is more helpful, because the lack of associated types is a confusing omission and it lets users more easily track the state of the feature.)

5 years agoRollup merge of #57450 - steveklabnik:gh45678, r=KodrAus
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:08 +0000 (10:55 +0100)]
Rollup merge of #57450 - steveklabnik:gh45678, r=KodrAus

actually take a slice in this example

Fixes #45678

5 years agoRollup merge of #57441 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-sgx-backtrace...
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:07 +0000 (10:55 +0100)]
Rollup merge of #57441 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-sgx-backtrace-support, r=alexcrichton

Supporting backtrace for x86_64-fortanix-unknown-sgx.

# Overview
Implementing following functions required by `libstd/sys_common` to support `backtrace`:
```
1. unwind_backtrace
2. trace_fn
3. resolve_symname
```
# Description:
The changes here are quite similar to the Cloudabi target `src/libstd/sys/cloudabi/backtrace.rs`
The first 2 functions are implemented via calls to libunwind.a that is linked to the `x86_64-fortanix-unknown-sgx` (#56979),  we have not implemented functionality needed by `resolve_symname`  (or `dladdr`) to reduce SGX TCB. Rather, we print the function address (relative to enclave image base) in `resolve_symname` which can be later translated to correct symbol name (say, via `addr2line`).

# Note:
For `x86_64-fortanix-unknown-sgx`, the `RUST_BACKTRACE` environment has to be set from within the program running in an enclave.
cc: @jethrogb
r? @alexcrichton

5 years agoRollup merge of #57434 - nnethercote:rm-CrateNum-Invalid, r=petrochenkov
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:05 +0000 (10:55 +0100)]
Rollup merge of #57434 - nnethercote:rm-CrateNum-Invalid, r=petrochenkov

Remove `CrateNum::Invalid`.

It's unused.

5 years agoRollup merge of #57433 - ecstatic-morse:issue-56610-bad-link, r=dtolnay
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:03 +0000 (10:55 +0100)]
Rollup merge of #57433 - ecstatic-morse:issue-56610-bad-link, r=dtolnay

Add link destination for `read-ownership`

Resolves #56610.

5 years agoRollup merge of #57417 - QuietMisdreavus:semi-revert-doctest-parsing, r=GuillaumeGomez
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:02 +0000 (10:55 +0100)]
Rollup merge of #57417 - QuietMisdreavus:semi-revert-doctest-parsing, r=GuillaumeGomez

rustdoc: use text-based doctest parsing if a macro is wrapping main

This is a "forward-port" of https://github.com/rust-lang/rust/pull/57019, intended to get https://github.com/rust-lang/rust/issues/56898 on nightly, since it's now fixed on beta (and already worked on stable).

To recap:

* The libsyntax-based doctest parsing now checks to see whether there is a top-level macro invocation in the doctest while it's checking for `fn main` and an `extern crate` statement.
* If it finds a macro invocation and *didn't* find `fn main`, then it performs the older text-based scan to allow doctests like the ones in `allocator_api` to still compile.

A "proper" fix will involve changing how `make_test` works to call it later in the `run_test` function, after the initial steps of compilation have completed. I've filed [a separate issue](https://github.com/rust-lang/rust/issues/57415) for that, though.

5 years agoRollup merge of #57400 - tspiteri:source-serif-pro-it, r=GuillaumeGomez
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:55:01 +0000 (10:55 +0100)]
Rollup merge of #57400 - tspiteri:source-serif-pro-it, r=GuillaumeGomez

Rustdoc: update Source Serif Pro and replace Heuristica italic

When Source Serif Pro was used to replace Heuristica in #15530, the italic variant was not ready yet, but now it is. This PR updates the Source Serif Pro font files to the [latest release](https://github.com/adobe-fonts/source-serif-pro/releases/tag/2.007R-ro%2F1.007R-it) which includes an italic variant, and replaces Heuristica italic with Source Serif Pro italic.

Fixes #57363.

5 years agoRollup merge of #57368 - petrhosek:cmake-compiler-launcher, r=alexcrichton
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:59 +0000 (10:54 +0100)]
Rollup merge of #57368 - petrhosek:cmake-compiler-launcher, r=alexcrichton

Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache

CMake 3.4 and newer which is the required minimum version for LLVM
supports CMAKE_{C,CXX}_COMPILER_LAUNCHER for settting the compiler
launcher such as ccache which doesn't require shifting arguments.

5 years agoRollup merge of #57296 - JosephTLyons:Fix-question-mark-operator-in-stdio-document...
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:58 +0000 (10:54 +0100)]
Rollup merge of #57296 - JosephTLyons:Fix-question-mark-operator-in-stdio-document, r=wesleywiser

Fixed the link to the ? operator

I'm working on updating all broken links, but figured I'd break up the pull requests so they are easier to review, versus just one big pull request.

5 years agoRollup merge of #57192 - czipperz:error_trait_doc_cause_to_source, r=wesleywiser
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:57 +0000 (10:54 +0100)]
Rollup merge of #57192 - czipperz:error_trait_doc_cause_to_source, r=wesleywiser

Change std::error::Error trait documentation to talk about `source` instead of `cause`

Resolves #57056

5 years agoRollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakis
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:56 +0000 (10:54 +0100)]
Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakis

Stabilize `let` bindings and destructuring in constants and const fn

r? @Centril

This PR stabilizes the following features in constants and `const` functions:

* irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`)
* `let` bindings (e.g. `let x = 1;`)
* mutable `let` bindings (e.g. `let mut x = 1;`)
* assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`)
* expression statements (e.g. `3;`)

This PR does explicitly *not* stabilize:

* mutable references (i.e. `&mut T`)
* dereferencing mutable references
* refutable patterns (e.g. `Some(x)`)
* operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.)
* We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.

5 years agoRollup merge of #57042 - pnkfelix:issue-57038-sidestep-ice-in-fieldplacement-count...
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:54 +0000 (10:54 +0100)]
Rollup merge of #57042 - pnkfelix:issue-57038-sidestep-ice-in-fieldplacement-count, r=michaelwoerister

Don't call `FieldPlacement::count` when count is too large

Sidestep ICE in `FieldPlacement::count` by not calling it when count will not fit in host's usize.

(I briefly played with trying to fix this by changing `FieldPlacement::count` to return a `u64`. However, based on how `FieldPlacement` is used, it seems like this would be a largely pointless pursuit... I'm open to counter-arguments, however.)

Fix #57038

5 years agoRollup merge of #56906 - blitzerr:master, r=nikomatsakis
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:53 +0000 (10:54 +0100)]
Rollup merge of #56906 - blitzerr:master, r=nikomatsakis

Issue #56905

Adding a map to TypeckTables to get the list of all the Upvars
given a closureID. This is help us get rid of the recurring
pattern in the codebase of iterating over the free vars
using with_freevars.

5 years agoRollup merge of #56425 - scottmcm:redo-vec-set_len-docs, r=Centril
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:54:51 +0000 (10:54 +0100)]
Rollup merge of #56425 - scottmcm:redo-vec-set_len-docs, r=Centril

Redo the docs for Vec::set_len

Inspired by the [recent conversation on IRLO](https://internals.rust-lang.org/t/make-vec-set-len-enforce-the-len-cap-invariant/8927/23?u=scottmcm).

This is just my first stab at this; suggestions welcome.

5 years agoconst_let: --bless with --compare-mode=nll
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:32:27 +0000 (10:32 +0100)]
const_let: --bless with --compare-mode=nll

5 years agomove const_let accepted gate to avoid future conflict.
Mazdak Farrokhzad [Sat, 12 Jan 2019 09:31:52 +0000 (10:31 +0100)]
move const_let accepted gate to avoid future conflict.

5 years agoAuto merge of #57532 - Centril:stabilize-2175, r=varkor
bors [Sat, 12 Jan 2019 08:40:17 +0000 (08:40 +0000)]
Auto merge of #57532 - Centril:stabilize-2175, r=varkor

Stabilize #![feature(if_while_or_patterns)]

r? @varkor

Per https://github.com/rust-lang/rust/issues/56212#issue-384085857.
Leading `|` is also accepted per the comment in the stabilization proposal.

5 years agobless ui/while-let
Mazdak Farrokhzad [Sat, 12 Jan 2019 07:59:12 +0000 (08:59 +0100)]
bless ui/while-let

5 years agoAdd label for invalid literal suffix
Esteban Küber [Sat, 12 Jan 2019 07:37:49 +0000 (23:37 -0800)]
Add label for invalid literal suffix

5 years agoTweak incorrect discriminator value variant error
Esteban Küber [Sat, 12 Jan 2019 07:12:29 +0000 (23:12 -0800)]
Tweak incorrect discriminator value variant error

5 years agoSmall tweaks to parser errors
Esteban Küber [Sat, 12 Jan 2019 06:04:54 +0000 (22:04 -0800)]
Small tweaks to parser errors

5 years agoTweak type argument after assoc type error
Esteban Küber [Sat, 12 Jan 2019 05:45:24 +0000 (21:45 -0800)]
Tweak type argument after assoc type error

5 years agoContinue evaluating after finding incorrect .. in pattern
Esteban Küber [Sat, 12 Jan 2019 05:33:57 +0000 (21:33 -0800)]
Continue evaluating after finding incorrect .. in pattern

5 years agofix test
Esteban Küber [Sat, 12 Jan 2019 05:21:30 +0000 (21:21 -0800)]
fix test

5 years agoContinue evaluating after incorrect float literal
Esteban Küber [Sat, 12 Jan 2019 05:19:44 +0000 (21:19 -0800)]
Continue evaluating after incorrect float literal

5 years agofix tests
Esteban Küber [Sat, 12 Jan 2019 05:07:46 +0000 (21:07 -0800)]
fix tests

5 years agoContinue evaluating after type argument in where clause
Esteban Küber [Sat, 12 Jan 2019 05:05:18 +0000 (21:05 -0800)]
Continue evaluating after type argument in where clause

5 years agoContinue evaluating after missing `for` in `impl Trait for Foo`
Esteban Küber [Sat, 12 Jan 2019 04:05:31 +0000 (20:05 -0800)]
Continue evaluating after missing `for` in `impl Trait for Foo`

5 years agoContinue evaluating after parsing incorrect binary literal
Esteban Küber [Sat, 12 Jan 2019 03:56:41 +0000 (19:56 -0800)]
Continue evaluating after parsing incorrect binary literal

5 years agoContinue parsing after lifetime in incorrect location
Esteban Küber [Sat, 12 Jan 2019 03:41:43 +0000 (19:41 -0800)]
Continue parsing after lifetime in incorrect location

5 years agoContinue parser after trailing type argument attribute
Esteban Küber [Sat, 12 Jan 2019 03:31:45 +0000 (19:31 -0800)]
Continue parser after trailing type argument attribute

5 years agoStabilise irrefutable if-let and while-let patterns
varkor [Sat, 12 Jan 2019 03:10:59 +0000 (03:10 +0000)]
Stabilise irrefutable if-let and while-let patterns

This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495).

Co-Authored-By: Sebastian Malton <sebastian@malton.name>
5 years agoAuto merge of #57234 - Centril:const-stabilizations-2, r=oli-obk
bors [Sat, 12 Jan 2019 02:00:18 +0000 (02:00 +0000)]
Auto merge of #57234 - Centril:const-stabilizations-2, r=oli-obk

Const-stabilize `const_int_ops` + `const_ip`

r? @oli-obk

## Note for relnotes: This PR includes https://github.com/rust-lang/rust/pull/57105.

I've added T-lang since this affects intrinsics and the operational semantics of Rust's `const fn` fragment.

## Stable APIs proposed for constification

+ `const_int_ops`:
    + `count_ones`
    + `count_zeros`
    + `leading_zeros`
    + `trailing_zeros`
    + `swap_bytes`
    + `from_be`
    + `from_le`
    + `to_be`
    + `to_le`
+ `const_ip`
    + `Ipv4Addr::new`

## Unstable APIs constified

+ `const_int_conversion`:
    + `reverse_bits`

5 years agostabilize top level or-pats in if/while let.
Mazdak Farrokhzad [Fri, 11 Jan 2019 22:57:04 +0000 (23:57 +0100)]
stabilize top level or-pats in if/while let.

5 years agoFixing a typographical error.
David Sanders [Fri, 11 Jan 2019 21:58:13 +0000 (13:58 -0800)]
Fixing a typographical error.

5 years agoFix new hyperlinks in RELEASES.md
Alexander Ronald Altman [Fri, 11 Jan 2019 19:59:04 +0000 (13:59 -0600)]
Fix new hyperlinks in RELEASES.md

5 years agodon't unwrap unexpected tokens in `format!`
Andy Russell [Fri, 11 Jan 2019 17:40:05 +0000 (12:40 -0500)]
don't unwrap unexpected tokens in `format!`

Fixes #57512.

5 years agoCorrect RELEASES.md for 1.32.0
Alexander Ronald Altman [Fri, 11 Jan 2019 17:06:56 +0000 (11:06 -0600)]
Correct RELEASES.md for 1.32.0

The `into_to_from_bytes` feature was stabilized for `i128` and `u128` just like for the other integer types, but they seem to have been missed.

5 years agore-do docs for core::cmp
Steve Klabnik [Thu, 10 Jan 2019 20:21:01 +0000 (15:21 -0500)]
re-do docs for core::cmp

Fixes #32934

5 years agoAuto merge of #57470 - RalfJung:miri, r=oli-obk
bors [Fri, 11 Jan 2019 16:28:45 +0000 (16:28 +0000)]
Auto merge of #57470 - RalfJung:miri, r=oli-obk

update miri

r? @oli-obk

5 years agoAuto merge of #57355 - arielb1:correct-subst, r=nikomatsakis
bors [Fri, 11 Jan 2019 12:04:24 +0000 (12:04 +0000)]
Auto merge of #57355 - arielb1:correct-subst, r=nikomatsakis

use the correct supertrait substitution in `object_ty_for_trait`

beta-nominating because regression.

Fixes #57156.

5 years agoRemove unneeded but benign change
Oliver Scherer [Fri, 11 Jan 2019 11:19:08 +0000 (12:19 +0100)]
Remove unneeded but benign change

5 years agoFix undefined behavior
Jethro Beekman [Fri, 11 Jan 2019 09:30:08 +0000 (15:00 +0530)]
Fix undefined behavior

5 years agoAdd a profiles section to the manifest
Nick Cameron [Fri, 11 Jan 2019 05:13:45 +0000 (18:13 +1300)]
Add a profiles section to the manifest

5 years agoAddress comments
John Kåre Alsaker [Fri, 11 Jan 2019 03:58:46 +0000 (04:58 +0100)]
Address comments

5 years agoUpdate tests
John Kåre Alsaker [Tue, 1 Jan 2019 18:08:25 +0000 (19:08 +0100)]
Update tests

5 years agoMake more passes incremental
John Kåre Alsaker [Wed, 6 Jun 2018 20:13:52 +0000 (22:13 +0200)]
Make more passes incremental

5 years agoadd test for pub extern crate
DebugSteven [Fri, 11 Jan 2019 02:18:46 +0000 (21:18 -0500)]
add test for pub extern crate

5 years agoinline pub extern crate statements
DebugSteven [Fri, 11 Jan 2019 01:27:44 +0000 (20:27 -0500)]
inline pub extern crate statements

5 years agoRemove submodule step from README
Nick Cameron [Fri, 11 Jan 2019 01:27:12 +0000 (14:27 +1300)]
Remove submodule step from README

Since the bootstrap does it now

5 years agoAuto merge of #57471 - Aaronepower:master, r=Aaronepower
bors [Fri, 11 Jan 2019 00:20:04 +0000 (00:20 +0000)]
Auto merge of #57471 - Aaronepower:master, r=Aaronepower

Updated RELEASES.md for 1.32.0

[Rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release

5 years agoUpdate RELEASES.md
Aaron Power [Thu, 10 Jan 2019 22:28:18 +0000 (23:28 +0100)]
Update RELEASES.md

5 years agoUpdate src/libstd/path.rs
Mazdak Farrokhzad [Thu, 10 Jan 2019 22:08:42 +0000 (17:08 -0500)]
Update src/libstd/path.rs

Co-Authored-By: steveklabnik <steve@steveklabnik.com>
5 years agonote that FromStr does not work for borrowed types
Steve Klabnik [Thu, 10 Jan 2019 20:40:05 +0000 (15:40 -0500)]
note that FromStr does not work for borrowed types

Fixes #47757

5 years agoUpdate RELEASES.md
Aaron Power [Thu, 10 Jan 2019 22:07:38 +0000 (23:07 +0100)]
Update RELEASES.md

5 years agoAuto merge of #57484 - alexcrichton:fix-nightlies, r=Mark-Simulacru
bors [Thu, 10 Jan 2019 21:31:34 +0000 (21:31 +0000)]
Auto merge of #57484 - alexcrichton:fix-nightlies, r=Mark-Simulacru

Integrate miri into build-manifest

This fixes a mistake where miri was accidentally left out of the
build-manifest parsing, meaning that today's nightly generated a
manifest with invalid urls!

Fixes #57488.

5 years agomake note of one more normalization that Paths do
Steve Klabnik [Thu, 10 Jan 2019 20:30:36 +0000 (15:30 -0500)]
make note of one more normalization that Paths do

Fixes #29008

5 years agoAdd a fast path for identical regions in lub_concrete_regions
Björn Steinbrink [Thu, 10 Jan 2019 18:28:42 +0000 (19:28 +0100)]
Add a fast path for identical regions in lub_concrete_regions

In functions with lots of region constraint, if the fixed point
iteration converges only slowly, a lot of the var/var constraints will
have equal regions most of the time. Yet, we still perform the LUB
calculation and try to intern the result. Especially the latter incurs
quite some overhead.

This reduces the take taken by the item bodies checking pass for the
unicode_normalization crate by about 75%.

5 years agoDrop "solved" constraints during region expansion
Björn Steinbrink [Wed, 9 Jan 2019 17:40:30 +0000 (18:40 +0100)]
Drop "solved" constraints during region expansion

Once a region has been expanded to cover a fixed region, a corresponding
RegSubVar constraint won't have any effect on the expansion anymore, the
same is true for constraints where the variable on the RHS has already
reached static scope. By removing those constraints from the set that
we're iterating over, we remove a lot of needless overhead in case of
slow convergences (i.e. lots of iterations).

For the unicode_normalization crate, this about cuts the time required
for item_bodies checking in half.

5 years agouse structured suggestion when casting a reference
Andy Russell [Thu, 10 Jan 2019 18:42:59 +0000 (13:42 -0500)]
use structured suggestion when casting a reference