]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #87904 - kpreid:unsize, r=jyn514
Jubilee [Sat, 11 Sep 2021 15:23:38 +0000 (08:23 -0700)]
Rollup merge of #87904 - kpreid:unsize, r=jyn514

Reword description of automatic impls of `Unsize`.

The existing documentation felt a little unhelpfully concise, so this change tries to improve it by using longer sentences, each of which specifies which kinds of types it applies to as early as possible. In particular, the third item starts with “Structs ...” instead of saying “Foo is a struct” later.

Also, the previous list items “Only the last field has a type involving `T`” and “`T` is not part of the type of any other fields” are, as far as I see, redundant with each other, so I removed the latter.

I have no particular knowledge of `Unsize`; I have attempted to leave the meaning entirely unchanged but may have missed a nuance.

Markdown preview of the edited documentation:

> All implementations of `Unsize` are provided automatically by the compiler.
> Those implementations are:
>
> - Arrays `[T; N]` implement `Unsize<[T]>`.
> - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
> - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
>   are met:
>   - `T: Unsize<U>`.
>   - Only the last field of `Foo` has a type involving `T`.
>   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.

2 years agoAdd test for -Z panic-in-drop=abort
Amanieu d'Antras [Fri, 10 Sep 2021 18:42:32 +0000 (19:42 +0100)]
Add test for -Z panic-in-drop=abort

2 years agoEnsure that crates are linked with compatible panic-in-drop settings
Amanieu d'Antras [Thu, 9 Sep 2021 12:31:19 +0000 (13:31 +0100)]
Ensure that crates are linked with compatible panic-in-drop settings

2 years agoApply noreturn and nounwind LLVM attributes to callsites
Amanieu d'Antras [Mon, 6 Sep 2021 11:10:11 +0000 (13:10 +0200)]
Apply noreturn and nounwind LLVM attributes to callsites

2 years agoAuto merge of #88327 - bonega:scalar_refactor, r=eddyb
bors [Sat, 11 Sep 2021 10:18:05 +0000 (10:18 +0000)]
Auto merge of #88327 - bonega:scalar_refactor, r=eddyb

`WrappingRange` (#88242) follow-up (`is_full_for`, `Scalar: Copy`, etc.)

Some changes related to feedback during #88242
r? `@RalfJung`

2 years agoFix duplicate bounds for const_trait_impl
Deadbeef [Sat, 11 Sep 2021 09:40:19 +0000 (09:40 +0000)]
Fix duplicate bounds for const_trait_impl

2 years agoAdd comment pointing to test
Andrew Hickman [Sat, 11 Sep 2021 09:08:11 +0000 (10:08 +0100)]
Add comment pointing to test

2 years agodon't convert types into identical types
Matthias Krüger [Sat, 11 Sep 2021 08:31:56 +0000 (10:31 +0200)]
don't convert types into identical types

example: let x: String = String::new().into();

2 years agodon't clone types that are Copy (clippy::clone_on_copy)
Matthias Krüger [Sat, 11 Sep 2021 08:18:56 +0000 (10:18 +0200)]
don't clone types that are Copy (clippy::clone_on_copy)

2 years agoAuto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa
bors [Sat, 11 Sep 2021 07:11:01 +0000 (07:11 +0000)]
Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa

rustc: use more correct span data in for loop desugaring

Fixes #82462

Before:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     for x in DroppingSlice(&*v).iter(); {
         |                                       +

After:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     };
         |      +

This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.

2 years agoAuto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth
bors [Sat, 11 Sep 2021 03:30:55 +0000 (03:30 +0000)]
Auto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth

Rollup of 15 pull requests

Successful merges:

 - #85200 (Ignore derived Clone and Debug implementations during dead code analysis)
 - #86165 (Add proc_macro::Span::{before, after}.)
 - #87088 (Fix stray notes when the source code is not available)
 - #87441 (Emit suggestion when passing byte literal to format macro)
 - #88546 (Emit proper errors when on missing closure braces)
 - #88578 (fix(rustc): suggest `items` be borrowed in `for i in items[x..]`)
 - #88632 (Fix issues with Markdown summary options)
 - #88639 (rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields)
 - #88667 (Tweak `write_fmt` doc.)
 - #88720 (Rustdoc coverage fields count)
 - #88732 (RustWrapper: avoid deleted unclear attribute methods)
 - #88742 (Fix table in docblocks)
 - #88776 (Workaround blink/chromium grid layout limitation of 1000 rows)
 - #88807 (Fix typo in docs for iterators)
 - #88812 (Fix typo `option` -> `options`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoMake sure the call span parens check only fires on the callee, not args
Michael Howell [Sat, 11 Sep 2021 01:48:25 +0000 (18:48 -0700)]
Make sure the call span parens check only fires on the callee, not args

2 years agoAdd the corrections stuff to the 88803 test case
Michael Howell [Sat, 11 Sep 2021 01:34:51 +0000 (18:34 -0700)]
Add the corrections stuff to the 88803 test case

2 years agofeat(rustc_typeck): suggest removing bad parens in `(recv.method)()`
Michael Howell [Sat, 11 Sep 2021 01:16:58 +0000 (18:16 -0700)]
feat(rustc_typeck): suggest removing bad parens in `(recv.method)()`

Fixes #88803

2 years agoUpdate LLVM submodule
Mitchell Kember [Wed, 8 Sep 2021 22:02:06 +0000 (15:02 -0700)]
Update LLVM submodule

This merges upstream `release/13.x` changes to our fork. In particular,
this includes the bugfix https://reviews.llvm.org/D108608 (see also
https://bugs.llvm.org/show_bug.cgi?id=51637).

2 years agoFill in the tracking issue for `#![feature(const_unsafecell_get_mut)]`
Waffle Lapkin [Fri, 10 Sep 2021 21:07:14 +0000 (00:07 +0300)]
Fill in the tracking issue for `#![feature(const_unsafecell_get_mut)]`

2 years agorustc: Remove local variable IDs from `Export`s
Vadim Petrochenkov [Sun, 5 Sep 2021 20:37:15 +0000 (23:37 +0300)]
rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.

2 years agoAdd help for E0463
Guillaume Gomez [Fri, 10 Sep 2021 18:20:10 +0000 (20:20 +0200)]
Add help for E0463

2 years agoARMV6K 3DS: Removed useless parameters in target spec
Meziu [Fri, 10 Sep 2021 18:20:12 +0000 (20:20 +0200)]
ARMV6K 3DS: Removed useless parameters in target spec

2 years agoDuplicate tests for incremental spans mode.
Camille GILLOT [Thu, 22 Apr 2021 19:33:16 +0000 (21:33 +0200)]
Duplicate tests for incremental spans mode.

2 years agoRecord call_site parent for macros.
Camille GILLOT [Sun, 2 May 2021 19:19:28 +0000 (21:19 +0200)]
Record call_site parent for macros.

2 years agoRemove some span tracking.
Camille GILLOT [Fri, 30 Apr 2021 18:16:09 +0000 (20:16 +0200)]
Remove some span tracking.

2 years agoGive spans their parent item during lowering.
Camille GILLOT [Sun, 18 Apr 2021 19:28:23 +0000 (21:28 +0200)]
Give spans their parent item during lowering.

We only do this operation when incremental compilation is enabled. This
avoids pessimizing the span handling for non-incremental compilation.

2 years agoAdd actual spans to the crate hash.
Camille GILLOT [Sun, 2 May 2021 10:16:59 +0000 (12:16 +0200)]
Add actual spans to the crate hash.

Now that we encode spans relative to the items, the item's own span is
never actually hashed as part of the HIR.
In consequence, we explicitly include it in the crate hash to avoid
missing cross-crate invalidations.

2 years agoAdd sanity check.
Camille GILLOT [Tue, 27 Apr 2021 17:58:46 +0000 (19:58 +0200)]
Add sanity check.

We force the relative span's parent to be absolute. This avoids having to
handle long dependency chains.

2 years agoRename decode to data_untracked.
Camille GILLOT [Fri, 30 Apr 2021 18:15:22 +0000 (20:15 +0200)]
Rename decode to data_untracked.

2 years agoTrack span dependency using a callback.
Camille GILLOT [Tue, 27 Apr 2021 17:24:33 +0000 (19:24 +0200)]
Track span dependency using a callback.

2 years agoEncode spans relative to their parent.
Camille GILLOT [Sun, 18 Apr 2021 12:27:28 +0000 (14:27 +0200)]
Encode spans relative to their parent.

2 years agoKeep a parent LocalDefId in SpanData.
Camille GILLOT [Sun, 18 Apr 2021 12:27:04 +0000 (14:27 +0200)]
Keep a parent LocalDefId in SpanData.

2 years agoKeep def_spans collected by resolution.
Camille GILLOT [Sun, 4 Apr 2021 14:04:38 +0000 (16:04 +0200)]
Keep def_spans collected by resolution.

2 years agoAuto merge of #88823 - hyd-dev:miri, r=RalfJung
bors [Fri, 10 Sep 2021 15:51:58 +0000 (15:51 +0000)]
Auto merge of #88823 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #88768.

r? `@RalfJung`

2 years agoRollup merge of #88812 - gz:patch-1, r=ehuss
Manish Goregaokar [Fri, 10 Sep 2021 15:23:27 +0000 (08:23 -0700)]
Rollup merge of #88812 - gz:patch-1, r=ehuss

Fix typo `option` -> `options`.

2 years agoRollup merge of #88807 - jruderman:which_reverses, r=joshtriplett
Manish Goregaokar [Fri, 10 Sep 2021 15:23:26 +0000 (08:23 -0700)]
Rollup merge of #88807 - jruderman:which_reverses, r=joshtriplett

Fix typo in docs for iterators

2 years agoRollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=Guilla...
Manish Goregaokar [Fri, 10 Sep 2021 15:23:25 +0000 (08:23 -0700)]
Rollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=GuillaumeGomez

Workaround blink/chromium grid layout limitation of 1000 rows

I made this in case we don't come up with a better solution in time.

See https://github.com/rust-lang/rust/issues/88545 for more details.

A rendered version of the standard library is hosted here:
https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html

r? `@GuillaumeGomez` `@jsha`

2 years agoRollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121
Manish Goregaokar [Fri, 10 Sep 2021 15:23:24 +0000 (08:23 -0700)]
Rollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121

Fix table in docblocks

"Overwrite" of #88702.

Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block.

![Screenshot from 2021-09-08 15-11-24](https://user-images.githubusercontent.com/3050060/132515740-71796515-e74f-429f-ba98-2596bdbf781c.png)

Thanks `@nbdd0121` for `overflow-x: auto;`. ;)

r? `@notriddle`

2 years agoRollup merge of #88732 - durin42:llvm-14-attrs-2, r=nikic
Manish Goregaokar [Fri, 10 Sep 2021 15:23:23 +0000 (08:23 -0700)]
Rollup merge of #88732 - durin42:llvm-14-attrs-2, r=nikic

RustWrapper: avoid deleted unclear attribute methods

These were deleted in https://reviews.llvm.org/D108614, and in C++ I
definitely see the argument for their removal. I didn't try and
propagate the changes up into higher layers of rustc in this change
because my initial goal was to get rustc working against LLVM HEAD
promptly, but I'm happy to follow up with some refactoring to make the
API on the Rust side match the LLVM API more directly (though the way
the enum works in Rust makes the API less scary IMO).

r? ``@nagisa`` cc ``@nikic``

2 years agoRollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, r=Manishearth
Manish Goregaokar [Fri, 10 Sep 2021 15:23:22 +0000 (08:23 -0700)]
Rollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, r=Manishearth

Rustdoc coverage fields count

Follow-up of #88688.

Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count.

r? `@Manishearth`

2 years agoRollup merge of #88667 - kraktus:patch-1, r=dtolnay
Manish Goregaokar [Fri, 10 Sep 2021 15:23:21 +0000 (08:23 -0700)]
Rollup merge of #88667 - kraktus:patch-1, r=dtolnay

Tweak `write_fmt` doc.

Found this weird sentence while reading the docs.

2 years agoRollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomez
Manish Goregaokar [Fri, 10 Sep 2021 15:23:20 +0000 (08:23 -0700)]
Rollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomez

rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields

Fixes #88600.

```rust
pub struct H;
pub struct S;

pub enum FooEnum {
    HiddenTupleItem(#[doc(hidden)] H),
    MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
    MixedHiddenFirst(#[doc(hidden)] H, S),
    MixedHiddenLast(S, #[doc(hidden)] H),
    HiddenStruct {
        #[doc(hidden)]
        h: H,
        s: S,
    },
}
```

Generates
![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)

2 years agoRollup merge of #88632 - camelid:md-opts, r=CraftSpider
Manish Goregaokar [Fri, 10 Sep 2021 15:23:19 +0000 (08:23 -0700)]
Rollup merge of #88632 - camelid:md-opts, r=CraftSpider

Fix issues with Markdown summary options

- Use `summary_opts()` for Markdown summaries
- Enable all main body Markdown options for summaries

2 years agoRollup merge of #88578 - notriddle:notriddle/suggest-add-reference-to-for-loop-iter...
Manish Goregaokar [Fri, 10 Sep 2021 15:23:18 +0000 (08:23 -0700)]
Rollup merge of #88578 - notriddle:notriddle/suggest-add-reference-to-for-loop-iter, r=nagisa

fix(rustc): suggest `items` be borrowed in `for i in items[x..]`

Fixes #87994

2 years agoRollup merge of #88546 - scrabsha:scrabsha/closure-missing-braces, r=estebank
Manish Goregaokar [Fri, 10 Sep 2021 15:23:17 +0000 (08:23 -0700)]
Rollup merge of #88546 - scrabsha:scrabsha/closure-missing-braces, r=estebank

Emit proper errors when on missing closure braces

This commit focuses on emitting clean errors for the following syntax
error:

```
Some(42).map(|a|
    dbg!(a);
    a
);
```

Previous implementation tried to recover after parsing the closure body
(the `dbg` expression) by replacing the next `;` with a `,`, which made
the next expression belong to the next function argument. As such, the
following errors were emitted (among others):
  - the semicolon token was not expected,
  - a is not in scope,
  - Option::map is supposed to take one argument, not two.

This commit allows us to gracefully handle this situation by adding
giving the parser the ability to remember when it has just parsed a
closure body inside a function call. When this happens, we can treat the
unexpected `;` specifically and try to parse as much statements as
possible in order to eat the whole block. When we can't parse statements
anymore, we generate a clean error indicating that the braces are
missing, and return an ExprKind::Err.

Closes #88065.

r? `@estebank`

2 years agoRollup merge of #87441 - ibraheemdev:i-86865, r=cjgillot
Manish Goregaokar [Fri, 10 Sep 2021 15:23:15 +0000 (08:23 -0700)]
Rollup merge of #87441 - ibraheemdev:i-86865, r=cjgillot

Emit suggestion when passing byte literal to format macro

Closes #86865

2 years agoRollup merge of #87088 - FabianWolff:issue-87060, r=estebank
Manish Goregaokar [Fri, 10 Sep 2021 15:23:15 +0000 (08:23 -0700)]
Rollup merge of #87088 - FabianWolff:issue-87060, r=estebank

Fix stray notes when the source code is not available

Fixes #87060. To reproduce it with a local build of rustc, you have to copy the compiler (e.g. `build/x86_64-unknown-linux-gnu/stage1/`) somewhere and then rename the compiler source directory (maybe there is a smarter way as well). Then, rustc won't find the standard library sources and report stray notes such as
```
note: deref defined here
```
with no location for "here". Another example I've found is this:
```rust
use std::ops::Add;

fn foo<T: Add<Output=()>>(x: T) {
    x + x;
}

fn main() {}
```
```
error[E0382]: use of moved value: `x`
  --> binop.rs:4:9
   |
3  | fn foo<T: Add<Output=()>>(x: T) {
   |                           - move occurs because `x` has type `T`, which does not implement the `Copy` trait
4  |     x + x;
   |     ----^
   |     |   |
   |     |   value used here after move
   |     `x` moved due to usage in operator
   |
note: calling this operator moves the left-hand side
help: consider further restricting this bound
   |
3  | fn foo<T: Add<Output=()> + Copy>(x: T) {
   |                          ^^^^^^

error: aborting due to previous error
```
where, again, the note is supposed to point somewhere but doesn't. I have fixed this by checking whether the corresponding source code is actually available before emitting the note.

2 years agoRollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay
Manish Goregaokar [Fri, 10 Sep 2021 15:23:14 +0000 (08:23 -0700)]
Rollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay

Add proc_macro::Span::{before, after}.

This adds `proc_macro::Span::before()` and `proc_macro::Span::after()` to get a zero width span at the start or end of the span.

These are equivalent to rustc's `Span::shrink_to_lo()` and `Span::shrink_to_hi()` but with a less cryptic name. They are useful when generating diagnostlics like "missing \<thing\> after \<thing\>".

E.g.

```rust
syn::Error::new(ident.span().after(), "missing `:` after field name").into_compile_error()
```

2 years agoRollup merge of #85200 - FabianWolff:issue-84647, r=nikomatsakis
Manish Goregaokar [Fri, 10 Sep 2021 15:23:13 +0000 (08:23 -0700)]
Rollup merge of #85200 - FabianWolff:issue-84647, r=nikomatsakis

Ignore derived Clone and Debug implementations during dead code analysis

This pull request fixes #84647. Derived implementations of `Clone` and `Debug` always trivially read all fields, so "field is never read" dead code warnings are never triggered. Arguably, though, a user most likely will only be interested in whether _their_ code ever reads those fields, which is the behavior I have implemented here.

Note that implementations of `Clone` and `Debug` are only ignored if they are `#[derive(...)]`d; a custom `impl Clone/Debug for ...` will still be analyzed normally (i.e. if a custom `Clone` implementation uses all fields of the struct, this will continue to suppress dead code warnings about unused fields); this seemed like the least intrusive change to me (although it would be easy to change — just drop the `&& [impl_]item.span.in_derive_expansion()` in the if conditions).

The only thing that I am slightly unsure about is that in #84647, `@matklad` said
> Doesn't seem easy to fix though :(

However, it _was_ pretty straightforward to fix, so did I perhaps overlook something obvious? `@matklad,` could you weigh in on this?

2 years agoUpdate Miri
hyd-dev [Fri, 10 Sep 2021 14:17:57 +0000 (22:17 +0800)]
Update Miri

2 years agoTreat drop_in_place as nounwind with -Z panic-in-drop=abort
Amanieu d'Antras [Mon, 6 Sep 2021 10:59:52 +0000 (12:59 +0200)]
Treat drop_in_place as nounwind with -Z panic-in-drop=abort

The AbortUnwindCalls MIR pass will eliminate any unnecessary cleanups
and will prevent any unwinds from leaking out by forcing an abort.

2 years agoAuto merge of #88797 - m-ou-se:uhhhh, r=pietroalbini
bors [Fri, 10 Sep 2021 12:26:55 +0000 (12:26 +0000)]
Auto merge of #88797 - m-ou-se:uhhhh, r=pietroalbini

Work around CI issue with windows sdk 10.0.20348.0.

See https://github.com/rust-lang/rust/issues/88796#issuecomment-916844522

2 years agoTemporarily ignore some debuginfo tests on windows.
Mara Bos [Fri, 10 Sep 2021 12:08:19 +0000 (14:08 +0200)]
Temporarily ignore some debuginfo tests on windows.

2 years agoWork around CI issue with windows sdk 10.0.20348.0.
Mara Bos [Fri, 10 Sep 2021 11:46:15 +0000 (13:46 +0200)]
Work around CI issue with windows sdk 10.0.20348.0.

2 years agoAdd test for enum tuple variants and tuple struct doc count
Guillaume Gomez [Mon, 6 Sep 2021 14:27:09 +0000 (16:27 +0200)]
Add test for enum tuple variants and tuple struct doc count

2 years agoDon't require documentation for fields in an enum tuple variant or for tuple struct...
Guillaume Gomez [Mon, 6 Sep 2021 14:26:49 +0000 (16:26 +0200)]
Don't require documentation for fields in an enum tuple variant or for tuple struct fields.

2 years agoFix typo `option` -> `options`.
Gerd Zellweger [Fri, 10 Sep 2021 07:36:35 +0000 (00:36 -0700)]
Fix typo `option` -> `options`.

2 years agoUse FxHashMap
jackh726 [Fri, 10 Sep 2021 03:28:20 +0000 (23:28 -0400)]
Use FxHashMap

2 years agoFix typo in docs for iterators
Jesse Ruderman [Fri, 10 Sep 2021 02:21:56 +0000 (19:21 -0700)]
Fix typo in docs for iterators

2 years agoRemove unnecessary `Cache.*_did` fields
Noah Lev [Sun, 22 Aug 2021 03:58:23 +0000 (20:58 -0700)]
Remove unnecessary `Cache.*_did` fields

They can be obtained by accessing the `TyCtxt` where they are needed.

2 years agoIn relate_tys, when creating new universes, insert missing universes as other
jackh726 [Thu, 9 Sep 2021 22:04:59 +0000 (18:04 -0400)]
In relate_tys, when creating new universes, insert missing universes as other

2 years agoFix two uses of `span_note` when the source is not available
Fabian Wolff [Mon, 12 Jul 2021 16:08:14 +0000 (18:08 +0200)]
Fix two uses of `span_note` when the source is not available

2 years agoAdd -Z panic-in-drop={unwind,abort} command-line option
Amanieu d'Antras [Mon, 6 Sep 2021 10:21:47 +0000 (12:21 +0200)]
Add -Z panic-in-drop={unwind,abort} command-line option

2 years agoIgnore automatically derived impls of `Clone` and `Debug` in dead code analysis
Fabian Wolff [Fri, 21 May 2021 17:35:49 +0000 (19:35 +0200)]
Ignore automatically derived impls of `Clone` and `Debug` in dead code analysis

2 years agoEmit proper errors on missing closure braces
Sasha Pourcelot [Mon, 16 Aug 2021 13:22:36 +0000 (15:22 +0200)]
Emit proper errors on missing closure braces

This commit focuses on emitting clean errors for the following syntax
error:

```
Some(42).map(|a|
    dbg!(a);
    a
);
```

Previous implementation tried to recover after parsing the closure body
(the `dbg` expression) by replacing the next `;` with a `,`, which made
the next expression belong to the next function argument. As such, the
following errors were emitted (among others):
  - the semicolon token was not expected,
  - a is not in scope,
  - Option::map is supposed to take one argument, not two.

This commit allows us to gracefully handle this situation by adding
giving the parser the ability to remember when it has just parsed a
closure body inside a function call. When this happens, we can treat the
unexpected `;` specifically and try to parse as much statements as
possible in order to eat the whole block. When we can't parse statements
anymore, we generate a clean error indicating that the braces are
missing, and return an ExprKind::Err.

2 years agoOnly add_implied_bounds for norm_ty if different
jackh726 [Thu, 9 Sep 2021 15:24:55 +0000 (11:24 -0400)]
Only add_implied_bounds for norm_ty if different

2 years agoUse FxHashSet instead of Vec for well formed tys
jackh726 [Thu, 9 Sep 2021 03:38:57 +0000 (23:38 -0400)]
Use FxHashSet instead of Vec for well formed tys

2 years agoadd test for builtin types N + N unifying with fn call
Ellen [Thu, 9 Sep 2021 14:43:59 +0000 (15:43 +0100)]
add test for builtin types N + N unifying with fn call

2 years agoUse more accurate spans for "unused delimiter" lint
Esteban Kuber [Thu, 9 Sep 2021 14:22:24 +0000 (14:22 +0000)]
Use more accurate spans for "unused delimiter" lint

2 years agoregression test for issue #88583.
Felix S. Klock II [Thu, 9 Sep 2021 13:31:56 +0000 (09:31 -0400)]
regression test for issue #88583.

2 years agoRe-add 71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 post-revert.
Felix S. Klock II [Wed, 8 Sep 2021 18:48:12 +0000 (14:48 -0400)]
Re-add 71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 post-revert.

2 years agoRevert "Implement Anonymous{Struct, Union} in the AST"
Felix S. Klock II [Wed, 8 Sep 2021 18:03:40 +0000 (14:03 -0400)]
Revert "Implement Anonymous{Struct, Union} in the AST"

This reverts commit 059b68dd677808e14e560802d235ad40beeba71e.

Note that this was manually adjusted to retain some of the refactoring
introduced by commit 059b68dd677808e14e560802d235ad40beeba71e, so that it could
likewise retain the correction introduced in commit
5b4bc05fa57be19bb5962f4b7c0f165e194e3151

2 years agoManually crafted revert of d4ad050ce5778a09566f6f9ec172565815d54604 .
Felix S. Klock II [Wed, 8 Sep 2021 17:48:42 +0000 (13:48 -0400)]
Manually crafted revert of d4ad050ce5778a09566f6f9ec172565815d54604 .

2 years agoRevert "Add test for restriction of anonymous types on validation"
Felix S. Klock II [Wed, 8 Sep 2021 17:41:46 +0000 (13:41 -0400)]
Revert "Add test for restriction of anonymous types on validation"

This reverts commit 8a1dd6918bb686a960ad5ced46a16b5b59668464.

2 years agoRevert "Fix ast expanded printing for anonymous types"
Felix S. Klock II [Wed, 8 Sep 2021 18:52:49 +0000 (14:52 -0400)]
Revert "Fix ast expanded printing for anonymous types"

This reverts commit 5b4bc05fa57be19bb5962f4b7c0f165e194e3151.

2 years agoRevert "Add test for pretty printing anonymous types"
Felix S. Klock II [Wed, 8 Sep 2021 18:52:43 +0000 (14:52 -0400)]
Revert "Add test for pretty printing anonymous types"

This reverts commit d59b1f1ef4be692b67c1ff1b49ec810fd59452cf.

2 years agoRevert "Allow formatting `Anonymous{Struct, Union}` declarations"
Felix S. Klock II [Wed, 8 Sep 2021 17:40:32 +0000 (13:40 -0400)]
Revert "Allow formatting `Anonymous{Struct, Union}` declarations"

This reverts commit 64acb7d92135ae722dfce89f0ca9d7cf6576de66.

2 years agoWorkaround blink/chromium grid layout limitation of 1000 rows
Stefan Schindler [Thu, 9 Sep 2021 13:11:02 +0000 (15:11 +0200)]
Workaround blink/chromium grid layout limitation of 1000 rows

See https://github.com/rust-lang/rust/issues/88545 for more details

2 years agoUpdate lockfile
Samuel E. Moelius III [Thu, 9 Sep 2021 09:21:41 +0000 (05:21 -0400)]
Update lockfile

2 years agoUpdate dependencies
Samuel E. Moelius III [Thu, 9 Sep 2021 09:19:03 +0000 (05:19 -0400)]
Update dependencies

2 years agoAllow missing code examples in trait impls.
Hans Niklas Jacob [Wed, 8 Sep 2021 14:03:15 +0000 (16:03 +0200)]
Allow missing code examples in trait impls.

2 years agoAuto merge of #88676 - devnexen:fbsd_toolchain_upd, r=Mark-Simulacrum
bors [Thu, 9 Sep 2021 09:21:30 +0000 (09:21 +0000)]
Auto merge of #88676 - devnexen:fbsd_toolchain_upd, r=Mark-Simulacrum

update of the CI freebsd toolchain

adding libproctsta, for the upcoming libc update.

2 years agoPrep for upgrade to cargo_metadata 0.14.0
Samuel E. Moelius III [Wed, 1 Sep 2021 22:31:42 +0000 (18:31 -0400)]
Prep for upgrade to cargo_metadata 0.14.0

2 years agobugfix
Andreas Liljeqvist [Wed, 8 Sep 2021 14:29:05 +0000 (16:29 +0200)]
bugfix

2 years agoWrap
Andreas Liljeqvist [Wed, 8 Sep 2021 11:24:23 +0000 (13:24 +0200)]
Wrap

2 years agorename `is_valid_for` to `is_valid`
Andreas Liljeqvist [Tue, 7 Sep 2021 18:51:09 +0000 (20:51 +0200)]
rename `is_valid_for` to `is_valid`

2 years agoRename `(un)signed` to `(un)signed_int`
Andreas Liljeqvist [Tue, 7 Sep 2021 18:44:33 +0000 (20:44 +0200)]
Rename `(un)signed` to `(un)signed_int`

2 years agoMove `unsigned_max` etc into `Size` again
Andreas Liljeqvist [Mon, 6 Sep 2021 18:11:29 +0000 (20:11 +0200)]
Move `unsigned_max` etc into `Size` again

2 years agoRemove clone
Andreas Liljeqvist [Sun, 5 Sep 2021 08:59:14 +0000 (10:59 +0200)]
Remove clone

2 years agoMake `abi::Abi` `Copy` and remove a *lot* of refs
Andreas Liljeqvist [Sun, 29 Aug 2021 09:06:55 +0000 (11:06 +0200)]
Make `abi::Abi` `Copy` and remove a *lot* of refs

fix

fix

Remove more refs and clones

fix

more

fix

2 years agoFix docstring
Andreas Liljeqvist [Sun, 29 Aug 2021 08:02:45 +0000 (10:02 +0200)]
Fix docstring

2 years agoUse special `Debug` format when `start` > `end`
Andreas Liljeqvist [Sun, 29 Aug 2021 07:58:23 +0000 (09:58 +0200)]
Use special `Debug` format when `start` > `end`

2 years agoRemove `contains_zero`, respect the compiler
Andreas Liljeqvist [Sat, 28 Aug 2021 09:11:33 +0000 (11:11 +0200)]
Remove `contains_zero`, respect the compiler

2 years agoderive Copy for WrappingRange and Scalar
Andreas Liljeqvist [Sat, 28 Aug 2021 09:04:23 +0000 (11:04 +0200)]
derive Copy for WrappingRange and Scalar

2 years agofix match
Andreas Liljeqvist [Sat, 28 Aug 2021 08:57:34 +0000 (10:57 +0200)]
fix match

2 years agoAdd methods for checking for full ranges to `Scalar` and `WrappingRange`
Andreas Liljeqvist [Wed, 25 Aug 2021 13:21:45 +0000 (15:21 +0200)]
Add methods for checking for full ranges to `Scalar` and `WrappingRange`

Move *_max methods back to util

change to inline instead of inline(always)

Remove valid_range_exclusive from scalar
Use WrappingRange instead

implement always_valid_for in a safer way

Fix accidental edit

2 years agoAuto merge of #88748 - bjorn3:try_fix_perf_regression, r=wesleywiser
bors [Thu, 9 Sep 2021 06:16:04 +0000 (06:16 +0000)]
Auto merge of #88748 - bjorn3:try_fix_perf_regression, r=wesleywiser

Revert "Remove optimization_fuel_crate from Session"

This reverts commit 5464b2e713d5366b3aec5c6eebbe1b84a782c51e.

This hopefully fixes the perf regression in https://github.com/rust-lang/rust/pull/88530#issuecomment-915314117.

2 years agoAllow ~const bounds on inherent impls
Deadbeef [Fri, 3 Sep 2021 10:37:57 +0000 (10:37 +0000)]
Allow ~const bounds on inherent impls

2 years agoAdd another test case + fmt
Deadbeef [Fri, 3 Sep 2021 10:04:43 +0000 (10:04 +0000)]
Add another test case + fmt

2 years agofix precise live drops
Deadbeef [Fri, 3 Sep 2021 09:53:57 +0000 (09:53 +0000)]
fix precise live drops

2 years agodo not require lang item
Deadbeef [Fri, 3 Sep 2021 09:25:27 +0000 (09:25 +0000)]
do not require lang item

2 years agoRemove the queries
Deadbeef [Thu, 2 Sep 2021 11:04:29 +0000 (11:04 +0000)]
Remove the queries

2 years agoUse trait select logic instead of query
Deadbeef [Thu, 2 Sep 2021 10:59:53 +0000 (10:59 +0000)]
Use trait select logic instead of query