]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoRollup merge of #101493 - spastorino:borrow-mut-impl-trait-context, r=oli-obk
Matthias Krüger [Wed, 7 Sep 2022 19:48:14 +0000 (21:48 +0200)]
Rollup merge of #101493 - spastorino:borrow-mut-impl-trait-context, r=oli-obk

Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow

`@oli-obk` requested this and other changes as a way of simplifying #101345. This is just going to make the diff of #101345 smaller.

r? `@oli-obk` `@cjgillot`

21 months agoRollup merge of #101435 - JakobDegen:bitwidth-tests, r=wesleywiser
Matthias Krüger [Wed, 7 Sep 2022 19:48:13 +0000 (21:48 +0200)]
Rollup merge of #101435 - JakobDegen:bitwidth-tests, r=wesleywiser

Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`

This commit removes the annotation only for those tests where the 32 bit and 64 bit files were exactly identical. I didn't touch anything in the `mir-opt/const` directory, since having this annotation there seems more principled, even if it doesn't make a difference.

This also removes four additional files related to the `separate_const_switch.rs` test. The associated annotations were removed in #100827 , but I forgot to remove the files as well. (#97564 is the issue tracking an automated check here)

r? ```@wesleywiser```

21 months agoRollup merge of #101416 - uarif1:doc_non_blocking_stdio, r=joshtriplett
Matthias Krüger [Wed, 7 Sep 2022 19:48:12 +0000 (21:48 +0200)]
Rollup merge of #101416 - uarif1:doc_non_blocking_stdio, r=joshtriplett

stdio: Document no support for writing to non-blocking stdio/stderr

Printing to stdio/stderr that have been opened with non-blocking
(O_NONBLOCK in linux) can result in an error, which is not handled
by std::io module causing a panic.

Signed-off-by: Usama Arif <usama.arif@bytedance.com>
21 months agoRollup merge of #101343 - diminishedprime:patch-3, r=tmandry
Matthias Krüger [Wed, 7 Sep 2022 19:48:11 +0000 (21:48 +0200)]
Rollup merge of #101343 - diminishedprime:patch-3, r=tmandry

Add -api-level to pm command

As of ~Aug 30th, `pm build` commands require an `api-level` flag. This flag should match the fuchsia api-level that's being targeted by the code. Since this is dependent on the version of the SDK that's being used, we may want to change this to something a bit more robust in the future.

21 months agoAuto merge of #101522 - oli-obk:miriup, r=oli-obk
bors [Wed, 7 Sep 2022 16:31:39 +0000 (16:31 +0000)]
Auto merge of #101522 - oli-obk:miriup, r=oli-obk

Update miri submodule

fixes #101344

cc `@rust-lang/miri`

r? `@ghost`

21 months agoUpdate miri submodule
Oli Scherer [Wed, 7 Sep 2022 08:43:29 +0000 (08:43 +0000)]
Update miri submodule

21 months agoAuto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
bors [Wed, 7 Sep 2022 13:49:58 +0000 (13:49 +0000)]
Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr

Shrink `PredicateS`

r? `@ghost`

21 months agostdio: Document no support for writing to non-blocking stdio/stderr
Usama Arif [Sun, 4 Sep 2022 17:43:18 +0000 (18:43 +0100)]
stdio: Document no support for writing to non-blocking stdio/stderr

Printing to stdio/stderr that have been opened with non-blocking
(O_NONBLOCK in linux) can result in an error, which is not handled
by std::io module causing a panic.

Signed-off-by: Usama Arif <usama.arif@bytedance.com>
21 months agoAuto merge of #98332 - oli-obk:assume, r=wesleywiser
bors [Wed, 7 Sep 2022 09:47:23 +0000 (09:47 +0000)]
Auto merge of #98332 - oli-obk:assume, r=wesleywiser

Lower the assume intrinsic to a MIR statement

This makes https://github.com/rust-lang/rust/pull/96862#issuecomment-1153739068 easier and will generally allow us to cheaply insert assume intrinsic calls in mir building.

r? rust-lang/wg-mir-opt

21 months agoAuto merge of #101232 - nikic:issue-98294, r=Mark-Simulacrum
bors [Wed, 7 Sep 2022 05:58:29 +0000 (05:58 +0000)]
Auto merge of #101232 - nikic:issue-98294, r=Mark-Simulacrum

Add test for #98294

Add a test to make that the failure condition for this pattern is optimized away.

Fixes #98294.

21 months agoAuto merge of #100801 - Kobzol:track-pgo-profile-paths, r=michaelwoerister
bors [Wed, 7 Sep 2022 03:17:10 +0000 (03:17 +0000)]
Auto merge of #100801 - Kobzol:track-pgo-profile-paths, r=michaelwoerister

Track PGO profiles in depinfo

This PR makes sure that PGO profiles (`-Cprofile-use` and `-Cprofile-sample-use`) are tracked in depinfo, so that when they change, the compilation session will be invalidated.

This approach was discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Tracking.20PGO.20profile.20files.20in.20cargo).

I tried it locally and it seems that the code is recompiled just with this change, and https://github.com/rust-lang/rust/pull/100413 is not even needed. But it's possible that not everything required is recompiled, so we will probably want to land both changes.

Another approach to implement this could be to store the PGO profiles in `sess.parse_sess.file_depinfo` when the session is being created, but then the paths would have to be converted to a string and then to a symbol, which seemed unnecessarily complicated.

CC `@michaelwoerister`

r? `@Eh2406`

21 months agoAuto merge of #101508 - JohnTitor:rollup-i5i2vqc, r=JohnTitor
bors [Wed, 7 Sep 2022 00:35:54 +0000 (00:35 +0000)]
Auto merge of #101508 - JohnTitor:rollup-i5i2vqc, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #101451 (Add incremental test for changing struct name in assoc type.)
 - #101468 (fix RPIT ICE for implicit HRTB when missing dyn)
 - #101481 (Fix compile errors for uwp-windows-msvc targets)
 - #101484 (Remove dead broken code from const zst handling in backends)
 - #101486 (Add list of recognized repr attributes to the unrecognized repr error)
 - #101488 (rustdoc: remove unused CSS `#results > table`)
 - #101491 (rustdoc: remove outdated CSS `.sub-variant > div > .item-info`)
 - #101497 (:arrow_up: rust-analyzer)

Failed merges:

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

21 months agoRollup merge of #101497 - lnicola:rust-analyzer-2022-09-06, r=lnicola
Yuki Okushi [Tue, 6 Sep 2022 22:43:57 +0000 (07:43 +0900)]
Rollup merge of #101497 - lnicola:rust-analyzer-2022-09-06, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

21 months agoRollup merge of #101491 - notriddle:notriddle/sub-variant-div-item-info, r=GuillaumeGomez
Yuki Okushi [Tue, 6 Sep 2022 22:43:57 +0000 (07:43 +0900)]
Rollup merge of #101491 - notriddle:notriddle/sub-variant-div-item-info, r=GuillaumeGomez

rustdoc: remove outdated CSS `.sub-variant > div > .item-info`

This CSS still matches sometimes, as you can see in <https://doc.rust-lang.org/1.63.0/std/collections/enum.TryReserveErrorKind.html#variant.AllocError.fields>, but since nothing else is setting `margin-top`, putting it back to `initial` does nothing.

This selector was added here, but it was called `.stability` instead of `.item-info` at the time, probably as an override for the selector immediately above it that sets a negative margin:

https://github.com/rust-lang/rust/blob/2fd378b82b14f2746462018e8510e15a079818a0/src/librustdoc/html/static/rustdoc.css#L514-L522

That negative margin was removed in 593d6d1cb15c55c88319470dabb40126c7b7f1e2.

21 months agoRollup merge of #101488 - notriddle:notriddle/results-table, r=GuillaumeGomez
Yuki Okushi [Tue, 6 Sep 2022 22:43:56 +0000 (07:43 +0900)]
Rollup merge of #101488 - notriddle:notriddle/results-table, r=GuillaumeGomez

rustdoc: remove unused CSS `#results > table`

This code was added in 96ef2f8ab9bbea24b71c7441ee534407949848db to improve rendering of the search results table, but results have not used a table since b615c0c85469c94041a5e68b9d8b68dcf799f9f1 switched it to rendering with `<div>` tags.

21 months agoRollup merge of #101486 - asquared31415:invalid_repr_list, r=estebank
Yuki Okushi [Tue, 6 Sep 2022 22:43:54 +0000 (07:43 +0900)]
Rollup merge of #101486 - asquared31415:invalid_repr_list, r=estebank

Add list of recognized repr attributes to the unrecognized repr error

21 months agoRollup merge of #101484 - oli-obk:no_zst, r=eddyb
Yuki Okushi [Tue, 6 Sep 2022 22:43:54 +0000 (07:43 +0900)]
Rollup merge of #101484 - oli-obk:no_zst, r=eddyb

Remove dead broken code from const zst handling in backends

cc `@RalfJung`

found by `@eddyb` in https://github.com/rust-lang/rust/pull/98957#discussion_r963744605

21 months agoRollup merge of #101481 - ChrisDenton:uwp-fix, r=thomcc
Yuki Okushi [Tue, 6 Sep 2022 22:43:53 +0000 (07:43 +0900)]
Rollup merge of #101481 - ChrisDenton:uwp-fix, r=thomcc

Fix compile errors for uwp-windows-msvc targets

Fixes #101480

21 months agoRollup merge of #101468 - spastorino:fix-ice-rpit-hrtb-without-dyn, r=cjgillot
Yuki Okushi [Tue, 6 Sep 2022 22:43:52 +0000 (07:43 +0900)]
Rollup merge of #101468 - spastorino:fix-ice-rpit-hrtb-without-dyn, r=cjgillot

fix RPIT ICE for implicit HRTB when missing dyn

Closes #101297

r? `@cjgillot`

cc `@nikomatsakis`

21 months agoRollup merge of #101451 - cjgillot:test-100521, r=TaKO8Ki
Yuki Okushi [Tue, 6 Sep 2022 22:43:51 +0000 (07:43 +0900)]
Rollup merge of #101451 - cjgillot:test-100521, r=TaKO8Ki

Add incremental test for changing struct name in assoc type.

The ICE appears on beta and is fixed on nightly.

Fixes #100521

21 months agoAuto merge of #100404 - BelovDV:linker_group, r=petrochenkov
bors [Tue, 6 Sep 2022 22:06:54 +0000 (22:06 +0000)]
Auto merge of #100404 - BelovDV:linker_group, r=petrochenkov

change stdlib circular dependencies handling

Remove group_start and group_end, add dependencies to symbols.o
Implements the suggestion from https://github.com/rust-lang/rust/pull/85805#discussion_r666249351
r? `@petrochenkov`

21 months agoPass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow later on
Santiago Pastorino [Fri, 2 Sep 2022 20:38:58 +0000 (17:38 -0300)]
Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow later on

21 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 6 Sep 2022 18:20:49 +0000 (21:20 +0300)]
:arrow_up: rust-analyzer

21 months agoAuto merge of #101485 - GuillaumeGomez:rollup-68p9di4, r=GuillaumeGomez
bors [Tue, 6 Sep 2022 18:10:14 +0000 (18:10 +0000)]
Auto merge of #101485 - GuillaumeGomez:rollup-68p9di4, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #101357 (Include enum path in variant suggestion)
 - #101434 (Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`)
 - #101445 (Suggest introducing an explicit lifetime if it does not exist)
 - #101457 (Recover from using `;` as separator between fields)
 - #101462 (Rustdoc-Json: Store Variant Fields as their own item.)
 - #101471 (Report number of delayed bugs properly with `-Ztreat-err-as-bug`)
 - #101473 (Add more size assertions for MIR types.)

Failed merges:

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

21 months agorustdoc: remove outdated CSS `.sub-variant > div > .item-info`
Michael Howell [Tue, 6 Sep 2022 17:33:58 +0000 (10:33 -0700)]
rustdoc: remove outdated CSS `.sub-variant > div > .item-info`

This CSS still matches sometimes, as you can see in
<https://doc.rust-lang.org/1.63.0/std/collections/enum.TryReserveErrorKind.html#variant.AllocError.fields>,
but since nothing else is setting `margin-top`, putting it back to `initial`
does nothing.

This selector was added in 2fd378b82b14f2746462018e8510e15a079818a0 (but it
was called `.stability` instead of `.item-info` at the time), probably as an
override for the selector immediately above it that sets a negative margin.
That negative margin was removed in 593d6d1cb15c55c88319470dabb40126c7b7f1e2.

21 months agorustdoc: remove unused CSS `#results > table`
Michael Howell [Tue, 6 Sep 2022 16:12:17 +0000 (09:12 -0700)]
rustdoc: remove unused CSS `#results > table`

This code was added in 96ef2f8ab9bbea24b71c7441ee534407949848db to improve
rendering of the search results table, but results have not used a table
since b615c0c85469c94041a5e68b9d8b68dcf799f9f1 switched it to rendering with
`<div>` tags.

21 months agoUpdate src/doc/rustc/src/platform-support/fuchsia.md
Matt Hamrick [Tue, 6 Sep 2022 16:04:28 +0000 (09:04 -0700)]
Update src/doc/rustc/src/platform-support/fuchsia.md

Co-authored-by: Andrew Pollack <andrewpkq@gmail.com>
21 months agoCheck all operands, they may contain indirections in their place
Oli Scherer [Tue, 6 Sep 2022 15:32:35 +0000 (15:32 +0000)]
Check all operands, they may contain indirections in their place

21 months agoadd list of recognized repr attributes to the unrecognized repr error
asquared31415 [Tue, 6 Sep 2022 15:02:42 +0000 (11:02 -0400)]
add list of recognized repr attributes to the unrecognized repr error

21 months agoRollup merge of #101473 - nnethercote:mir-size-assertions, r=lqd
Guillaume Gomez [Tue, 6 Sep 2022 15:00:30 +0000 (17:00 +0200)]
Rollup merge of #101473 - nnethercote:mir-size-assertions, r=lqd

Add more size assertions for MIR types.

And move them into a module, as has been done previously for AST, HIR,
etc.

r? `@lqd`

21 months agoRollup merge of #101471 - compiler-errors:delay-bug-are-count-too, r=oli-obk
Guillaume Gomez [Tue, 6 Sep 2022 15:00:29 +0000 (17:00 +0200)]
Rollup merge of #101471 - compiler-errors:delay-bug-are-count-too, r=oli-obk

Report number of delayed bugs properly with `-Ztreat-err-as-bug`

Report the number of delayed bugs that went into the `-Ztreat-errr-as-bug=N` being triggered, even if we don't count it in the err_count in regular diagnostic output.

Sometimes we have a session that creates a few diagnostics, perhaps: Error, Delay bug, Error, then Delay bug.
If I ran `-Ztreat-err-as-bug=3`, then I will now see "aborting after 2 errors and 1 delayed bugs" instead of just "after 2 errors" which is confusing since I passed `3`.

21 months agoRollup merge of #101462 - aDotInTheVoid:rdj-enum-field-2, r=GuillaumeGomez
Guillaume Gomez [Tue, 6 Sep 2022 15:00:28 +0000 (17:00 +0200)]
Rollup merge of #101462 - aDotInTheVoid:rdj-enum-field-2, r=GuillaumeGomez

Rustdoc-Json: Store Variant Fields as their own item.

Closes #100587
Closes #92945

Successor to #100762

Unlike that one, we don't have merge `StructType` and `Variant`, as after #101386 `Variant` stores enum specific information (discriminant).

Resolves the naming discussion (https://github.com/rust-lang/rust/pull/100762#discussion_r950690526) by having seperate enums for struct and enum kinds

Resolves `#[doc(hidden)]` on tuple structs (https://github.com/rust-lang/rust/pull/100762#discussion_r950833884) by storing as a `Vec<Option<Id>>`

r? `@GuillaumeGomez`

21 months agoRollup merge of #101457 - ChayimFriedman2:struct-field-semi, r=fee1-dead
Guillaume Gomez [Tue, 6 Sep 2022 15:00:28 +0000 (17:00 +0200)]
Rollup merge of #101457 - ChayimFriedman2:struct-field-semi, r=fee1-dead

Recover from using `;` as separator between fields

Partially fixes #101440 (only for record structs).

Doing that for tuple structs is harder as their parsing passes through a bunch of helper functions. I don't know how to do that. But [their error message is better anyway](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cc6ee8bb2593596c0cea89d49e79bcb4) and suggests using a comma, even if it doesn't suggest replacing the semicolon with it.

21 months agoRollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, r=oli-obk
Guillaume Gomez [Tue, 6 Sep 2022 15:00:27 +0000 (17:00 +0200)]
Rollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, r=oli-obk

Suggest introducing an explicit lifetime if it does not exist

Fixes #101027

21 months agoRollup merge of #101434 - JhonnyBillM:replace-session-for-handler-in-into-diagnostic...
Guillaume Gomez [Tue, 6 Sep 2022 15:00:26 +0000 (17:00 +0200)]
Rollup merge of #101434 - JhonnyBillM:replace-session-for-handler-in-into-diagnostic, r=davidtwco

Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`

Suggested by the team in [this Zulip Topic](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler).

`Handler` already has almost all the capabilities of `ParseSess` when it comes to diagnostic emission, in this migration we only needed to add the ability to access `source_map` from the emitter in order to get a `Snippet` and the `start_point`. Not sure if adding these two methods [`span_to_snippet_from_emitter` and  `span_start_point_from_emitter`] is the best way to address this gap.

P.S. If this goes in the right direction, then we probably may want to move `SessionDiagnostic` to `rustc_errors` and rename it to `DiagnosticHandler` or something similar.

r? `@davidtwco`
r? `@compiler-errors`

21 months agoRollup merge of #101357 - compiler-errors:variant-sugg-tweak, r=oli-obk
Guillaume Gomez [Tue, 6 Sep 2022 15:00:25 +0000 (17:00 +0200)]
Rollup merge of #101357 - compiler-errors:variant-sugg-tweak, r=oli-obk

Include enum path in variant suggestion

(except for `Result` and `Option`, which we should have via the prelude)

Fixes #101356

21 months agoTest bump
Oli Scherer [Tue, 6 Sep 2022 14:59:46 +0000 (14:59 +0000)]
Test bump

21 months agoAuto merge of #100733 - scottmcm:inline-from-from-identity, r=m-ou-se
bors [Tue, 6 Sep 2022 14:33:31 +0000 (14:33 +0000)]
Auto merge of #100733 - scottmcm:inline-from-from-identity, r=m-ou-se

Inline `<T as From<T>>::from`

I noticed (in https://github.com/rust-lang/rust/pull/100693#issuecomment-1218520141) that the MIR for <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=67097e0494363ee27421a4e3bdfaf513> has inlined most stuff
```
scope 5 (inlined <Result<i32, u32> as Try>::branch)
```
```
scope 8 (inlined <Result<i32, u32> as Try>::from_output)
```

But yet the do-nothing `from` call was still there:
```
_17 = <u32 as From<u32>>::from(move _18) -> bb9;
```

So let's give this a try and see what perf has to say.

21 months agoUpdate docs
Oli Scherer [Wed, 31 Aug 2022 15:24:22 +0000 (15:24 +0000)]
Update docs

21 months agoMove CTFE handling of nondiverging intrinsics to intrinsics.rs
Oli Scherer [Wed, 31 Aug 2022 15:23:41 +0000 (15:23 +0000)]
Move CTFE handling of nondiverging intrinsics to intrinsics.rs

21 months agoGeneralize the Assume intrinsic statement to a general Intrinsic statement
Oli Scherer [Tue, 12 Jul 2022 10:05:00 +0000 (10:05 +0000)]
Generalize the Assume intrinsic statement to a general Intrinsic statement

21 months agoLower the assume intrinsic to a MIR statement
Oli Scherer [Thu, 30 Jun 2022 08:16:05 +0000 (08:16 +0000)]
Lower the assume intrinsic to a MIR statement

21 months agoRemove dead broken code from const zst handling in backends
Oli Scherer [Tue, 6 Sep 2022 14:09:49 +0000 (14:09 +0000)]
Remove dead broken code from const zst handling in backends

21 months agofix RPIT ICE for implicit HRTB when missing dyn
Santiago Pastorino [Tue, 6 Sep 2022 00:58:12 +0000 (21:58 -0300)]
fix RPIT ICE for implicit HRTB when missing dyn

21 months agoFix compile errors for uwp-windows-msvc targets
Chris Denton [Tue, 6 Sep 2022 11:39:46 +0000 (12:39 +0100)]
Fix compile errors for uwp-windows-msvc targets

21 months agoAuto merge of #101479 - Dylan-DPC:rollup-v8ite0y, r=Dylan-DPC
bors [Tue, 6 Sep 2022 11:16:02 +0000 (11:16 +0000)]
Auto merge of #101479 - Dylan-DPC:rollup-v8ite0y, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #100658 (TyCtxt::get_attr should check that no duplicates are allowed)
 - #101021 (Migrate ``rustc_middle`` diagnostic)
 - #101287 (Document eager evaluation of `bool::then_some` argument)
 - #101412 (Some more cleanup in `core`)
 - #101427 (Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments)

Failed merges:

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

21 months agoRollup merge of #101427 - compiler-errors:issue-101421, r=cjgillot
Dylan DPC [Tue, 6 Sep 2022 11:04:45 +0000 (16:34 +0530)]
Rollup merge of #101427 - compiler-errors:issue-101421, r=cjgillot

Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments

Fixes #101421
cc #100838

21 months agoRollup merge of #101412 - WaffleLapkin:improve_std_ptr_code_leftovers, r=scottmcm
Dylan DPC [Tue, 6 Sep 2022 11:04:44 +0000 (16:34 +0530)]
Rollup merge of #101412 - WaffleLapkin:improve_std_ptr_code_leftovers, r=scottmcm

Some more cleanup in `core`

- remove some integer casts from slice iter (proposed in https://github.com/rust-lang/rust/pull/100819#discussion_r951113196)
- replace `as usize` casts with `usize::from` in slice sort (proposed in https://github.com/rust-lang/rust/pull/100822#discussion_r950768698)

r? `@scottmcm`

21 months agoRollup merge of #101287 - Adam-Gleave:doc_bool_then_some, r=scottmcm
Dylan DPC [Tue, 6 Sep 2022 11:04:43 +0000 (16:34 +0530)]
Rollup merge of #101287 - Adam-Gleave:doc_bool_then_some, r=scottmcm

Document eager evaluation of `bool::then_some` argument

I encountered this earlier today and thought maybe `bool::then_some` could use a little addition to the documentation.

It's pretty obvious with familiarity and from looking at the implementation, but the argument for `then_some` is eagerly evaluated, which means if you do the following (as I did), you can have a problem:

```rust
// Oops!
let _ = something
    .has_another_thing()
    .then_some(something.another_thing_or_panic());
```

A note, similar to other methods with eagerly-evaluated arguments and a lazy alternative (`Option::or`, for example), could help point this out to people who forget (like me)!

21 months agoRollup merge of #101021 - MingyuChen1:diagnostic, r=davidtwco
Dylan DPC [Tue, 6 Sep 2022 11:04:42 +0000 (16:34 +0530)]
Rollup merge of #101021 - MingyuChen1:diagnostic, r=davidtwco

Migrate ``rustc_middle`` diagnostic

Part of #100717

21 months agoRollup merge of #100658 - chenyukang:100631-check-get-attr, r=lcnr
Dylan DPC [Tue, 6 Sep 2022 11:04:41 +0000 (16:34 +0530)]
Rollup merge of #100658 - chenyukang:100631-check-get-attr, r=lcnr

TyCtxt::get_attr should check that no duplicates are allowed

Fixes #100631

21 months agoFix CI failures on windows and aarch64-linux
Vadim Petrochenkov [Fri, 2 Sep 2022 11:31:08 +0000 (14:31 +0300)]
Fix CI failures on windows and aarch64-linux

21 months agochange stdlib circular dependencies handling
Daniil Belov [Mon, 15 Aug 2022 10:15:01 +0000 (13:15 +0300)]
change stdlib circular dependencies handling

21 months agoAuto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot
bors [Tue, 6 Sep 2022 08:49:54 +0000 (08:49 +0000)]
Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot

Suggest removing unnecessary prefix let in patterns

Helps with #101291, though I think `@estebank` probably wants this:

> Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier).

... to be implemented before we close that issue out completely.

21 months agoReport number of delayed bugs properly with -Ztreat-err-as-bug
Michael Goulet [Tue, 6 Sep 2022 07:08:12 +0000 (07:08 +0000)]
Report number of delayed bugs properly with -Ztreat-err-as-bug

21 months agoget_attr should check that no duplicates are allowed
yukang [Tue, 6 Sep 2022 06:16:54 +0000 (14:16 +0800)]
get_attr should check that no duplicates are allowed

21 months agoAuto merge of #101359 - compiler-errors:cannot-call-trait-object-with-unsized-return...
bors [Tue, 6 Sep 2022 05:57:39 +0000 (05:57 +0000)]
Auto merge of #101359 - compiler-errors:cannot-call-trait-object-with-unsized-return, r=lcnr

Point out when a callable is not actually callable because its return is not sized

Fixes #100755

I didn't add a UI test for that one because it's equivalent to the UI test that already exists in the suite.

21 months agoAdd more size assertions for MIR types.
Nicholas Nethercote [Wed, 31 Aug 2022 22:57:51 +0000 (08:57 +1000)]
Add more size assertions for MIR types.

And move them into a module, as has been done previously for AST, HIR,
etc.

21 months agoAuto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillot
bors [Tue, 6 Sep 2022 03:16:29 +0000 (03:16 +0000)]
Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillot

`BindingAnnotation` refactor

* `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`)
* `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)`
* Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}`

One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`.

I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.

21 months agoAuto merge of #101464 - JohnTitor:rollup-unsjgm6, r=JohnTitor
bors [Tue, 6 Sep 2022 00:23:01 +0000 (00:23 +0000)]
Auto merge of #101464 - JohnTitor:rollup-unsjgm6, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #99291 (Add let else drop order tests)
 - #101402 (Add a Machine hook for inline assembly)
 - #101404 (Fix cleanup for uninitialized stdout)
 - #101418 (Revert "Mention rust-analyzer maintainers when `proc_macro` bridge is changed")
 - #101425 (Point at type parameter in plain path expr)
 - #101426 (Don't duplicate file descriptors into stdio fds)
 - #101447 (Remove generics_def_id_map from the resolver.)

Failed merges:

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

21 months agoRollup merge of #101447 - cjgillot:no-remap-resolver, r=spastorino
Yuki Okushi [Mon, 5 Sep 2022 23:36:10 +0000 (08:36 +0900)]
Rollup merge of #101447 - cjgillot:no-remap-resolver, r=spastorino

Remove generics_def_id_map from the resolver.

This is internal state for lowering.  This does not belong in the resolver.

r? ``@spastorino``

21 months agoRollup merge of #101426 - beetrees:dup-no-stdio, r=thomcc
Yuki Okushi [Mon, 5 Sep 2022 23:36:09 +0000 (08:36 +0900)]
Rollup merge of #101426 - beetrees:dup-no-stdio, r=thomcc

Don't duplicate file descriptors into stdio fds

Ensures that file descriptors are never duplicated into the stdio fds even if a stdio fd has been closed.

21 months agoRollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorino
Yuki Okushi [Mon, 5 Sep 2022 23:36:08 +0000 (08:36 +0900)]
Rollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorino

Point at type parameter in plain path expr

Slightly better error message for a kinda unique use case.

21 months agoRollup merge of #101418 - rust-lang:revert-99183-proc_macro-mention-r-a, r=Mark-Simul...
Yuki Okushi [Mon, 5 Sep 2022 23:36:06 +0000 (08:36 +0900)]
Rollup merge of #101418 - rust-lang:revert-99183-proc_macro-mention-r-a, r=Mark-Simulacrum

Revert "Mention rust-analyzer maintainers when `proc_macro` bridge is changed"

Reverts rust-lang/rust#99183

rust-analyzer is now a subtree, and CI fails when the `proc_macro` bridge changes break our tests, so these notifications aren't needed anymore.

21 months agoRollup merge of #101404 - joboet:always_cleanup_stdout, r=joshtriplett
Yuki Okushi [Mon, 5 Sep 2022 23:36:05 +0000 (08:36 +0900)]
Rollup merge of #101404 - joboet:always_cleanup_stdout, r=joshtriplett

Fix cleanup for uninitialized stdout

Fixes #101375 by disabling buffering even if the buffer was not initialized yet.

21 months agoRollup merge of #101402 - saethlin:inline-asm-hook, r=oli-obk
Yuki Okushi [Mon, 5 Sep 2022 23:36:04 +0000 (08:36 +0900)]
Rollup merge of #101402 - saethlin:inline-asm-hook, r=oli-obk

Add a Machine hook for inline assembly

I'm sketching out some support in Miri to "execute" inline assembly. I want this because there are codebases which have very simple inline assembly like hand-written syscall wrappers, and it would be nice to test such code without modification.

r? ``@oli-obk``

21 months agoRollup merge of #99291 - est31:let_else_tests, r=joshtriplett
Yuki Okushi [Mon, 5 Sep 2022 23:36:03 +0000 (08:36 +0900)]
Rollup merge of #99291 - est31:let_else_tests, r=joshtriplett

Add let else drop order tests

Add a systematic matrix based test that checks temporary drop order in various settings, `let-else-drop-order.rs`, as requested [here](https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523).

The drop order of let and let else is supposed to be the and in order to ensure this, the test checks that this holds for a number of cases.

The test also ensures that we drop the temporaries of the condition before executing the else block.

cc #87335 tracking issue for `let else`

21 months agoRustdoc-Json: Store Variant Fields as their own item.
Nixon Enraght-Moony [Mon, 5 Sep 2022 21:17:50 +0000 (22:17 +0100)]
Rustdoc-Json: Store Variant Fields as their own item.

Closes #100587
Closes #92945

21 months agoAuto merge of #101460 - rust-lang:update-cargo, r=ehuss
bors [Mon, 5 Sep 2022 21:55:48 +0000 (21:55 +0000)]
Auto merge of #101460 - rust-lang:update-cargo, r=ehuss

Update cargo

8 commits in 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5..646e9a0b9ea8354cc409d05f10e8dc752c5de78e
2022-08-27 18:41:39 +0000 to 2022-09-02 14:29:28 +0000
- Support inheriting jobserver fd for external subcommands (rust-lang/cargo#10511)
- refactor(cli): Lazy load config (rust-lang/cargo#11029)
- chore: Don't show genned docs in ripgrep (rust-lang/cargo#11040)
- Document private items for Cargo and publish under contributor guide (rust-lang/cargo#11019)
- Add names to CI jobs (rust-lang/cargo#11039)
- Rework test error handling (rust-lang/cargo#11028)
- Very slight `cargo add` documentation improvements (rust-lang/cargo#11033)
- Update compiling requirements. (rust-lang/cargo#11030)

21 months ago[Gardening] UPDATE - use let chain to unwrap snippet and evaluate flag
Jhonny Bill Mena [Mon, 5 Sep 2022 21:32:23 +0000 (17:32 -0400)]
[Gardening] UPDATE - use let chain to unwrap snippet and evaluate flag

21 months agoUPDATE - accept start_point and snippet instead of SourceMap
Jhonny Bill Mena [Mon, 5 Sep 2022 21:26:57 +0000 (17:26 -0400)]
UPDATE - accept start_point and snippet instead of SourceMap

21 months agoPoint out when a callable is not actually callable because its return is not sized
Michael Goulet [Sat, 3 Sep 2022 03:46:41 +0000 (03:46 +0000)]
Point out when a callable is not actually callable because its return is not sized

21 months agoFix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments
Michael Goulet [Mon, 5 Sep 2022 00:23:02 +0000 (00:23 +0000)]
Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments

21 months agoRecover from using `;` as separator between fields
Chayim Refael Friedman [Mon, 5 Sep 2022 16:09:57 +0000 (16:09 +0000)]
Recover from using `;` as separator between fields

21 months agoAdd test.
Camille GILLOT [Mon, 5 Sep 2022 13:51:34 +0000 (15:51 +0200)]
Add test.

21 months agoUpdate cargo
Weihang Lo [Mon, 5 Sep 2022 17:34:53 +0000 (18:34 +0100)]
Update cargo

8 commits in 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5..646e9a0b9ea8354cc409d05f10e8dc752c5de78e
2022-08-27 18:41:39 +0000 to 2022-09-02 14:29:28 +0000
- Support inheriting jobserver fd for external subcommands (rust-lang/cargo#10511)
- refactor(cli): Lazy load config (rust-lang/cargo#11029)
- chore: Don't show genned docs in ripgrep (rust-lang/cargo#11040)
- Document private items for Cargo and publish under contributor guide (rust-lang/cargo#11019)
- Add names to CI jobs (rust-lang/cargo#11039)
- Rework test error handling (rust-lang/cargo#11028)
- Very slight `cargo add` documentation improvements (rust-lang/cargo#11033)
- Update compiling requirements. (rust-lang/cargo#11030)

21 months agoFIX - broken translatable diagnostics tests
Jhonny Bill Mena [Mon, 5 Sep 2022 16:59:56 +0000 (12:59 -0400)]
FIX - broken translatable diagnostics tests

21 months agoAuto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot
bors [Mon, 5 Sep 2022 16:21:40 +0000 (16:21 +0000)]
Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot

Separate the receiver from arguments in HIR

Related to #100232

cc `@cjgillot`

21 months ago[Gardening] UPDATE - tidy fixes
Jhonny Bill Mena [Mon, 5 Sep 2022 16:09:10 +0000 (12:09 -0400)]
[Gardening] UPDATE - tidy fixes

21 months agoFIX - broken translatable diagnostics tests
Jhonny Bill Mena [Mon, 5 Sep 2022 16:05:14 +0000 (12:05 -0400)]
FIX - broken translatable diagnostics tests

21 months agoUPDATE - avoid exposing source_map methods from Handler
Jhonny Bill Mena [Mon, 5 Sep 2022 15:42:48 +0000 (11:42 -0400)]
UPDATE - avoid exposing source_map methods from Handler

21 months agofix comment
111 [Mon, 5 Sep 2022 15:18:18 +0000 (23:18 +0800)]
fix comment

21 months agouse `propagate_through_exprs` instead of `propagate_through_expr`
Takayuki Maeda [Mon, 5 Sep 2022 05:26:00 +0000 (14:26 +0900)]
use `propagate_through_exprs` instead of `propagate_through_expr`

fix `ExprKind` static_assert_size

fix hir-stats

21 months agoAuto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkov
bors [Mon, 5 Sep 2022 13:36:54 +0000 (13:36 +0000)]
Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkov

Simplify `hir::PathSegment`

r? `@petrochenkov`

21 months agorefactor: remove unnecessary variables
Takayuki Maeda [Fri, 2 Sep 2022 13:48:14 +0000 (22:48 +0900)]
refactor: remove unnecessary variables

21 months agoseparate the receiver from arguments in HIR under /clippy
Takayuki Maeda [Thu, 1 Sep 2022 09:43:35 +0000 (18:43 +0900)]
separate the receiver from arguments in HIR under /clippy

21 months agoseparate the receiver from arguments in HIR
Takayuki Maeda [Thu, 1 Sep 2022 04:27:31 +0000 (13:27 +0900)]
separate the receiver from arguments in HIR

21 months agoAdd test for #98294
Nikita Popov [Wed, 31 Aug 2022 11:18:46 +0000 (13:18 +0200)]
Add test for #98294

Add a test to make that the failure condition for this pattern is
optimized away.

Fixes #98294.

21 months agoRemove generics_def_id_map from the resolver.
Camille GILLOT [Sun, 14 Aug 2022 16:25:19 +0000 (18:25 +0200)]
Remove generics_def_id_map from the resolver.

21 months agoAdd matrix based test for documenting the let / let else temporary drop order
est31 [Fri, 15 Jul 2022 17:17:10 +0000 (19:17 +0200)]
Add matrix based test for documenting the let / let else temporary drop order

The drop order of let and let else is supposed to be the same,
and in order to ensure this, the test checks that this holds for
the given list of cases.

The test also ensures that we drop the temporaries of the
condition before executing the else block.

We made the test matrix based so it can check all the possible
combinations and find out possible edge cases.

21 months agosuggest introducing an explicit lifetime if it does not exist
Takayuki Maeda [Mon, 5 Sep 2022 10:45:53 +0000 (19:45 +0900)]
suggest introducing an explicit lifetime if it does not exist

21 months agoAuto merge of #101439 - Dylan-DPC:rollup-2wf1mtj, r=Dylan-DPC
bors [Mon, 5 Sep 2022 09:48:49 +0000 (09:48 +0000)]
Auto merge of #101439 - Dylan-DPC:rollup-2wf1mtj, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #101142 (Improve HIR stats)
 - #101367 (Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch)
 - #101391 (more clippy::perf fixes)
 - #101409 (Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates)
 - #101420 (Fix `hir::Local` doc to match with the variable name used: `init`)
 - #101429 (Don't suggest reborrow if usage is inside a closure)

Failed merges:

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

21 months agoRollup merge of #101429 - compiler-errors:issue-101119, r=lcnr
Dylan DPC [Mon, 5 Sep 2022 08:45:55 +0000 (14:15 +0530)]
Rollup merge of #101429 - compiler-errors:issue-101119, r=lcnr

Don't suggest reborrow if usage is inside a closure

I can't think of why we would ever be able to *successfully* suggest a mutable reborrow `&mut *` due to a move happening due to a closure, so just suppress it.

Fixes #101119

21 months agoRollup merge of #101420 - kraktus:doc_hir_local, r=cjgillot
Dylan DPC [Mon, 5 Sep 2022 08:45:54 +0000 (14:15 +0530)]
Rollup merge of #101420 - kraktus:doc_hir_local, r=cjgillot

Fix `hir::Local` doc to match with the variable name used: `init`

21 months agoRollup merge of #101409 - WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates...
Dylan DPC [Mon, 5 Sep 2022 08:45:53 +0000 (14:15 +0530)]
Rollup merge of #101409 - WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates, r=TaKO8Ki

Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates

Fixes #101284

21 months agoRollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk
Dylan DPC [Mon, 5 Sep 2022 08:45:52 +0000 (14:15 +0530)]
Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk

more clippy::perf fixes

21 months agoRollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnr
Dylan DPC [Mon, 5 Sep 2022 08:45:51 +0000 (14:15 +0530)]
Rollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnr

Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch

Fixes #100699, but in the opposite direction (instead of suggesting to fix the signature, it fixes the body)

21 months agoRollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco
Dylan DPC [Mon, 5 Sep 2022 08:45:51 +0000 (14:15 +0530)]
Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco

Improve HIR stats

#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`

21 months agostd: fix cleanup for uninitialized stdout (#101375)
joboet [Mon, 5 Sep 2022 07:08:07 +0000 (09:08 +0200)]
std: fix cleanup for uninitialized stdout (#101375)

21 months agoAuto merge of #101414 - mystor:pm_nested_cross_thread, r=eddyb
bors [Mon, 5 Sep 2022 07:07:38 +0000 (07:07 +0000)]
Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddyb

proc_macro/bridge: use the cross-thread executor for nested proc-macros

While working on some other changes in the bridge, I noticed that when
running a nested proc-macro (which is currently only possible using
the unstable `TokenStream::expand_expr`), any symbols held by the
proc-macro client would be invalidated, as the same thread would be used
for the nested macro by default, and the interner doesn't handle nested
use.

After discussing with `@eddyb,` we decided the best approach might be to
force the use of the cross-thread executor for nested invocations, as it
will never re-use thread-local storage, avoiding the issue. This
shouldn't impact performance, as expand_expr is still unstable, and
infrequently used.

This was chosen rather than making the client symbol interner handle
nested invocations, as that would require replacing the internal
interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be
disjoint), and the symbol interner is known to be fairly perf-sensitive.

This patch adds checks to the execution strategy to use the cross-thread
executor when doing nested invocations. An alternative implementation
strategy could be to track this information in the `ExtCtxt`, however a
thread-local in the `proc_macro` crate was chosen to add an assertion so
that `rust-analyzer` is aware of the issue if it implements
`expand_expr` in the future.

r? `@eddyb`