Commit Graph

106878 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
0425379195 parser: inline parse_assoc_fn and friends. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
b05e9d2b4d parser: solidify fn parsing with parse_fn. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
a833be2162 parser: fuse free fn parsing together. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
36a17e4067 parser_fn_front_matter: allow const .. extern 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
c30f068dc8 IsAsync -> enum Async { Yes { span: Span, .. }, No }
use new span for better diagnostics.
2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
e839b2ec84 Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-13 10:39:23 +01:00
Jethro Beekman
57a62f5335 Add comment to SGX entry code 2020-02-13 10:16:28 +01:00
Andreas Jonson
cec0ed0219 add selfprofiling for new llvm passmanager 2020-02-13 08:02:18 +01:00
bors
2e6eaceede Auto merge of #69118 - Dylan-DPC:rollup-7hpm1fj, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #67642 (Relax bounds on HashMap/HashSet)
 - #68848 (Hasten macro parsing)
 - #69008 (Properly use parent generics for opaque types)
 - #69048 (Suggestion when encountering assoc types from hrtb)
 - #69049 (Optimize image sizes)
 - #69050 (Micro-optimize the heck out of LEB128 reading and writing.)
 - #69068 (Make the SGX arg cleanup implementation a NOP)
 - #69082 (When expecting `BoxFuture` and using `async {}`, suggest `Box::pin`)
 - #69104 (bootstrap: Configure cmake when building sanitizer runtimes)

Failed merges:

r? @ghost
2020-02-13 04:57:41 +00:00
Dylan DPC
1ddf2504fd
Rollup merge of #69104 - tmiasko:configure-cmake, r=Mark-Simulacrum
bootstrap: Configure cmake when building sanitizer runtimes

Configure cmake before building sanitizer runtimes in similar way it is already
configured elsewhere, to ensure that they are built with expected compiler
flags.

Previously this step has been intentionally omitted since sanitizer runtimes
are built as universal binaries on Darwin targets, which in turn are
unsupported by sccache which is also configured there. To avoid the issue
everything but the compiler launcher is configured.

Helps with #68863.
2020-02-13 02:52:59 +01:00
Dylan DPC
ec5bf15c5d
Rollup merge of #69082 - estebank:boxfuture-box-pin, r=tmandry
When expecting `BoxFuture` and using `async {}`, suggest `Box::pin`

Fix #68197, cc #69083.
2020-02-13 02:52:57 +01:00
Dylan DPC
2501a10670
Rollup merge of #69068 - Goirad:make-sgx-arg-cleanup-nop, r=jethrogb,nagisa
Make the SGX arg cleanup implementation a NOP

fixes #64304

cc @jethrogb
2020-02-13 02:52:56 +01:00
Dylan DPC
a50a896755
Rollup merge of #69050 - nnethercote:micro-optimize-leb128, r=michaelwoerister
Micro-optimize the heck out of LEB128 reading and writing.

This commit makes the following writing improvements:
- Removes the unnecessary `write_to_vec` function.
- Reduces the number of conditions per loop from 2 to 1.
- Avoids a mask and a shift on the final byte.

And the following reading improvements:
- Removes an unnecessary type annotation.
- Fixes a dangerous unchecked slice access. Imagine a slice `[0x80]` --
  the current code will read past the end of the slice some number of
  bytes. The bounds check at the end will subsequently trigger, unless
  something bad (like a crash) happens first. The cost of doing bounds
  check in the loop body is negligible.
- Avoids a mask on the final byte.

And the following improvements for both reading and writing:
- Changes `for` to `loop` for the loops, avoiding an unnecessary
  condition on each iteration. This also removes the need for
  `leb128_size`.

All of these changes give significant perf wins, up to 5%.

r? @michaelwoerister
2020-02-13 02:52:54 +01:00
Dylan DPC
53a790c58a
Rollup merge of #69049 - pthariensflame:improvement/imgbot, r=GuillaumeGomez
Optimize image sizes

This was done by [ImgBot](https://imgbot.net/) on my own fork, which I then immediately merged and turned into this manual pull request. Below is reproduced [ImgBot's own message](https://github.com/pthariensflame/rust/pull/3#issue-373452394) on the content of this PR.

r? @steveklabnik since this is a documentation PR, I guess.

---

> ## Beep boop. Your images are optimized!
>
> Your image file size has been reduced by **21%** 🎉
>
> <details>
> <summary>
> Details
> </summary>
>
> | File | Before | After | Percent reduction |
> |:--|:--|:--|:--|
> | /src/etc/installer/gfx/rust-logo.png | 5.71kb | 3.82kb | 33.11% |
> | /src/librustdoc/html/static/down-arrow.svg | 0.63kb | 0.50kb | 20.44% |
> | /src/librustdoc/html/static/wheel.svg | 3.86kb | 3.68kb | 4.66% |
> | /src/librustdoc/html/static/brush.svg | 0.47kb | 0.44kb | 4.61% |
> | | | | |
> | **Total :** | **10.65kb** | **8.44kb** | **20.82%** |
> </details>
>
> ---
>
> [📝docs](https://imgbot.net/docs) | [:octocat: repo](https://github.com/dabutvin/ImgBot) | [🙋issues](https://github.com/dabutvin/ImgBot/issues) | [🏅swag](https://goo.gl/forms/1GX7wlhGEX8nkhGO2) | [🏪marketplace](https://github.com/marketplace/imgbot)
2020-02-13 02:52:53 +01:00
Dylan DPC
8d00adf289
Rollup merge of #69048 - estebank:hrlt-assoc, r=nagisa
Suggestion when encountering assoc types from hrtb

When encountering E0212, detect whether this is a representable case or
not, i.e. if it's happening on an `fn` or on an ADT. If the former,
provide a structured suggestion, otherwise note that this can't be
represented in Rust.

Fix #69000.
2020-02-13 02:52:51 +01:00
Dylan DPC
e9f391e09a
Rollup merge of #69008 - Aaron1011:fix/opaque-ty-parent, r=matthewjasper
Properly use parent generics for opaque types

Fixes #67844

Previously, opaque types would only get parent generics if they
a return-position-impl-trait (e.g. `fn foo<A>() -> impl MyTrait<A>`).

However, it's possible for opaque types to be nested inside one another:

```rust
trait WithAssoc { type AssocType; }

trait WithParam<A> {}

type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;
```

When this occurs, we need to ensure that the nested opaque types
properly inherit generic parameters from their parent opaque type.

This commit fixes the `generics_of` query to take the parent item
into account when determining the generics for an opaque type.
2020-02-13 02:52:49 +01:00
Dylan DPC
87ba8f2a19
Rollup merge of #68848 - nnethercote:hasten-macro-parsing, r=petrochenkov
Hasten macro parsing

r? @eddyb
2020-02-13 02:52:48 +01:00
Dylan DPC
2a201336ed
Rollup merge of #67642 - Mark-Simulacrum:relax-bounds, r=Amanieu
Relax bounds on HashMap/HashSet

These APIs changed from the old bound listed to the new bound (possibly empty):

K: Hash + Eq -> K
* new
* with_capacity

K: Eq + Hash, S: BuildHasher -> K, S
* with_hasher
* with_capacity_and_hasher
* hasher

K: Eq + Hash + Debug -> K: Debug
S: BuildHasher -> S
HashMap as Debug

K: Eq + Hash -> K
S: BuildHasher + Default -> S: Default
HashMap as Default

Resolves #44777.
2020-02-13 02:52:46 +01:00
bors
ba18875557 Auto merge of #69097 - Xanewok:update-rls-rustfmt, r=Dylan-DPC
Update RLS and Rustfmt

Bumps `rustc-ap-*` packages to v642.

Closes #68916.
Closes #68917.

cc @topecongiro
2020-02-13 01:40:54 +00:00
Esteban Küber
248f5a4046 Add trait Self filtering to rustc_on_unimplemented 2020-02-12 17:26:49 -08:00
Tomasz Miąsko
91b4a24219 Enable use after scope detection in the new LLVM pass manager
Implementation of 08a1c566a7 for the new
LLVM pass manager, support for which landed in the meantime.
2020-02-13 00:00:00 +00:00
Esteban Küber
c376fc0017 Account for Pin::new(_) and Pin::new(Box::new(_)) when Box::pin(_) would be applicable 2020-02-12 15:13:05 -08:00
Esteban Küber
80cdb0af7d Account for Box::new(impl Future) and emit help use Box::pin 2020-02-12 15:13:05 -08:00
Esteban Küber
a852fb7413 Remove std lib Span from expected boxed future test 2020-02-12 15:13:04 -08:00
Esteban Küber
c39b04ea85 When expecting BoxFuture and using async {}, suggest Box::pin 2020-02-12 15:13:04 -08:00
bors
92d8e82f6b Auto merge of #69105 - Dylan-DPC:rollup-n73lh5h, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #67954 (Support new LLVM pass manager)
 - #68981 ( Account for type params on method without parentheses)
 - #69002 (miri: improve and simplify overflow detection)
 - #69038 (Add initial debug fmt for Backtrace)
 - #69040 (Cleanup SGX entry code)
 - #69086 (Update compiler-builtins to 0.1.25)
 - #69095 (Minified theme check)

Failed merges:

r? @ghost
2020-02-12 22:43:20 +00:00
Dylan DPC
839adda4be
Rollup merge of #69095 - GuillaumeGomez:minified-theme-check, r=Dylan-DPC
Minified theme check

Fixes #69071.

r? @kinnison
2020-02-12 20:37:02 +01:00
Dylan DPC
e86019c4a0
Rollup merge of #69086 - tmandry:probestack-hidden-2, r=Dylan-DPC
Update compiler-builtins to 0.1.25

- https://github.com/rust-lang/compiler-builtins/pull/340 Set probestack visibility to hidden on ELF targets

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

Tested in CI: https://github.com/rust-lang/rust/pull/69045.

r? @Mark-Simulacrum
2020-02-12 20:36:59 +01:00
Dylan DPC
a908716ec6
Rollup merge of #69040 - jethrogb:jb/cleanup-sgx-entry, r=nagisa
Cleanup SGX entry code

cc @aandyl
2020-02-12 20:36:58 +01:00
Dylan DPC
5a800d7ee6
Rollup merge of #69038 - yaahc:backtrace-debug, r=dtolnay
Add initial debug fmt for Backtrace

Fixes the first point in https://github.com/rust-lang/rust/issues/65280

related to https://github.com/rust-lang/rust/issues/53487
2020-02-12 20:36:56 +01:00
Dylan DPC
29dd5df791
Rollup merge of #69002 - RalfJung:miri-op-overflow, r=oli-obk,wesleywiser
miri: improve and simplify overflow detection

This simplifies the overflow detection for signed binary operators, and adds overflow detection to unary operators so that const-prop doesn't have to crudely hand-roll that.

It also fixes some bugs in the operator implementation that however, I think, were not observable.

r? @oli-obk @wesleywiser
2020-02-12 20:36:55 +01:00
Dylan DPC
2a3c1a30c8
Rollup merge of #68981 - estebank:silence, r=davidtwco
Account for type params on method without parentheses

Account for those type parameters in the structured suggestion when forgetting to call method:

```
error[E0615]: attempted to take value of method `collect` on type `std::vec::IntoIter<_>`
  --> $DIR/method-missing-parentheses.rs:2:32
   |
LL |     let _ = vec![].into_iter().collect::<usize>;
   |                                ^^^^^^^---------
   |                                |
   |                                help: use parentheses to call the method: `collect::<usize>()`
```
2020-02-12 20:36:53 +01:00
Dylan DPC
f127aba96d
Rollup merge of #67954 - nikic:new-pm, r=nagisa
Support new LLVM pass manager

Add support for the new LLVM pass manager behind a `-Z new-llvm-pass-manager=on` option. Both the pre-link optimization and LTO pipelines use the new pass manager. There's some bits that are not supported yet:

 * `-C passes`. NewPM requires an entirely different way of specifying custom pass pipelines. We should probably expose that functionality, but it doesn't directly map to what `-C passes` does.
 * NewPM has no support for custom inline parameters right now. We'd have to add upstream support for that first.
 * NewPM does not support PGO at O0 in LLVM 9 (which is why those tests fail with NewPM enabled). This is supported in LLVM 10.
 * NewPM does not support MergeFunctions in LLVM 9. I've landed this upstream just before the cut, so we'll be able to re-enable that with LLVM 10.

Closes #64289.

r? @ghost
2020-02-12 20:36:51 +01:00
bors
a1912f2e89 Auto merge of #68679 - matthewjasper:needs-type-op, r=varkor
Improve `ty.needs_drop`

* Handle cycles in `needs_drop` correctly
* Normalize types when computing `needs_drop`
* Move queries from rustc to rustc_ty
* Avoid query in simple cases

reopens #65918
2020-02-12 19:31:49 +00:00
Tomasz Miąsko
33e2c1d863 bootstrap: Configure cmake when building sanitizer runtimes 2020-02-12 20:01:07 +01:00
bors
2d2be57097 Auto merge of #69094 - Dylan-DPC:rollup-4qe7uv1, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #67585 (Improve `char::is_ascii_*` codegen)
 - #68914 (Speed up `SipHasher128`.)
 - #68994 (rustbuild: include channel in sanitizers installed name)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69034 (parser: Remove `Parser::prev_token_kind`)
 - #69042 (Remove backtrace header text)
 - #69059 (Remove a few unused objects)
 - #69089 (Properly use the darwin archive format on Apple targets)

Failed merges:

r? @ghost
2020-02-12 16:25:13 +00:00
Guillaume Gomez
109260f8f0 Add test to check if minified theme are handled correctly 2020-02-12 15:49:39 +01:00
Guillaume Gomez
c8e567ddc8 Minify CSS rules to be able to handle minified theme files as well 2020-02-12 15:49:39 +01:00
Igor Matuszewski
8fc4bba2c4 Update RLS and Rustfmt
Bumps rustc-ap-* packages to v642.
2020-02-12 15:47:38 +01:00
Nikita Popov
c6b0803202 Add support for new pass manager
The new pass manager can be enabled using
-Z new-llvm-pass-manager=on.
2020-02-12 15:34:16 +01:00
Nikita Popov
737f08bc28 Fix mangled names of lifetime intrinsics 2020-02-12 15:30:56 +01:00
Nikita Popov
03a73fa2cf Use IRBuilder to create memset
To avoid creating memsets with outdated signature. For some reason
SROA chokes on this when using NewPM.
2020-02-12 15:30:51 +01:00
John Kåre Alsaker
5206827933 Address comments 2020-02-12 14:37:50 +01:00
Dylan DPC
d9982f1f81
Rollup merge of #69089 - nox:sym64-crash, r=eddyb
Properly use the darwin archive format on Apple targets

See https://github.com/servo/servo/issues/25550.
2020-02-12 14:21:16 +01:00
Dylan DPC
db48a8a6aa
Rollup merge of #69059 - ljedrz:unused_stuff, r=Dylan-DPC
Remove a few unused objects

As far as I can tell, these won't be missed:

- `infer::region_constraints::ConstraintInfo`
- `driver::DefaultCallbacks`
- ~~`hir::intravisit::ParDeepVisitor`~~
2020-02-12 14:21:14 +01:00
Dylan DPC
6b40f59db1
Rollup merge of #69042 - yaahc:backtrace-header, r=dtolnay
Remove backtrace header text

Fixes point 3 from https://github.com/rust-lang/rust/issues/65280

related to https://github.com/rust-lang/rust/issues/53487

This should probably be double checked by someone who works on fuschia because theres some extra fuschia specific output in `add_context` that is also removed by this change.
2020-02-12 14:21:13 +01:00
Dylan DPC
42f371c2eb
Rollup merge of #69034 - petrochenkov:notokind, r=Centril
parser: Remove `Parser::prev_token_kind`

Follow-up to https://github.com/rust-lang/rust/pull/69006.
r? @Centril
2020-02-12 14:21:11 +01:00
Dylan DPC
b695f99deb
Rollup merge of #69032 - chrissimpkins:ice-yield-println-#69017, r=petrochenkov
ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method

IR: https://github.com/rust-lang/rust/issues/69017
regressed commit: f8fd462447
Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087

Addresses ICE reported in #69017 by handling `TerminatorKind::Yield` in 4d1241f515/src/librustc_mir/transform/promote_consts.rs (L465-L468).

<details><summary>Nightly build</summary>
<p>

```
$ cargo +nightly build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable
 --> src/main.rs:8:27
  |
8 |         println!("-> {}", yield);
  |                           ^^^^^

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (71c7e149e 2020-02-09) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile `yielder`.

To learn more, run the command again with --verbose.
```

</p>
</details>

<details><summary>Stage 1 dev build</summary>
<p>

```
$ cargo +stage1 build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
warning: function is never used: `gen`
 --> src/main.rs:6:4
  |
6 | fn gen() -> impl Generator<usize> {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.53s
```

</p>
</details>

@jonas-schievink @oli-obk
2020-02-12 14:21:10 +01:00
Dylan DPC
75a977dd47
Rollup merge of #68994 - Keruspe:sanitizers-conflict, r=Mark-Simulacrum
rustbuild: include channel in sanitizers installed name

Allows parallel install of different rust channels.

I'm not sure if the channel is the right thing to use there, but currently both beta and nightly try to install e.g. `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_rt.asan.a` when before (and in current stable) it used to be `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_asan-45a4390180e83d28.rlib` which contained a hash, making it unique.
With this patch, `/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-nightly_rt.asan.a` gets installed
2020-02-12 14:21:08 +01:00
Dylan DPC
f2d829ce6a
Rollup merge of #68914 - nnethercote:speed-up-SipHasher128, r=michaelwoerister
Speed up `SipHasher128`.

The current code in `SipHasher128::short_write` is inefficient. It uses
`u8to64_le` (which is complex and slow) to extract just the right number of
bytes of the input into a u64 and pad the result with zeroes. It then
left-shifts that value in order to bitwise-OR it with `self.tail`.

For example, imagine we have a u32 input `0xIIHH_GGFF` and only need three bytes
to fill up `self.tail`. The current code uses `u8to64_le` to construct
`0x0000_0000_00HH_GGFF`, which is just `0xIIHH_GGFF` with the `0xII` removed and
zero-extended to a u64. The code then left-shifts that value by five bytes --
discarding the `0x00` byte that replaced the `0xII` byte! -- to give
`0xHHGG_FF00_0000_0000`. It then then ORs that value with `self.tail`.

There's a much simpler way to do it: zero-extend to u64 first, then left shift.
E.g. `0xIIHH_GGFF` is zero-extended to `0x0000_0000_IIHH_GGFF`, and then
left-shifted to `0xHHGG_FF00_0000_0000`. We don't have to take time to exclude
the unneeded `0xII` byte, because it just gets shifted out anyway! It also avoids
multiple occurrences of `unsafe`.

There's a similar story with the setting of `self.tail` at the method's end.
The current code uses `u8to64_le` to extract the remaining part of the input,
but the same effect can be achieved more quickly with a right shift on the
zero-extended input.

This commit changes `SipHasher128` to use the simpler shift-based approach. The
code is also smaller, which means that `short_write` is now inlined where
previously it wasn't, which makes things faster again. This gives big
speed-ups for all incremental builds, especially "baseline" incremental
builds.

r? @michaelwoerister
2020-02-12 14:21:06 +01:00