]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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

4 years agoRollup merge of #69032 - chrissimpkins:ice-yield-println-#69017, r=petrochenkov
Dylan DPC [Wed, 12 Feb 2020 13:21:10 +0000 (14:21 +0100)]
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: https://github.com/rust-lang/rust/commit/f8fd4624474a68bd26694eff3536b9f3a127b2d3
Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087

Addresses ICE reported in #69017 by handling `TerminatorKind::Yield` in https://github.com/rust-lang/rust/blob/4d1241f5158ffd66730e094d8f199ed654ed52ae/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

4 years agoRollup merge of #68994 - Keruspe:sanitizers-conflict, r=Mark-Simulacrum
Dylan DPC [Wed, 12 Feb 2020 13:21:08 +0000 (14:21 +0100)]
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

4 years agoRollup merge of #68914 - nnethercote:speed-up-SipHasher128, r=michaelwoerister
Dylan DPC [Wed, 12 Feb 2020 13:21:06 +0000 (14:21 +0100)]
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

4 years agoRollup merge of #67585 - ranma42:fix/char-is-ascii-codegen, r=Amanieu
Dylan DPC [Wed, 12 Feb 2020 13:21:05 +0000 (14:21 +0100)]
Rollup merge of #67585 - ranma42:fix/char-is-ascii-codegen, r=Amanieu

Improve `char::is_ascii_*` codegen

This PR is an attempt to fix https://github.com/rust-lang/rust/issues/65127

A couple of warnings:
 1. the generated code might be further improved (in LLVM and/or MIR) by emitting better comparison sequences; in particular, this would improve the performance of "complex" checks such as those in `is_ascii_punctuation`
 2. the second commit is currently marked "DO NOT MERGE", because it regresses SIMD on `u8` slices; this could likely be fixed by improving the computation/usage of demanded bits in LLVM

An alternative approach to remove the code duplication might be the use of macros, but currently most of the duplication is actually in the doc comments, so maybe just keeping the redundancy could be ok

4 years agoAuto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelix
bors [Wed, 12 Feb 2020 13:16:58 +0000 (13:16 +0000)]
Auto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelix

Migrate borrowck dataflow impls to new framework

This uses #65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic.

* An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings).
* A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings).
* An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor.
* A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`.
* A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation`

These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere.

You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis.

![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)

4 years agoProperly use the darwin archive format on Apple targets
Anthony Ramine [Wed, 12 Feb 2020 11:06:14 +0000 (12:06 +0100)]
Properly use the darwin archive format on Apple targets

See https://github.com/servo/servo/issues/25550.

4 years agoAuto merge of #69088 - JohnTitor:rollup-x7bk7h7, r=JohnTitor
bors [Wed, 12 Feb 2020 10:10:15 +0000 (10:10 +0000)]
Auto merge of #69088 - JohnTitor:rollup-x7bk7h7, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #67695 (Added dyn and true keyword docs)
 - #68487 ([experiment] Support linking from a .rlink file)
 - #68554 (Split lang_items to crates `rustc_hir` and `rustc_passes`.)
 - #68937 (Test failure of unchecked arithmetic intrinsics in const eval)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #68999 (remove dependency on itertools)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69058 (Preparation for allocator aware `Box`)
 - #69070 (Add self to .mailmap)
 - #69077 (Fix outdated doc comment.)

Failed merges:

r? @ghost

4 years agoRollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPC
Yuki Okushi [Wed, 12 Feb 2020 09:55:51 +0000 (18:55 +0900)]
Rollup merge of #69077 - jumbatm:fix-comment, r=Dylan-DPC

Fix outdated doc comment.

r? @RalfJung

4 years agoRollup merge of #69070 - Bassetts:master, r=alexcrichton
Yuki Okushi [Wed, 12 Feb 2020 09:55:49 +0000 (18:55 +0900)]
Rollup merge of #69070 - Bassetts:master, r=alexcrichton

Add self to .mailmap

4 years agoRollup merge of #69058 - TimDiekmann:box, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:48 +0000 (18:55 +0900)]
Rollup merge of #69058 - TimDiekmann:box, r=Amanieu

Preparation for allocator aware `Box`

This cleans up the `Box` code a bit, and uses `Box::from_raw(ptr)` instead of `Box(ptr)`.
Additionally, `box_free` and `exchange_malloc` now uses the `AllocRef` trait and a comment was added on how `box_free` is tied to `Box`.

This a preparation for an upcoming PR, which makes `Box` aware of an allocator.

r? @Amanieu

4 years agoRollup merge of #69027 - TimDiekmann:zeroed-alloc, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:46 +0000 (18:55 +0900)]
Rollup merge of #69027 - TimDiekmann:zeroed-alloc, r=Amanieu

Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu

4 years agoRollup merge of #69026 - TimDiekmann:common-usage, r=Amanieu
Yuki Okushi [Wed, 12 Feb 2020 09:55:44 +0000 (18:55 +0900)]
Rollup merge of #69026 - TimDiekmann:common-usage, r=Amanieu

Remove common usage pattern from `AllocRef`

This removes the common usage patterns from `AllocRef`:
- `alloc_one`
- `dealloc_one`
- `alloc_array`
- `realloc_array`
- `dealloc_array`

Actually, they add nothing to `AllocRef` except a [convenience wrapper around `Layout` and other methods in this trait](https://doc.rust-lang.org/1.41.0/src/core/alloc.rs.html#1076-1240) but have a major flaw: The documentation of `AllocRefs` notes, that

> some higher-level allocation methods (`alloc_one`, `alloc_array`) are well-defined on zero-sized types and can optionally support them: it is left up to the implementor whether to return `Err`, or to return `Ok` with some pointer.

With the current API, `GlobalAlloc` does not have those methods, so they cannot be overridden for `liballoc::Global`, which means that even if the global allocator would support zero-sized allocations, `alloc_one`, `alloc_array`, and `realloc_array` for `liballoc::Global` will error, while calling `alloc` with a zeroed-size `Layout` could succeed. Even worse: allocating with `alloc` and deallocating with `dealloc_{one,array}` could end up with not calling `dealloc` at all!

For the full discussion please see https://github.com/rust-lang/wg-allocators/issues/18

r? @Amanieu

4 years agoRollup merge of #68999 - andjo403:itertools, r=Centril
Yuki Okushi [Wed, 12 Feb 2020 09:55:42 +0000 (18:55 +0900)]
Rollup merge of #68999 - andjo403:itertools, r=Centril

remove dependency on itertools

r? @Centril

4 years agoRollup merge of #68947 - chrissimpkins:python-fmt, r=alexcrichton
Yuki Okushi [Wed, 12 Feb 2020 09:55:41 +0000 (18:55 +0900)]
Rollup merge of #68947 - chrissimpkins:python-fmt, r=alexcrichton

Python script PEP8 style guide space formatting and minor Python source cleanup

This PR includes the following changes in the Python sources based on a flake8 3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.6 on Darwin lint:

- PEP8 style guide spacing updates *without* line length changes
- removal of unused local variable assignments in context managers and exception handling
- removal of unused Python import statements
- removal of unnecessary semicolons

4 years agoRollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJung
Yuki Okushi [Wed, 12 Feb 2020 09:55:39 +0000 (18:55 +0900)]
Rollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJung

Test failure of unchecked arithmetic intrinsics in const eval

Test that the unchecked arithmetic intrinsics that were made unstably const in #68809 emit an error during const-eval if given invalid input.

Addresses [this comment](https://github.com/rust-lang/rust/pull/68809#discussion_r375753066).

r? @RalfJung

4 years agoRollup merge of #68554 - cjgillot:lang_items, r=Zoxc
Yuki Okushi [Wed, 12 Feb 2020 09:55:37 +0000 (18:55 +0900)]
Rollup merge of #68554 - cjgillot:lang_items, r=Zoxc

Split lang_items to crates `rustc_hir` and `rustc_passes`.

As discussed in comment https://github.com/rust-lang/rust/pull/67688#discussion_r368289946

4 years agoRollup merge of #68487 - 0dvictor:nolink, r=tmandry
Yuki Okushi [Wed, 12 Feb 2020 09:55:36 +0000 (18:55 +0900)]
Rollup merge of #68487 - 0dvictor:nolink, r=tmandry

[experiment] Support linking from a .rlink file

Flag `-Z no-link` was previously introduced, which allows creating an `.rlink` file to perform compilation without linking. This change enables linking from an `.rlink` file.

Part of Issue #64191

4 years agoRollup merge of #67695 - gilescope:truth, r=centril
Yuki Okushi [Wed, 12 Feb 2020 09:55:34 +0000 (18:55 +0900)]
Rollup merge of #67695 - gilescope:truth, r=centril

Added dyn and true keyword docs

r? @Centril

4 years agoremove some unused objects
ljedrz [Tue, 11 Feb 2020 12:34:42 +0000 (13:34 +0100)]
remove some unused objects

4 years agoAuto merge of #68998 - lzutao:clippyup, r=Manishearth
bors [Wed, 12 Feb 2020 07:05:15 +0000 (07:05 +0000)]
Auto merge of #68998 - lzutao:clippyup, r=Manishearth

Update clippy

Closes #68901

4 years agoUpdate compiler-builtins to 0.1.25
Tyler Mandry [Wed, 12 Feb 2020 06:25:32 +0000 (22:25 -0800)]
Update compiler-builtins to 0.1.25

4 years agoAuto merge of #68823 - matthiaskrgr:submodule_upd, r=ehuss
bors [Wed, 12 Feb 2020 01:47:01 +0000 (01:47 +0000)]
Auto merge of #68823 - matthiaskrgr:submodule_upd, r=ehuss

submodules: update cargo

4 years agoUpdate clippy
Lzu Tao [Wed, 12 Feb 2020 01:25:41 +0000 (02:25 +0100)]
Update clippy

4 years agoFix failing backtrace ui tests
Jane Lusby [Wed, 12 Feb 2020 00:57:22 +0000 (16:57 -0800)]
Fix failing backtrace ui tests

4 years agoImprove `u8to64_le`.
Nicholas Nethercote [Tue, 11 Feb 2020 23:36:29 +0000 (10:36 +1100)]
Improve `u8to64_le`.

This makes it faster and also changes it to a safe function. (Thanks to
Michael Woerister for the suggestion.) `load_int_le!` is also no longer
necessary.

4 years agoFix outdated doc comment.
jumbatm [Tue, 11 Feb 2020 22:37:06 +0000 (08:37 +1000)]
Fix outdated doc comment.

4 years agoTest failure of unchecked arithmetic intrinsics in const eval
Dylan MacKenzie [Mon, 10 Feb 2020 19:46:51 +0000 (11:46 -0800)]
Test failure of unchecked arithmetic intrinsics in const eval

4 years agoReview comments.
Camille GILLOT [Tue, 11 Feb 2020 22:21:21 +0000 (23:21 +0100)]
Review comments.

4 years agoMerge rustc::middle::*lang_items.
Camille GILLOT [Thu, 30 Jan 2020 07:53:34 +0000 (08:53 +0100)]
Merge rustc::middle::*lang_items.

4 years agoMove it all into rustc_hir.
Camille GILLOT [Thu, 30 Jan 2020 00:24:51 +0000 (01:24 +0100)]
Move it all into rustc_hir.

4 years agoNits.
Camille GILLOT [Sun, 26 Jan 2020 21:43:35 +0000 (22:43 +0100)]
Nits.

4 years agoMove weak_lang_items checking to librustc_passes.
Camille GILLOT [Sat, 28 Dec 2019 17:31:37 +0000 (18:31 +0100)]
Move weak_lang_items checking to librustc_passes.

4 years agoMove weak_lang_items.rs to librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:09:29 +0000 (17:09 +0100)]
Move weak_lang_items.rs to librustc_passes.

4 years agoMove weak lang items to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 12:16:02 +0000 (13:16 +0100)]
Move weak lang items to librustc_lang_items.

4 years agoMove get_lang_items query in librustc_passes.
Camille GILLOT [Fri, 31 Jan 2020 22:06:06 +0000 (23:06 +0100)]
Move get_lang_items query in librustc_passes.

4 years agoMove lang_items definitions to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 11:49:18 +0000 (12:49 +0100)]
Move lang_items definitions to librustc_lang_items.

4 years agoMove hir::check_attr::Target to librustc_lang_items.
Camille GILLOT [Sun, 26 Jan 2020 11:07:22 +0000 (12:07 +0100)]
Move hir::check_attr::Target to librustc_lang_items.

4 years agoMove macro enum_from_u32 to rustc_data_structures.
Camille GILLOT [Thu, 30 Jan 2020 07:19:59 +0000 (08:19 +0100)]
Move macro enum_from_u32 to rustc_data_structures.

4 years agoUpdate Cargo.lock
Jane Lusby [Tue, 11 Feb 2020 20:51:23 +0000 (12:51 -0800)]
Update Cargo.lock

4 years agoAuto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=oli
bors [Tue, 11 Feb 2020 20:48:27 +0000 (20:48 +0000)]
Auto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=oli

Hide niches under UnsafeCell

Hide any niche of T from type-construction context of `UnsafeCell<T>`.

Fix #68303
Fix #68206

4 years agoSuggest named lifetime in ADT with hrtb
Esteban Küber [Tue, 11 Feb 2020 20:37:12 +0000 (12:37 -0800)]
Suggest named lifetime in ADT with hrtb

4 years agoKeyword docs
Giles Cope [Tue, 11 Feb 2020 20:36:36 +0000 (20:36 +0000)]
Keyword docs

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Tim Robinson <tim.g.robinson@gmail.com>
Co-Authored-By: Peter Todd <pete@petertodd.org>
Co-Authored-By: Dylan DPC <dylan.dpc@gmail.com>
4 years agoClarify why you shouldn't override `Analysis::into_engine`
Dylan MacKenzie [Tue, 11 Feb 2020 20:13:03 +0000 (12:13 -0800)]
Clarify why you shouldn't override `Analysis::into_engine`