107014 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
ec43450015 expand: simplify flat_map_item wrt. inline module detection 2020-02-13 11:25:34 +01:00
Mazdak Farrokhzad
dc6bd6a123 expand: simplify flat_map_item 2020-02-13 11:25:34 +01:00
Mazdak Farrokhzad
fcce5fa6e7 expand: simplify classify_* 2020-02-13 11:25:33 +01:00
Mazdak Farrokhzad
7518492315 expand: extract error_wrong_fragment_kind 2020-02-13 11:25:33 +01:00
Mazdak Farrokhzad
acad033424 expand: extract error_recursion_limit_reached 2020-02-13 11:25:33 +01:00
Ralf Jung
10f342abae miri: fix exact_div 2020-02-13 11:21:29 +01:00
Ralf Jung
ed2f22c5a9 rename PanicInfo -> AssertKind 2020-02-13 11:04:49 +01:00
Ralf Jung
7e7d1c39ed improve comments:
- comment for special handling of Shl/Shr
- reference a PR
2020-02-13 11:04:26 +01:00
Ralf Jung
55339f2eb7 small cleanup in ConstEvalErr::struct_generic 2020-02-13 11:04:26 +01:00
Ralf Jung
6457b29104 move PanicInfo to mir module 2020-02-13 11:04:26 +01:00
Ralf Jung
17a8cfd605 no need for hook_panic_fn to return a bool 2020-02-13 10:56:38 +01:00
Ralf Jung
f3ff02bdd8 remove PanicInfo::Panic variant that MIR does not use or need 2020-02-13 10:56:38 +01:00
Ralf Jung
c5709ff6b7 const-prop: handle overflow_check consistently for all operators 2020-02-13 10:56:38 +01:00
Ralf Jung
0633a0e380 remove Panic variant from InterpError 2020-02-13 10:54:37 +01:00
Mazdak Farrokhzad
64ea295fe9 expand: extract error_derive_forbidden_on_non_adt 2020-02-13 10:44:44 +01:00
Mazdak Farrokhzad
b8b32a9be3 simplify config::features 2020-02-13 10:44:44 +01:00
Mazdak Farrokhzad
4f17dce4dc StripUnconfigured::in_cfg: simplify with slice patterns 2020-02-13 10:44:44 +01:00
bors
be493fe8cc Auto merge of #69023 - Centril:parse_fn, r=petrochenkov
parse: unify function front matter parsing

Part of https://github.com/rust-lang/rust/pull/68728.

- `const extern fn` feature gating is now done post-expansion such that we do not have conditional compatibilities of function qualifiers *in parsing*.

- The `FnFrontMatter` grammar becomes:
   ```rust
   Extern = "extern" StringLit ;
   FnQual = "const"? "async"? "unsafe"? Extern? ;
   FnFrontMatter = FnQual "fn" ;
   ```

   That is, all item contexts now *syntactically* allow `const async unsafe extern "C" fn` and use semantic restrictions to rule out combinations previously prevented syntactically. The semantic restrictions include in particular:

   - `fn`s in `extern { ... }` can have no qualifiers.
   - `const` and `async` cannot be combined.

- We change `ast::{Unsafety, Spanned<Constness>}>` into `enum ast::{Unsafe, Const} { Yes(Span), No }` respectively. This change in formulation allow us to exclude `Span` in the case of `No`, which facilitates parsing. Moreover, we also add a `Span` to `IsAsync` which is renamed to `Async`. The new `Span`s in `Unsafety` and `Async` are then taken advantage of for better diagnostics. A reason this change was made is to have a more uniform and clear naming scheme.

  The HIR keeps the structures in AST (with those definitions moved into HIR) for now to avoid regressing perf.

r? @petrochenkov
2020-02-13 09:42:10 +00:00
Mazdak Farrokhzad
9828559aad parser: is_fn_front_matter -> check_fn_front_matter 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
4ca3bbf0b2 parser: add test for 'extern crate async' 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
27f60906aa rustc_bulltin_macros: tweak span_labels 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
3341c94006 ast_validation: tweak diagnostic output 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
79d139ac70 parser: simplify ParamCfg -> ReqName 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
05e5530577 parser: address review comments 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
cdbbc25cc3 parser: move ban_async_in_2015 to fn parsing & improve it. 2020-02-13 10:39:24 +01:00
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 08a1c566a792dcf9657d293155f7ada87746bb65 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