Commit Graph

88351 Commits

Author SHA1 Message Date
Nicholas Nethercote
8780ebff1f Remove CrateNum::Invalid.
It's unused.
2019-01-08 16:13:22 +11:00
Dylan MacKenzie
68b8b438c3 Add link destination for read-ownership 2019-01-07 21:03:41 -08:00
Nicholas Nethercote
e80a93040f Make TokenStream less recursive.
`TokenStream` is currently recursive in *two* ways:

- the `TokenTree` variant contains a `ThinTokenStream`, which can
  contain a `TokenStream`;

- the `TokenStream` variant contains a `Vec<TokenStream>`.

The latter is not necessary and causes significant complexity. This
commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`.

This reduces complexity significantly. In particular, `StreamCursor` is
eliminated, and `Cursor` becomes much simpler, consisting now of just a
`TokenStream` and an index.

The commit also removes the `Extend` impl for `TokenStream`, because it
is only used in tests. (The commit also removes those tests.)

Overall, the commit reduces the number of lines of code by almost 200.
2019-01-08 15:08:46 +11:00
Alex Crichton
d58555323f Build LLVM with -static-libstdc++ on dist builds
This commit is intended on fixing a regression from #57286 where the
distributed LLVM shared library unfortunately depends on a dynamic copy
of libstdc++, meaning we're no longer as binary compatible as we
thought! This tweaks the build of LLVM as out distribution is slightly
different now, and is hoped to fix the issue.

Closes #57426
2019-01-07 19:48:16 -08:00
bors
9d54812829 Auto merge of #57095 - Zoxc:prof-fix, r=michaelwoerister
Fix and optimize query profiling

r? @michaelwoerister

cc @wesleywiser
2019-01-08 02:00:12 +00:00
Igor Matuszewski
eed163e110 save-analysis: use a fallback when access levels couldn't be computed 2019-01-08 01:02:13 +01:00
Taylor Cramer
68e98a2a85 Reborrow Pin<P> using &mut in Pin::set
This makes it possible to call `.set` multiple times without
using `.as_mut()` first to reborrow the pointer.
2019-01-07 11:45:34 -08:00
bors
8e2063d020 Auto merge of #57303 - matthiaskrgr:clippy_submodule_upd, r=oli-obk
submodules: update clippy and rls

Fixes clippy toolstate

Changes:
````
Update to latest compiletest-rs release
add testcase for #3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
UI test cleanup: Extract ifs_same_cond tests
UI test cleanup: Extract for_kv_map lint tests
Fix test for rust-lang/rust#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````

Also updates RLS and removes the patching of rustc_tool_utils from cargo.toml

RLS changes:
````
update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io
Work around https://github.com/rust-lang/rust/pull/55937
Update Clippy... again
Update Clippy
Update clippy
````
r? @oli-obk
2019-01-07 19:44:00 +00:00
dylan_DPC
13f8ad8897 bless you 2019-01-08 00:21:38 +05:30
dylan_DPC
6ddd2cdc5b remove unwanted stage0 line, fix style 2019-01-08 00:21:16 +05:30
dylan_DPC
64a17a0e59 remove unused imports and feature gate from tests 2019-01-08 00:21:07 +05:30
dylan_DPC
1ef99f1353 stabilise cfg_attr 2019-01-08 00:17:03 +05:30
Matthias Krüger
c5101b6dff Revert "Auto merge of #57101 - o01eg:fix-57014, r=alexcrichton"
This reverts commit 68614265d3, reversing
changes made to cae623c5ce.

Should fix tools on windows.

Reopens #57014
2019-01-07 18:57:41 +01:00
Matthias Krüger
495fc5ee9d submodules: update rls from 6f5e4bb to 1a6361b
Changes:
````
Update Clippy
Move TestFailures when collecting failures
Update languageserver-types to 0.51.1
update clippy hash and rustc_tools_util and use rustc_tools_util from crates.io
Work around https://github.com/rust-lang/rust/pull/55937
Update Clippy... again
Update Clippy
Update clippy
````
2019-01-07 18:57:21 +01:00
Matthias Krüger
c09d4e7b0f submodules: update clippy from 39bd8449 to c63b6349
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of #3603 - xfix:random-state-lint, r=phansch"
rustup https://github.com/rust-lang/rust/pull/56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: https://github.com/rust-lang/rust/pull/55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in #1279
Update to latest compiletest-rs release
add testcase for #3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang/rust#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
2019-01-07 18:56:15 +01:00
John Kåre Alsaker
23c742cce7 Rename some functions 2019-01-07 18:50:51 +01:00
John Kåre Alsaker
66fe06b1b9 Fix and optimize query profiling 2019-01-07 18:47:19 +01:00
Yuki Okushi
6a790d3786 Improve the wording 2019-01-08 02:32:14 +09:00
QuietMisdreavus
dac6eeca92 semi-revert libsyntax doctest parsing if a macro is wrapping main 2019-01-07 11:25:39 -06:00
bors
59e70f2775 Auto merge of #57405 - pietroalbini:rollup, r=pietroalbini
Rollup of 6 pull requests

Successful merges:

 - #57290 (remove outdated comment)
 - #57308 (Make CompileController thread-safe)
 - #57358 (use utf-8 throughout htmldocck)
 - #57369 (Provide the option to use libc++ even on all platforms)
 - #57375 (Add duration constants)
 - #57403 (Make extern ref HTTPS)

Failed merges:

 - #57370 (Support passing cflags/cxxflags/ldflags to LLVM build)

r? @ghost
2019-01-07 17:01:25 +00:00
Alex Crichton
255a3f3e18 std: Force Instant::now() to be monotonic
This commit is an attempt to force `Instant::now` to be monotonic
through any means possible. We tried relying on OS/hardware/clock
implementations, but those seem buggy enough that we can't rely on them
in practice. This commit implements the same hammer Firefox recently
implemented (noted in #56612) which is to just keep whatever the lastest
`Instant::now()` return value was in memory, returning that instead of
the OS looks like it's moving backwards.

Closes #48514
Closes #49281
cc #51648
cc #56560
Closes #56612
Closes #56940
2019-01-07 08:00:47 -08:00
Pietro Albini
6031f1302b
Rollup merge of #57403 - claudijd:tweak_code_of_conduct, r=alexcrichton
Make extern ref HTTPS

Basically, saw an HTTP link and noticed it could be HTTPS.  When visiting the link, the URL pattern changed on the site since last linking, so fixed that too!
2019-01-07 16:25:41 +01:00
Pietro Albini
bc38143ad2
Rollup merge of #57375 - stjepang:duration-constants, r=joshtriplett
Add duration constants

Add constants `SECOND`, `MILLISECOND`, `MICROSECOND`, and `NANOSECOND` to `core::time`.

This will make working with durations more ergonomic. Compare:

```rust
// Convenient, but deprecated function.
thread::sleep_ms(2000);

// The current canonical way to sleep for two seconds.
thread::sleep(Duration::from_secs(2));

// Sleeping using one of the new constants.
thread::sleep(2 * SECOND);
```
2019-01-07 16:25:40 +01:00
Pietro Albini
5cfc845884
Rollup merge of #57369 - petrhosek:llvm-libcxx, r=alexcrichton
Provide the option to use libc++ even on all platforms

This is the default on platforms which use libc++ as the default C++
library but this option allows using libc++ on others as well.
2019-01-07 16:25:38 +01:00
Pietro Albini
14fb35fa4f
Rollup merge of #57358 - euclio:docck-unicode, r=QuietMisdreavus
use utf-8 throughout htmldocck

This commit improves compatibility with Python 3, which already uses
Unicode throughout.

It also fixes a subtle incompatibility stemming from the use of
`entitydefs`, which contains replacement text _encoded in latin-1_ for
HTML entities. When using Python 3, this would cause `0xa0` to be
incorrectly added to the element tree.

This meant that there was a rustdoc test that would pass under Python 2
but fail under Python 3, due to an incorrect regex match against the
non-breaking space character. This commit triggers that failure in both
versions, and also fixes it.
2019-01-07 16:25:36 +01:00
Pietro Albini
e319f12cf4
Rollup merge of #57308 - Zoxc:controller-sync, r=michaelwoerister
Make CompileController thread-safe
2019-01-07 16:25:35 +01:00
Pietro Albini
c89b07aa52
Rollup merge of #57290 - mark-i-m:remove-outdated-comment, r=michaelwoerister
remove outdated comment

https://github.com/rust-lang/rust/issues/44234 was closed, apparently solved by #45353

r? @michaelwoerister
2019-01-07 16:25:33 +01:00
Jonathan Claudius
7316490fcb
Make extern ref HTTPS 2019-01-07 09:52:32 -05:00
bors
21ac19d8fe Auto merge of #57304 - davidtwco:issue-57280, r=nikomatsakis
NLL: Fix bug in associated constant type annotations.

Fixes #57280.

This PR reverses the variance used when relating types from the type
annotation of an associated constant - this matches the behaviour of the
lexical borrow checker and fixes a bug whereby matching a `&'a str`
against a `&'static str` would produce an error.

r? @nikomatsakis
2019-01-07 14:16:27 +00:00
Trevor Spiteri
d2ac094c99 Update static files code for updated Source Serif Pro font 2019-01-07 14:27:50 +01:00
Trevor Spiteri
aa257ec73e Replace Heuristica with Source Serif Pro italic in rustdoc.css 2019-01-07 14:03:46 +01:00
Trevor Spiteri
239ac2b990 Source Serif Pro regular and bold 2.007, and italic 1.007
Use fonts from the Roman 2.007 and Italic 1.007 version at:
https://github.com/adobe-fonts/source-serif-pro/releases/tag/2.007R-ro%2F1.007R-it

The following files are used from the distribution:

  * WOFF/TTF/SourceSerifPro-Regular.ttf.woff
  * WOFF/TTF/SourceSerifPro-Bold.ttf.woff
  * WOFF/TTF/SourceSerifPro-It.ttf.woff

These replace the older Source Serif Pro regular and bold fonts, and
the Heuristica italic font.
2019-01-07 14:03:29 +01:00
bors
1f7c44cdb2 Auto merge of #57336 - ehuss:bump-stage0, r=alexcrichton
Bump stage0

Updates stage 0
From: rustc 1.32.0-beta.2 (a01e4761a 2018-12-08)
To:   rustc 1.32.0-beta.11 (e64fee6a3 2019-01-04)

Intended to pull in #57292 which will fix #57142.

The following is a list of PRs this also pulls in in case anyone is interested in seeing the changes:

#56930
#56961
#57236
#57305
2019-01-07 11:31:32 +00:00
Huon Wilson
6e742dbb3f 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
6284190ef9
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));
}
```
2019-01-07 22:10:22 +11:00
Stjepan Glavina
8c902b6633 Specify the tracking issue 2019-01-07 11:39:22 +01:00
bors
474a3a9171 Auto merge of #57327 - akash-fortanix:aa/update-compiler_builtins, r=kennytm
Update compiler_builtins 0.1.2 -> 0.1.4

r? @alexcrichton
2019-01-07 08:55:49 +00:00
bors
0194bed710 Auto merge of #57394 - euclio:compiletest-optimization, r=Mark-Simulacrum
slightly optimize compiletest test collection

Save quite a few syscalls and avoiding pushing in a loop.
2019-01-07 06:17:37 +00:00
Andy Russell
2a9ad77d95
slightly optimize compiletest test collection
Save quite a few syscalls and avoiding pushing in a loop.
2019-01-06 23:23:20 -05:00
bors
a651777298 Auto merge of #57365 - sinkuu:unused, r=oli-obk
Remove unused code
2019-01-07 03:44:41 +00:00
bors
789a15a422 Auto merge of #57379 - petrochenkov:parsrecov, r=estebank
tests: Do not use `-Z parse-only`, continue compilation to test recovery

Make tests closer to reality!

The next step will be enabling `-Z continue-parse-after-error` by default and looking at the regressions.

A few instances of `-Z parse-only` are kept when it's appropriate, see e.g `ui/impl-trait/impl-trait-plus-priority.rs`, which tests mostly semantically wrong code and would generate too much useless noise if allowed to continue.
2019-01-07 01:05:45 +00:00
bors
d39dddf795 Auto merge of #57344 - petrochenkov:regreach, r=arielb1
privacy: Fix regression in impl reachability

Rollback to pre-https://github.com/rust-lang/rust/pull/56878 logic of determining reachability.
`reachability(impl Trait<Substs> for Type<Substs>) = reachability(Trait & Type)`, substs are ignored.

Fixes https://github.com/rust-lang/rust/issues/57264
2019-01-06 22:26:16 +00:00
Vadim Petrochenkov
1f64f60d5c tests: Do not use -Z parse-only, continue compilation to test recovery 2019-01-06 22:20:46 +03:00
Guillaume Gomez
47e294e758 check missing docs for reexported macros as well 2019-01-06 18:55:55 +01:00
akashfortanix
3033304936 Update compiler_builtins 0.1.2 -> 0.1.4 2019-01-06 22:15:34 +05:30
bors
b92552d557 Auto merge of #57272 - petrochenkov:featrecov, r=estebank
Make sure feature gate errors are recoverable (take 2)

Continuation of 15cefe4b2a.
Turns out I missed the most important part - the main feature gate checking pass.
2019-01-06 15:40:58 +00:00
bors
6b2c311718 Auto merge of #57121 - glaubitz:flock-fixes, r=nagisa
flock: Use fcntl constants directly from libc crate on Unix targets

Since the values for the fcntl constants can vary from architecture
to architecture, it is better to use the values defined in the libc
crate instead of assigning literals in the flock code which would
make the assumption that all architectures use the same values.

Fixes #57007
2019-01-06 13:05:11 +00:00
Stjepan Glavina
72ec5aa080 Re-export constants from core into std 2019-01-06 14:04:07 +01:00
Stjepan Glavina
7f7a2e9396 Add duration constants 2019-01-06 13:44:55 +01:00
Vadim Petrochenkov
37511771db Fix CI failures 2019-01-06 15:35:39 +03:00
Vadim Petrochenkov
10a00e120d Make sure feature gate errors are recoverable (take 2) 2019-01-06 14:58:17 +03:00