Commit Graph

80710 Commits

Author SHA1 Message Date
kennytm ae9c550415
Rollup merge of #52510 - QuietMisdreavus:redirects-are-cool, r=nrc
rustdoc: remove FIXME about macro redirects

Based on the discussion in #35705, the rustdoc team has determined that macro redirects are here to stay.

Closes #35705
2018-07-19 05:46:10 +08:00
kennytm 8336f1b171
Rollup merge of #52418 - estebank:desugaring-type, r=nikomatsakis
Do not use desugared ident when suggesting adding a type

Re #51116.
2018-07-19 05:45:16 +08:00
QuietMisdreavus 5d5414480c
remove FIXME about macro redirects
Based on the discussion in #35705, the rustdoc team has determined that macro redirects are here to stay.

Closes #35705
2018-07-18 15:41:13 -05:00
Esteban Küber 2c5b60d8f0 Update test output 2018-07-18 10:04:10 -07:00
Esteban Küber 4c96932da7 Change label span to point at iterator instead of iter item 2018-07-18 10:02:15 -07:00
Esteban Küber ed362c07ff Do not use desugared ident when suggesting adding a type 2018-07-18 10:02:15 -07:00
kennytm b1c6b76739
Rollup merge of #52480 - ljedrz:cleanup_24958, r=oli-obk
Cleanup #24958

Since #24958 was closed we might want to remove the workarounds it introduced for android, arm and aarch64.
2018-07-19 01:00:33 +08:00
kennytm 9fe86e566d
Rollup merge of #51628 - euclio:line-writer, r=frewsxcv
use checked write in `LineWriter` example

The example was wrong because it didn't check the return value of
`write()`, and it didn't flush the buffer before comparing the contents
of the file.

Fixes #51621.
2018-07-19 00:59:47 +08:00
kennytm 1e5a8c65c1
Rollup merge of #52487 - alexcrichton:build-less-sanitizers, r=kennytm
Don't build twice the sanitizers on Linux

This commit is an attempted fix at #50887. It was noticed that on that issue
we're building both x86_64 and i386 versions of libraries, but we only actually
need the x86_64 versions! This hopes that the build race condition exhibited
in #50887 is connected to building both architectures and/or building a lot of
libraries, so this should help us build precisely what we need and no more.
2018-07-19 00:58:55 +08:00
Alex Crichton 2e5d925926 Don't build twice the sanitizers on Linux
This commit is an attempted fix at #50887. It was noticed that on that issue
we're building both x86_64 and i386 versions of libraries, but we only actually
need the x86_64 versions! This hopes that the build race condition exhibited
in #50887 is connected to building both architectures and/or building a lot of
libraries, so this should help us build precisely what we need and no more.
2018-07-18 07:44:11 -07:00
kennytm 091c9d2eed
Rollup merge of #52477 - frewsxcv:frewsxcv-iter-short, r=alexcrichton
Clarify short-circuiting behvaior of Iterator::zip.

Fixes https://github.com/rust-lang/rust/issues/52279.
2018-07-18 22:35:04 +08:00
kennytm 5624d2a292
Rollup merge of #52472 - alexcrichton:macros-edition-2018, r=petrochenkov
rustc: Enable `use_extern_macros` in 2018 edition

This was previously enabled via `proc_macro`, but since `proc_macro` is now
stable this is no longer the case. Explicitly include it in the 2018 edition
here.
2018-07-18 22:35:03 +08:00
kennytm fa9f91d9b1
Rollup merge of #52464 - o01eg:patch-1, r=alexcrichton
Allow clippy to be installed with make install

After #51122 clippy is available as a component but doesn't install when building from source.

This PR allows to install clippy with extended tools.
2018-07-18 22:35:01 +08:00
kennytm 5dd3275237
Rollup merge of #52458 - alexcrichton:fix-suggestion, r=petrochenkov
rustc: Fix a suggestion for the `proc_macro` feature

This feature is stable, we shouldn't suggest it any more! Instead suggest the
real feature, `use_extern_macros`.
2018-07-18 22:35:00 +08:00
kennytm d94a279538
Rollup merge of #52455 - felixrabe:patch-1, r=estebank
Fix doc comment: use `?` instead of `.unwrap()`
2018-07-18 22:34:59 +08:00
kennytm 47a1d6b183
Rollup merge of #52439 - o01eg:fix-52317, r=alexcrichton
Revert some changes from #51917 to fix custom libdir

Should fix #52317 also adds `libdir` value to output.
2018-07-18 22:34:57 +08:00
kennytm 21f7d2b674
Rollup merge of #52218 - rivertam:patch-1, r=withoutboats
Amend option.take examples

It wasn't abundantly clear to me what `.take` returned. Perhaps this is a slightly frivolous change, but I think it's an improvement. =)

Apologies if I'm not following proper procedures.
2018-07-18 22:34:56 +08:00
kennytm 2712fbed24
Rollup merge of #52116 - Pazzaz:match-str-case, r=SimonSapin
Handle array manually in str case conversion methods

Avoiding the overhead incurred from `String.extend(char.to_lowercase())` showed a notable performance improvement when I benchmarked it.

I tested on these strings:
```rust
ALL_LOWER:       "loremipsumdolorsitametduosensibusmnesarchumabcdefgh"
ALL_UPPER:       "LOREMIPSUMDOLORSITAMETDUOSENSIBUSMNESARCHUMABCDEFGH"
REALISTIC_UPPER: "LOREM IPSUM DOLOR SIT AMET, DUO SENSIBUS MNESARCHUM"
SIGMAS:          "ΣΣΣΣΣ ΣΣΣΣΣ ΣΣΣΣΣ ΣΣΣ ΣΣΣΣ, ΣΣΣ ΣΣΣΣΣΣΣΣ ΣΣΣΣΣΣΣΣΣΣ"
WORD_UPPER:      "Lorem Ipsum Dolor Sit Amet, Duo Sensibus Mnesarchum"
```
the performance improvements of `to_lowercase()` were
```
running 10 tests
test tests::all_lower           ... bench:       1,752 ns/iter (+/- 49)
test tests::all_lower_new       ... bench:       1,266 ns/iter (+/- 15)   -28%
test tests::all_upper           ... bench:       1,832 ns/iter (+/- 39)
test tests::all_upper_new       ... bench:       1,337 ns/iter (+/- 18)   -27%
test tests::realistic_upper     ... bench:       1,993 ns/iter (+/- 14)
test tests::realistic_upper_new ... bench:       1,445 ns/iter (+/- 22)   -27%
test tests::sigmas              ... bench:       1,342 ns/iter (+/- 39)
test tests::sigmas_new          ... bench:       1,226 ns/iter (+/- 16)    -9%
test tests::word_upper          ... bench:       1,899 ns/iter (+/- 12)
test tests::word_upper_new      ... bench:       1,381 ns/iter (+/- 26)   -27%
```
and of `to_uppercase()`
```
running 10 tests
test tests::all_lower           ... bench:       1,813 ns/iter (+/- 20)
test tests::all_lower_new       ... bench:       1,321 ns/iter (+/- 16)   -27%
test tests::all_upper           ... bench:       1,629 ns/iter (+/- 22)
test tests::all_upper_new       ... bench:       1,241 ns/iter (+/- 9)    -24%
test tests::realistic_upper     ... bench:       1,670 ns/iter (+/- 24)
test tests::realistic_upper_new ... bench:       1,241 ns/iter (+/- 17)   -26%
test tests::sigmas              ... bench:       2,053 ns/iter (+/- 20)
test tests::sigmas_new          ... bench:       1,753 ns/iter (+/- 23)   -15%
test tests::word_upper          ... bench:       1,873 ns/iter (+/- 30)
test tests::word_upper_new      ... bench:       1,412 ns/iter (+/- 25)   -25%
```
I gave up on the more advanced method from #52061 as it wasn't always a clear improvement and would help in even less cases if this PR was merged.
2018-07-18 22:34:54 +08:00
ljedrz ef2bac4f10 Remove workarounds for #24958 2018-07-18 13:58:08 +02:00
bors 29ee65411c Auto merge of #52364 - ljedrz:mir_remove_clone, r=RalfJung
Remove a clone in mir/transform/add_validation

Remove a clone of `mir.local_decls`.
2018-07-18 11:49:38 +00:00
bors 38168a77d7 Auto merge of #52426 - ljedrz:#28273_cleanup, r=nikomatsakis
Enable default inlining in platform intrinsics

Since [#28273](https://github.com/rust-lang/rust/issues/28273) has been fixed for quite some time, it might be a good idea to return to default inlining in platform intrinsics.
2018-07-18 09:10:16 +00:00
Corey Farwell 2d4011db07 Clarify short-circuiting behvaior of Iterator::zip.
Fixes https://github.com/rust-lang/rust/issues/52279.
2018-07-17 23:39:37 -04:00
bors cd5f5a129f Auto merge of #52353 - alexcrichton:wasm-custom-section, r=eddyb
rustc: Use link_section, not wasm_custom_section

This commit transitions definitions of custom sections on the wasm target from
the unstable `#[wasm_custom_section]` attribute to the
already-stable-for-other-targets `#[link_section]` attribute. Mostly the same
restrictions apply as before, except that this now applies only to statics.

Closes #51088
2018-07-18 03:05:27 +00:00
bors f686885a14 Auto merge of #52342 - nnethercote:CanonicalVar, r=nikomatsakis
Avoid most allocations in `Canonicalizer`.

Extra allocations are a significant cost of NLL, and the most common
ones come from within `Canonicalizer`. In particular, `canonical_var()`
contains this code:

    indices
	.entry(kind)
	.or_insert_with(|| {
	    let cvar1 = variables.push(info);
	    let cvar2 = var_values.push(kind);
	    assert_eq!(cvar1, cvar2);
	    cvar1
	})
	.clone()

`variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used
to track what elements have been inserted into `var_values`. If `kind`
hasn't been seen before, `indices`, `variables` and `var_values` all get
a new element. (The number of elements in each container is always the
same.) This results in lots of allocations.

In practice, most of the time these containers only end up holding a few
elements. This PR changes them to avoid heap allocations in the common
case, by changing the `Vec`s to `SmallVec`s and only using `indices`
once enough elements are present. (When the number of elements is small,
a direct linear search of `var_values` is as good or better than a
hashmap lookup.)

The changes to `variables` are straightforward and contained within
`Canonicalizer`. The changes to `indices` are more complex but also
contained within `Canonicalizer`. The changes to `var_values` are more
intrusive because they require defining a new type
`SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as
`SmallVec` is to `Vec -- and passing stack-allocated values of that type
in from outside.

All this speeds up a number of NLL "check" builds, the best by 2%.

r? @nikomatsakis
2018-07-18 00:45:57 +00:00
Alex Crichton 5ecec1c58b rustc: Enable `use_extern_macros` in 2018 edition
This was previously enabled via `proc_macro`, but since `proc_macro` is now
stable this is no longer the case. Explicitly include it in the 2018 edition
here.
2018-07-17 14:49:53 -07:00
bors 4f3c7a472b Auto merge of #52145 - ExpHP:drop-it-like-its-eof, r=nikomatsakis
Fix macro parser quadratic complexity in small repeating groups

Observed in #51754, and more easily demonstrated with the following:

```rust
macro_rules! stress {
    ($($t:tt)+) => { };
}

fn main() {
    stress!{
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        //    ... 65536 copies of "a" total ...
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
        a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
    }
}
```
which takes 50 seconds to compile prior to the fix and <1s after.

I hope this has a visible impact on the compile times for real code.  (I think it is most likely to affect incremental TT munchers that deal with large inputs, though it depends on how they are written)

For a fuller description of the performance issue:  https://github.com/rust-lang/rust/issues/51754#issuecomment-403242159

---

There is no test (yet) because I'm not sure how easily to measure this for regressions.
2018-07-17 19:28:23 +00:00
O01eg 3df43098a4
Allow clippy to be installed with make install
After #51122 clippy is available as a component but don't install when building from source.

This PR allows to install clippy with extended tools.
2018-07-17 19:39:54 +03:00
bors 1c84d81873 Auto merge of #52404 - felixrabe:doc-link-ch19-04-typo, r=GuillaumeGomez
Fix doc link

Result of first searching via:

    find src -type f -exec fgrep -l dynamically-sized-types--sized {} \;

and then replacing all relevant occurrences via:

    find src/{libcore,test/ui} -type f -exec sed -i.bak \
      s/dynamically-sized-types--sized/dynamically-sized-types-and-sized/g {} \;
    find src -type f -name '*.bak' -exec rm {} \;

(Note: Commands run on macOS 10.13 (BSD).  `sed -i.bak` should work on
GNU/Linux as well, but not tested.)

EDIT: Did not compile / test Rust for this change at all.

Clickable links for comparison:
https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized (broken)
https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (fixed)
2018-07-17 15:39:33 +00:00
Alex Crichton bb2398f8e9 rustc: Fix a suggestion for the `proc_macro` feature
This feature is stable, we shouldn't suggest it any more! Instead suggest the
real feature, `use_extern_macros`.
2018-07-17 07:14:54 -07:00
bors 4bff385fda Auto merge of #52433 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

Successful merges:

 - #52286 (Deny bare trait objects in src/librustc_errors)
 - #52306 (Reduce the number of clone()s needed in obligation_forest)
 - #52338 (update miri)
 - #52385 (Pass edition flags to compiler from rustdoc as expected)
 - #52392 (AsRef doc wording tweaks)
 - #52430 (update nomicon)
 - #52434 (Enable incremental independent of stage)
 - #52435 (Calculate the exact capacity for 2 HashMaps)
 - #52446 (Block beta if clippy breaks.)

r? @ghost
2018-07-17 13:31:35 +00:00
Felix Rabe a65d535c5f
Fix doc comment: use `?` instead of `.unwrap()` 2018-07-17 14:18:58 +02:00
Felix Rabe 88e9af0375 Fix doc link
The link for comparison:

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized (broken)

-   https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (fixed)

This commit is the result of (first) searching via:

    find src -type f -print0 | xargs -0 fgrep -l dynamically-sized-types--sized

and then replacing all relevant occurrences via:

    find src/{libcore,test/ui} -type f -print0 | xargs -0 sed -i.bak \
      s/dynamically-sized-types--sized/dynamically-sized-types-and-sized/g
    find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm

(Note: Commands run on macOS 10.13 (BSD).  `sed -i.bak` should work on
GNU/Linux as well, but not tested.)
2018-07-17 14:10:11 +02:00
bors 025e04e1bc Auto merge of #52190 - davidtwco:issue-52028, r=nikomatsakis
html5ever in the rustc-perf repository is memory-intensive

Part of #52028. Rebased atop of #51987.

r? @nikomatsakis
2018-07-17 11:31:53 +00:00
kennytm c0db1aafea
Rollup merge of #52385 - GuillaumeGomez:pass-edition-to-parser, r=QuietMisdreavus
Pass edition flags to compiler from rustdoc as expected

Fixes #52357.
2018-07-17 19:24:57 +08:00
kennytm c052a491f1
Rollup merge of #52446 - kennytm:block-beta-on-clippy, r=nrc
Block beta if clippy breaks.

Also, don't fail master pull request when an unrelated tool is not test-pass.
2018-07-17 19:24:55 +08:00
kennytm 9ea0a8533e
Rollup merge of #52434 - Mark-Simulacrum:incremental-keep-stage, r=alexcrichton
Enable incremental independent of stage

Previously we'd only do so for stage 0 but with keep-stage
improvements it seems likely that we'll see more developers working in
the stage 1, so we should allow enabling incremental for them.
2018-07-17 19:24:53 +08:00
kennytm a07f213974
Rollup merge of #52338 - RalfJung:miri, r=oli-obk
update miri
2018-07-17 19:24:50 +08:00
kennytm 6af3e2d707
Rollup merge of #52435 - ljedrz:misc_capacity, r=estebank
Calculate the exact capacity for 2 HashMaps
2018-07-17 19:24:48 +08:00
kennytm 2d1880893f
Rollup merge of #52306 - ljedrz:obligation_forest_clone, r=varkor
Reduce the number of clone()s needed in obligation_forest

Some can be avoided by using `remove_entry` instead of `remove`.
2018-07-17 19:24:47 +08:00
kennytm b086b09ef8
Rollup merge of #52286 - ljedrz:dyn_librustc_errors, r=varkor
Deny bare trait objects in src/librustc_errors

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_errors`.
2018-07-17 19:24:44 +08:00
kennytm 68b292887d
Rollup merge of #52430 - RalfJung:nomicon, r=kennytm
update nomicon

Will this trigger a website update automatically or is that a separate step?
2018-07-17 19:24:42 +08:00
Ralf Jung 9e10b12f33 update miri 2018-07-17 11:40:57 +02:00
Ralf Jung 114dc69166 update miri (Windows tests fixed) 2018-07-17 11:40:57 +02:00
Ralf Jung f684f80e95 update miri 2018-07-17 11:40:57 +02:00
bors 2ddc0cbd56 Auto merge of #52335 - nnethercote:BitSlice-fixes, r=nikomatsakis
`BitSlice` fixes

`propagate_bits_into_entry_set_for` and `BitSlice::bitwise` are hot for some benchmarks under NLL. I tried and failed to speed them up. (Increasing the size of `bit_slice::Word` from `usize` to `u128` caused a slowdown, even though decreasing the size of `bitvec::Word` from `u128` to `u64` also caused a slowdown. Weird.)

Anyway, along the way I fixed up several problems in and around the `BitSlice` code.

r? @nikomatsakis
2018-07-17 09:26:22 +00:00
bors 9d6f4e5eea Auto merge of #52409 - estebank:move-cfail-ui, r=oli-obk
Move some `compile-fail` tests to `ui`

Re: #44844.
2018-07-17 06:52:20 +00:00
David Wood 8b94d1605b Generate region values directly to reduce memory usage.
Also modify `SparseBitMatrix` so that it does not require knowing the
dimensions in advance, but instead grows on demand.
2018-07-16 23:46:14 -04:00
Nicholas Nethercote 7cc527770d Avoid most allocations in `Canonicalizer`.
Extra allocations are a significant cost of NLL, and the most common
ones come from within `Canonicalizer`. In particular, `canonical_var()`
contains this code:

    indices
	.entry(kind)
	.or_insert_with(|| {
	    let cvar1 = variables.push(info);
	    let cvar2 = var_values.push(kind);
	    assert_eq!(cvar1, cvar2);
	    cvar1
	})
	.clone()

`variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used
to track what elements have been inserted into `var_values`. If `kind`
hasn't been seen before, `indices`, `variables` and `var_values` all get
a new element. (The number of elements in each container is always the
same.) This results in lots of allocations.

In practice, most of the time these containers only end up holding a few
elements. This PR changes them to avoid heap allocations in the common
case, by changing the `Vec`s to `SmallVec`s and only using `indices`
once enough elements are present. (When the number of elements is small,
a direct linear search of `var_values` is as good or better than a
hashmap lookup.)

The changes to `variables` are straightforward and contained within
`Canonicalizer`. The changes to `indices` are more complex but also
contained within `Canonicalizer`. The changes to `var_values` are more
intrusive because they require defining a new type
`SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as
`SmallVec` is to `Vec -- and passing stack-allocated values of that type
in from outside.

All this speeds up a number of NLL "check" builds, the best by 2%.
2018-07-17 13:42:11 +10:00
Esteban Küber 82fd8d74cd Return tests that have platform dependant output 2018-07-16 20:26:32 -07:00
bors 31263f3204 Auto merge of #52285 - ljedrz:dyn_librustc_driver, r=nikomatsakis
Deny bare trait objects in librustc_driver

Enforce `#![deny(bare_trait_objects)]` in `src/librustc_driver`.
2018-07-17 02:50:14 +00:00