]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAvoid calling `fn_sig` on closures
Yuki Okushi [Fri, 14 Feb 2020 03:46:06 +0000 (12:46 +0900)]
Avoid calling `fn_sig` on closures

4 years agoAuto merge of #69144 - Dylan-DPC:rollup-apt6zjj, r=Dylan-DPC
bors [Thu, 13 Feb 2020 22:20:58 +0000 (22:20 +0000)]
Auto merge of #69144 - Dylan-DPC:rollup-apt6zjj, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #68728 (parse: merge `fn` syntax + cleanup item parsing)
 - #68938 (fix lifetime shadowing check in GATs)
 - #69057 (expand: misc cleanups and simplifications)
 - #69108 (Use HirId in TraitCandidate.)
 - #69125 (Add comment to SGX entry code)
 - #69126 (miri: fix exact_div)
 - #69127 (Enable use after scope detection in the new LLVM pass manager)
 - #69135 (Spelling error "represening" to "representing")
 - #69141 (Don't error on network failures)

Failed merges:

r? @ghost

4 years agoRollup merge of #69141 - mark-i-m:proper-linkcheck-2, r=Dylan-DPC
Dylan DPC [Thu, 13 Feb 2020 20:28:14 +0000 (21:28 +0100)]
Rollup merge of #69141 - mark-i-m:proper-linkcheck-2, r=Dylan-DPC

Don't error on network failures

This should further reduce spurious failures.

r? @JohnTitor and/or @ehuss

4 years agoRollup merge of #69135 - drewrip:drewrip-spelling, r=jonas-schievink
Dylan DPC [Thu, 13 Feb 2020 20:28:12 +0000 (21:28 +0100)]
Rollup merge of #69135 - drewrip:drewrip-spelling, r=jonas-schievink

Spelling error "represening" to "representing"

Small spelling mistake I noticed when looking through the Rust lexer.

4 years agoRollup merge of #69127 - tmiasko:new-pass-manager-use-after-scope, r=nikic
Dylan DPC [Thu, 13 Feb 2020 20:28:11 +0000 (21:28 +0100)]
Rollup merge of #69127 - tmiasko:new-pass-manager-use-after-scope, r=nikic

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.

4 years agoRollup merge of #69126 - RalfJung:exact-div, r=oli-obk
Dylan DPC [Thu, 13 Feb 2020 20:28:09 +0000 (21:28 +0100)]
Rollup merge of #69126 - RalfJung:exact-div, r=oli-obk

miri: fix exact_div

Turns out `exact_div` was relying on the broken behavior of `Rem` for `int_min % -1` that was fixed in https://github.com/rust-lang/rust/pull/69002. This PR fixes `exact_div`.

Inside rustc, `exact_div` is only used in a single place where the divisor is always positive (in `ptr_offset_from`), so we cannot test the fix in rustc. The Miri test suite covers this through the `exact_div` intrinsic, though (and it is how I found out).

One step to https://github.com/rust-lang/rust/issues/69117 (then we also need to address build failures introduced by https://github.com/rust-lang/rust/pull/68969)

r? @oli-obk

4 years agoRollup merge of #69125 - jethrogb:jb/cleanup-sgx-entry, r=Dylan-DPC
Dylan DPC [Thu, 13 Feb 2020 20:28:07 +0000 (21:28 +0100)]
Rollup merge of #69125 - jethrogb:jb/cleanup-sgx-entry, r=Dylan-DPC

Add comment to SGX entry code

Meant to force push this to be included in #69040, but forgot

r? @nagisa

4 years agoRollup merge of #69108 - cjgillot:trait_candidate, r=Zoxc
Dylan DPC [Thu, 13 Feb 2020 20:28:06 +0000 (21:28 +0100)]
Rollup merge of #69108 - cjgillot:trait_candidate, r=Zoxc

Use HirId in TraitCandidate.

I had to duplicate the `TraitMap` type to hold `NodeId`s until AST->HIR lowering is done.

r? @Zoxc

4 years agoRollup merge of #69057 - Centril:clean-expand, r=petrochenkov
Dylan DPC [Thu, 13 Feb 2020 20:28:05 +0000 (21:28 +0100)]
Rollup merge of #69057 - Centril:clean-expand, r=petrochenkov

expand: misc cleanups and simplifications

Some work I did while trying to understand expand for the purposes of https://github.com/rust-lang/rust/issues/64197.

r? @petrochenkov

4 years agoRollup merge of #68938 - Areredify:gat_lifetime_shadowing, r=estebank
Dylan DPC [Thu, 13 Feb 2020 20:28:00 +0000 (21:28 +0100)]
Rollup merge of #68938 - Areredify:gat_lifetime_shadowing, r=estebank

fix lifetime shadowing check in GATs

closes #67512

4 years agoRollup merge of #68728 - Centril:towards-fn-merge, r=petrochenkov
Dylan DPC [Thu, 13 Feb 2020 20:27:58 +0000 (21:27 +0100)]
Rollup merge of #68728 - Centril:towards-fn-merge, r=petrochenkov

parse: merge `fn` syntax + cleanup item parsing

Here we continue the work in https://github.com/rust-lang/rust/pull/67131 in particular to merge the grammars of `fn` items in various positions.

A list of *language level* changes (as sanctioned by the language team in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286 and https://github.com/rust-lang/rust/pull/67131):

- `self` parameters are now *syntactically* allowed as the first parameter irrespective of item context (and in function pointers). Instead, semantic validation (`ast_validation`) is used.

- Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead.

- Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns.

- `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.

- To fuse the list-of-items parsing in the 4 contexts that items are allowed, we now must permit inner attributes (`#![attr]`) inside `trait Foo { ... }` definitions. That is, we now allow e.g. `trait Foo { #![attr] }`. This was probably an oversight due to not using a uniform parsing mechanism, which we now do have (`fn parse_item_list`). The semantic support (including e.g. for linting) falls out directly from the attributes infrastructure. To ensure this, we include a test for lints.

Put together, these grammar changes allow us to substantially reduce the complexity of item parsing and its grammar. There are however some other non-language improvements that allow the compression to take place.

A list of *compiler-internal* changes (in particular noting the parser-external data-structure changes):

- We use `enum AllowPlus/RecoverQPath/AllowCVariadic { Yes, No }` in `parser/ty.rs` instead of passing around 3 different `bool`s. I felt this was necessary as it was becoming mentally taxing to track which-is-which.

- `fn visit_trait_item` and `fn visit_impl_item` are merged into `fn visit_assoc_item` which now is passed an `AssocCtxt` to check which one it is.

- We change `FnKind` to:

  ```rust
  pub enum FnKind<'a> {
      Fn(FnCtxt, Ident, &'a FnSig, &'a Visibility, Option<&'a Block>),
      Closure(&'a FnDecl, &'a Expr),
  }
  ```

  with:

  ```rust
  pub enum FnCtxt {
      Free,
      Foreign,
      Assoc(AssocCtxt),
  }
  ```

  This is then taken advantage of in tweaking the various semantic restrictions as well as in pretty printing.

- In `ItemKind::Fn`, we change `P<Block>` to `Option<P<Block>>`.

- In `ForeignItemKind::Fn`, we change `P<FnDecl>` to `FnSig` and `P<Block>` to `Option<P<Block>>`.

- 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.

- Various cleanups, bug fixes, and diagnostics improvements are made along the way. It is probably best to understand those via the diffs.

I would recommend reviewing this commit-by-commit with whitespace changes hidden.

r? @estebank @petrochenkov

4 years agoAuto merge of #68406 - andjo403:selfprofileLlvm, r=wesleywiser
bors [Thu, 13 Feb 2020 19:12:43 +0000 (19:12 +0000)]
Auto merge of #68406 - andjo403:selfprofileLlvm, r=wesleywiser

[self-profiler] add selfprofiling to llvm

using pass name as event id and add additional data with name of module, function …

![image](https://user-images.githubusercontent.com/844398/72761970-205d8600-3bde-11ea-86de-87386e127944.png)

r? @michaelwoerister or @wesleywiser

4 years agodon't error on network failures
Mark Mansi [Thu, 13 Feb 2020 17:53:07 +0000 (11:53 -0600)]
don't error on network failures

4 years agoSpelling error "represening" to "representing"
Drew Ripberger [Thu, 13 Feb 2020 16:14:21 +0000 (11:14 -0500)]
Spelling error "represening" to "representing"

4 years agoMake TraitCandidate generic.
Camille GILLOT [Thu, 13 Feb 2020 15:47:51 +0000 (16:47 +0100)]
Make TraitCandidate generic.

4 years agoUse HirId in TraitCandidate.
Camille GILLOT [Wed, 12 Feb 2020 18:46:05 +0000 (19:46 +0100)]
Use HirId in TraitCandidate.

4 years agoparser: inline parse_assoc_macro_invoc
Mazdak Farrokhzad [Sat, 1 Feb 2020 09:26:11 +0000 (10:26 +0100)]
parser: inline parse_assoc_macro_invoc

4 years agoparser: misc small item related improvements & cleanups.
Mazdak Farrokhzad [Sat, 1 Feb 2020 05:18:10 +0000 (06:18 +0100)]
parser: misc small item related improvements & cleanups.

4 years agoparser: extract `recover_const_mut`.
Mazdak Farrokhzad [Fri, 31 Jan 2020 13:23:12 +0000 (14:23 +0100)]
parser: extract `recover_const_mut`.

4 years agoparser: fuse `trait` parsing & layer with `is_path_start_item`
Mazdak Farrokhzad [Fri, 31 Jan 2020 12:37:23 +0000 (13:37 +0100)]
parser: fuse `trait` parsing & layer with `is_path_start_item`

4 years agoparser: make `eat_macro_def` redundant.
Mazdak Farrokhzad [Fri, 31 Jan 2020 11:31:51 +0000 (12:31 +0100)]
parser: make `eat_macro_def` redundant.

4 years agoparser: remove `Option<Vec<Attribute>>` in `ItemInfo`.
Mazdak Farrokhzad [Fri, 31 Jan 2020 11:09:21 +0000 (12:09 +0100)]
parser: remove `Option<Vec<Attribute>>` in `ItemInfo`.

4 years agoparser_item_mod: avoid cloning outer attributes
Mazdak Farrokhzad [Fri, 31 Jan 2020 10:35:36 +0000 (11:35 +0100)]
parser_item_mod: avoid cloning outer attributes

4 years agoparser: introduce `parse_item_kind` as central `ItemInfo` logic.
Mazdak Farrokhzad [Fri, 31 Jan 2020 07:37:09 +0000 (08:37 +0100)]
parser: introduce `parse_item_kind` as central `ItemInfo` logic.

this also extracts macro item parsers.

4 years agoparser: extract `recover_missing_kw_before_item`
Mazdak Farrokhzad [Fri, 31 Jan 2020 06:00:19 +0000 (07:00 +0100)]
parser: extract `recover_missing_kw_before_item`

4 years agoparser: unify item list parsing.
Mazdak Farrokhzad [Fri, 31 Jan 2020 05:43:33 +0000 (06:43 +0100)]
parser: unify item list parsing.

as a consequence, `trait X { #![attr] }` becomes legal.

4 years agoparser: extract common foreign item code for each kind
Mazdak Farrokhzad [Fri, 31 Jan 2020 03:21:16 +0000 (04:21 +0100)]
parser: extract common foreign item code for each kind

4 years agoAuto merge of #68969 - RalfJung:dont-panic, r=oli-obk
bors [Thu, 13 Feb 2020 12:53:43 +0000 (12:53 +0000)]
Auto merge of #68969 - RalfJung:dont-panic, r=oli-obk

remove Panic variant from InterpError

The interpreter engine itself does not raise `Panic` errors any more, so remove them from the error enum. Instead, const-prop and const-eval have to do their own handling of panics.

I used the opportunity to refactor the const-eval error handling a bit to use the `MachineStop` variant.

Also, in const-prop I could do some cleanup as now, no more lints are being reported in `use_ecx`. However, I am quite puzzled by why exactly the linting there works the way it does -- the code can certainly be cleaned up more, but I don't know enough of the intent to do that. I left some questions for the most confusing parts, but for now behavior should be unchanged by this PR (so, all that weirdness I am asking about is pre-existing and merely maintained here). Cc @wesleywiser

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

r? @oli-obk

4 years agofix typo
Ralf Jung [Thu, 13 Feb 2020 10:26:09 +0000 (11:26 +0100)]
fix typo

4 years agoexpand: simplify flat_map_item wrt. inline module detection
Mazdak Farrokhzad [Tue, 31 Dec 2019 09:06:52 +0000 (10:06 +0100)]
expand: simplify flat_map_item wrt. inline module detection

4 years agoexpand: simplify flat_map_item
Mazdak Farrokhzad [Tue, 31 Dec 2019 08:59:37 +0000 (09:59 +0100)]
expand: simplify flat_map_item

4 years agoexpand: simplify classify_*
Mazdak Farrokhzad [Tue, 31 Dec 2019 08:11:59 +0000 (09:11 +0100)]
expand: simplify classify_*

4 years agoexpand: extract error_wrong_fragment_kind
Mazdak Farrokhzad [Tue, 31 Dec 2019 07:43:33 +0000 (08:43 +0100)]
expand: extract error_wrong_fragment_kind

4 years agoexpand: extract error_recursion_limit_reached
Mazdak Farrokhzad [Tue, 31 Dec 2019 07:25:49 +0000 (08:25 +0100)]
expand: extract error_recursion_limit_reached

4 years agomiri: fix exact_div
Ralf Jung [Thu, 13 Feb 2020 10:16:54 +0000 (11:16 +0100)]
miri: fix exact_div

4 years agorename PanicInfo -> AssertKind
Ralf Jung [Wed, 12 Feb 2020 18:40:31 +0000 (19:40 +0100)]
rename PanicInfo -> AssertKind

4 years agoimprove comments:
Ralf Jung [Mon, 10 Feb 2020 14:58:10 +0000 (15:58 +0100)]
improve comments:

- comment for special handling of Shl/Shr
- reference a PR

4 years agosmall cleanup in ConstEvalErr::struct_generic
Ralf Jung [Tue, 11 Feb 2020 10:27:33 +0000 (11:27 +0100)]
small cleanup in ConstEvalErr::struct_generic

4 years agomove PanicInfo to mir module
Ralf Jung [Mon, 10 Feb 2020 19:53:01 +0000 (20:53 +0100)]
move PanicInfo to mir module

4 years agono need for hook_panic_fn to return a bool
Ralf Jung [Sun, 9 Feb 2020 15:54:40 +0000 (16:54 +0100)]
no need for hook_panic_fn to return a bool

4 years agoremove PanicInfo::Panic variant that MIR does not use or need
Ralf Jung [Sun, 9 Feb 2020 15:51:36 +0000 (16:51 +0100)]
remove PanicInfo::Panic variant that MIR does not use or need

4 years agoconst-prop: handle overflow_check consistently for all operators
Ralf Jung [Sat, 8 Feb 2020 22:01:36 +0000 (23:01 +0100)]
const-prop: handle overflow_check consistently for all operators

4 years agoremove Panic variant from InterpError
Ralf Jung [Sat, 8 Feb 2020 21:21:20 +0000 (22:21 +0100)]
remove Panic variant from InterpError

4 years agoexpand: extract error_derive_forbidden_on_non_adt
Mazdak Farrokhzad [Tue, 31 Dec 2019 07:14:31 +0000 (08:14 +0100)]
expand: extract error_derive_forbidden_on_non_adt

4 years agosimplify config::features
Mazdak Farrokhzad [Tue, 31 Dec 2019 06:42:19 +0000 (07:42 +0100)]
simplify config::features

4 years agoStripUnconfigured::in_cfg: simplify with slice patterns
Mazdak Farrokhzad [Tue, 31 Dec 2019 06:15:43 +0000 (07:15 +0100)]
StripUnconfigured::in_cfg: simplify with slice patterns

4 years agoAuto merge of #69023 - Centril:parse_fn, r=petrochenkov
bors [Thu, 13 Feb 2020 09:42:10 +0000 (09:42 +0000)]
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

4 years agoparser: is_fn_front_matter -> check_fn_front_matter
Mazdak Farrokhzad [Tue, 11 Feb 2020 07:40:16 +0000 (08:40 +0100)]
parser: is_fn_front_matter -> check_fn_front_matter

4 years agoparser: add test for 'extern crate async'
Mazdak Farrokhzad [Tue, 11 Feb 2020 07:27:50 +0000 (08:27 +0100)]
parser: add test for 'extern crate async'

4 years agorustc_bulltin_macros: tweak span_labels
Mazdak Farrokhzad [Tue, 11 Feb 2020 07:24:05 +0000 (08:24 +0100)]
rustc_bulltin_macros: tweak span_labels

4 years agoast_validation: tweak diagnostic output
Mazdak Farrokhzad [Tue, 11 Feb 2020 07:19:21 +0000 (08:19 +0100)]
ast_validation: tweak diagnostic output

4 years agoparser: simplify ParamCfg -> ReqName
Mazdak Farrokhzad [Mon, 10 Feb 2020 14:35:05 +0000 (15:35 +0100)]
parser: simplify ParamCfg -> ReqName

4 years agoparser: address review comments
Mazdak Farrokhzad [Mon, 10 Feb 2020 14:24:53 +0000 (15:24 +0100)]
parser: address review comments

4 years agoparser: move `ban_async_in_2015` to `fn` parsing & improve it.
Mazdak Farrokhzad [Sat, 1 Feb 2020 09:36:29 +0000 (10:36 +0100)]
parser: move `ban_async_in_2015` to `fn` parsing & improve it.

4 years agoparser: inline `parse_assoc_fn` and friends.
Mazdak Farrokhzad [Fri, 31 Jan 2020 02:31:12 +0000 (03:31 +0100)]
parser: inline `parse_assoc_fn` and friends.

4 years agoparser: solidify `fn` parsing with `parse_fn`.
Mazdak Farrokhzad [Fri, 31 Jan 2020 02:20:46 +0000 (03:20 +0100)]
parser: solidify `fn` parsing with `parse_fn`.

4 years agoparser: fuse free `fn` parsing together.
Mazdak Farrokhzad [Thu, 30 Jan 2020 12:02:06 +0000 (13:02 +0100)]
parser: fuse free `fn` parsing together.

4 years agoparser_fn_front_matter: allow `const .. extern`
Mazdak Farrokhzad [Thu, 30 Jan 2020 07:31:31 +0000 (08:31 +0100)]
parser_fn_front_matter: allow `const .. extern`

4 years agoIsAsync -> enum Async { Yes { span: Span, .. }, No }
Mazdak Farrokhzad [Thu, 30 Jan 2020 04:31:04 +0000 (05:31 +0100)]
IsAsync -> enum Async { Yes { span: Span, .. }, No }
use new span for better diagnostics.

4 years agoConstness -> enum Const { Yes(Span), No }
Mazdak Farrokhzad [Thu, 30 Jan 2020 01:42:33 +0000 (02:42 +0100)]
Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.

4 years agoAdd comment to SGX entry code
Jethro Beekman [Thu, 13 Feb 2020 09:16:28 +0000 (10:16 +0100)]
Add comment to SGX entry code

4 years agoadd selfprofiling for new llvm passmanager
Andreas Jonson [Tue, 11 Feb 2020 21:37:16 +0000 (22:37 +0100)]
add selfprofiling for new llvm passmanager

4 years agoAuto merge of #69118 - Dylan-DPC:rollup-7hpm1fj, r=Dylan-DPC
bors [Thu, 13 Feb 2020 04:57:41 +0000 (04:57 +0000)]
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

4 years agoRollup merge of #69104 - tmiasko:configure-cmake, r=Mark-Simulacrum
Dylan DPC [Thu, 13 Feb 2020 01:52:59 +0000 (02:52 +0100)]
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.

4 years agoRollup merge of #69082 - estebank:boxfuture-box-pin, r=tmandry
Dylan DPC [Thu, 13 Feb 2020 01:52:57 +0000 (02:52 +0100)]
Rollup merge of #69082 - estebank:boxfuture-box-pin, r=tmandry

When expecting `BoxFuture` and using `async {}`, suggest `Box::pin`

Fix #68197, cc #69083.

4 years agoRollup merge of #69068 - Goirad:make-sgx-arg-cleanup-nop, r=jethrogb,nagisa
Dylan DPC [Thu, 13 Feb 2020 01:52:56 +0000 (02:52 +0100)]
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

4 years agoRollup merge of #69050 - nnethercote:micro-optimize-leb128, r=michaelwoerister
Dylan DPC [Thu, 13 Feb 2020 01:52:54 +0000 (02:52 +0100)]
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

4 years agoRollup merge of #69049 - pthariensflame:improvement/imgbot, r=GuillaumeGomez
Dylan DPC [Thu, 13 Feb 2020 01:52:53 +0000 (02:52 +0100)]
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)

4 years agoRollup merge of #69048 - estebank:hrlt-assoc, r=nagisa
Dylan DPC [Thu, 13 Feb 2020 01:52:51 +0000 (02:52 +0100)]
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.

4 years agoRollup merge of #69008 - Aaron1011:fix/opaque-ty-parent, r=matthewjasper
Dylan DPC [Thu, 13 Feb 2020 01:52:49 +0000 (02:52 +0100)]
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.

4 years agoRollup merge of #68848 - nnethercote:hasten-macro-parsing, r=petrochenkov
Dylan DPC [Thu, 13 Feb 2020 01:52:48 +0000 (02:52 +0100)]
Rollup merge of #68848 - nnethercote:hasten-macro-parsing, r=petrochenkov

Hasten macro parsing

r? @eddyb

4 years agoRollup merge of #67642 - Mark-Simulacrum:relax-bounds, r=Amanieu
Dylan DPC [Thu, 13 Feb 2020 01:52:46 +0000 (02:52 +0100)]
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.

4 years agoAuto merge of #69097 - Xanewok:update-rls-rustfmt, r=Dylan-DPC
bors [Thu, 13 Feb 2020 01:40:54 +0000 (01:40 +0000)]
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

4 years agoAdd trait `Self` filtering to `rustc_on_unimplemented`
Esteban Küber [Thu, 13 Feb 2020 00:50:28 +0000 (16:50 -0800)]
Add trait `Self` filtering to `rustc_on_unimplemented`

4 years agoEnable use after scope detection in the new LLVM pass manager
Tomasz Miąsko [Thu, 13 Feb 2020 00:00:00 +0000 (00:00 +0000)]
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.

4 years agoAccount for `Pin::new(_)` and `Pin::new(Box::new(_))` when `Box::pin(_)` would be...
Esteban Küber [Wed, 12 Feb 2020 19:51:07 +0000 (11:51 -0800)]
Account for `Pin::new(_)` and `Pin::new(Box::new(_))` when `Box::pin(_)` would be applicable

4 years agoAccount for `Box::new(impl Future)` and emit help `use Box::pin`
Esteban Küber [Wed, 12 Feb 2020 19:11:55 +0000 (11:11 -0800)]
Account for `Box::new(impl Future)` and emit help `use Box::pin`

4 years agoRemove std lib `Span` from expected boxed future test
Esteban Küber [Wed, 12 Feb 2020 01:35:04 +0000 (17:35 -0800)]
Remove std lib `Span` from expected boxed future test

4 years agoWhen expecting `BoxFuture` and using `async {}`, suggest `Box::pin`
Esteban Küber [Wed, 12 Feb 2020 01:19:05 +0000 (17:19 -0800)]
When expecting `BoxFuture` and using `async {}`, suggest `Box::pin`

4 years agoAuto merge of #69105 - Dylan-DPC:rollup-n73lh5h, r=Dylan-DPC
bors [Wed, 12 Feb 2020 22:43:20 +0000 (22:43 +0000)]
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

4 years agoRollup merge of #69095 - GuillaumeGomez:minified-theme-check, r=Dylan-DPC
Dylan DPC [Wed, 12 Feb 2020 19:37:02 +0000 (20:37 +0100)]
Rollup merge of #69095 - GuillaumeGomez:minified-theme-check, r=Dylan-DPC

Minified theme check

Fixes #69071.

r? @kinnison

4 years agoRollup merge of #69086 - tmandry:probestack-hidden-2, r=Dylan-DPC
Dylan DPC [Wed, 12 Feb 2020 19:36:59 +0000 (20:36 +0100)]
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

4 years agoRollup merge of #69040 - jethrogb:jb/cleanup-sgx-entry, r=nagisa
Dylan DPC [Wed, 12 Feb 2020 19:36:58 +0000 (20:36 +0100)]
Rollup merge of #69040 - jethrogb:jb/cleanup-sgx-entry, r=nagisa

Cleanup SGX entry code

cc @aandyl

4 years agoRollup merge of #69038 - yaahc:backtrace-debug, r=dtolnay
Dylan DPC [Wed, 12 Feb 2020 19:36:56 +0000 (20:36 +0100)]
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

4 years agoRollup merge of #69002 - RalfJung:miri-op-overflow, r=oli-obk,wesleywiser
Dylan DPC [Wed, 12 Feb 2020 19:36:55 +0000 (20:36 +0100)]
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

4 years agoRollup merge of #68981 - estebank:silence, r=davidtwco
Dylan DPC [Wed, 12 Feb 2020 19:36:53 +0000 (20:36 +0100)]
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>()`
```

4 years agoRollup merge of #67954 - nikic:new-pm, r=nagisa
Dylan DPC [Wed, 12 Feb 2020 19:36:51 +0000 (20:36 +0100)]
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

4 years agoAuto merge of #68679 - matthewjasper:needs-type-op, r=varkor
bors [Wed, 12 Feb 2020 19:31:49 +0000 (19:31 +0000)]
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

4 years agobootstrap: Configure cmake when building sanitizer runtimes
Tomasz Miąsko [Wed, 12 Feb 2020 00:00:00 +0000 (00:00 +0000)]
bootstrap: Configure cmake when building sanitizer runtimes

4 years agoAuto merge of #69094 - Dylan-DPC:rollup-4qe7uv1, r=Dylan-DPC
bors [Wed, 12 Feb 2020 16:25:13 +0000 (16:25 +0000)]
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

4 years agoAdd test to check if minified theme are handled correctly
Guillaume Gomez [Wed, 12 Feb 2020 13:39:40 +0000 (14:39 +0100)]
Add test to check if minified theme are handled correctly

4 years agoMinify CSS rules to be able to handle minified theme files as well
Guillaume Gomez [Wed, 12 Feb 2020 13:39:22 +0000 (14:39 +0100)]
Minify CSS rules to be able to handle minified theme files as well

4 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Wed, 12 Feb 2020 14:47:31 +0000 (15:47 +0100)]
Update RLS and Rustfmt

Bumps rustc-ap-* packages to v642.

4 years agoAdd support for new pass manager
Nikita Popov [Sun, 5 Jan 2020 18:16:58 +0000 (19:16 +0100)]
Add support for new pass manager

The new pass manager can be enabled using
-Z new-llvm-pass-manager=on.

4 years agoFix mangled names of lifetime intrinsics
Nikita Popov [Sun, 5 Jan 2020 22:27:05 +0000 (23:27 +0100)]
Fix mangled names of lifetime intrinsics

4 years agoUse IRBuilder to create memset
Nikita Popov [Sun, 5 Jan 2020 21:32:15 +0000 (22:32 +0100)]
Use IRBuilder to create memset

To avoid creating memsets with outdated signature. For some reason
SROA chokes on this when using NewPM.

4 years agoRollup merge of #69089 - nox:sym64-crash, r=eddyb
Dylan DPC [Wed, 12 Feb 2020 13:21:16 +0000 (14:21 +0100)]
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.

4 years agoRollup merge of #69059 - ljedrz:unused_stuff, r=Dylan-DPC
Dylan DPC [Wed, 12 Feb 2020 13:21:14 +0000 (14:21 +0100)]
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`~~

4 years agoRollup merge of #69042 - yaahc:backtrace-header, r=dtolnay
Dylan DPC [Wed, 12 Feb 2020 13:21:13 +0000 (14:21 +0100)]
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.

4 years agoRollup merge of #69034 - petrochenkov:notokind, r=Centril
Dylan DPC [Wed, 12 Feb 2020 13:21:11 +0000 (14:21 +0100)]
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