Commit Graph

199367 Commits

Author SHA1 Message Date
bors
e7c7aa7288 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
2022-09-07 09:47:23 +00:00
bors
0568b0a3de 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.
2022-09-07 05:58:29 +00:00
bors
ff479b1f3c 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`
2022-09-07 03:17:10 +00:00
bors
8c41305631 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 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-07 00:35:54 +00:00
Yuki Okushi
6903a8493f
Rollup merge of #101497 - lnicola:rust-analyzer-2022-09-06, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-09-07 07:43:57 +09:00
Yuki Okushi
1bc6110fdf
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:

2fd378b82b/src/librustdoc/html/static/rustdoc.css (L514-L522)

That negative margin was removed in 593d6d1cb1.
2022-09-07 07:43:57 +09:00
Yuki Okushi
cf41b38209
Rollup merge of #101488 - notriddle:notriddle/results-table, r=GuillaumeGomez
rustdoc: remove unused CSS `#results > table`

This code was added in 96ef2f8ab9 to improve rendering of the search results table, but results have not used a table since b615c0c854 switched it to rendering with `<div>` tags.
2022-09-07 07:43:56 +09:00
Yuki Okushi
f68d05cf00
Rollup merge of #101486 - asquared31415:invalid_repr_list, r=estebank
Add list of recognized repr attributes to the unrecognized repr error
2022-09-07 07:43:54 +09:00
Yuki Okushi
1d49dcec10
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
2022-09-07 07:43:54 +09:00
Yuki Okushi
923dae5c9f
Rollup merge of #101481 - ChrisDenton:uwp-fix, r=thomcc
Fix compile errors for uwp-windows-msvc targets

Fixes #101480
2022-09-07 07:43:53 +09:00
Yuki Okushi
a12e29af92
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`
2022-09-07 07:43:52 +09:00
Yuki Okushi
631aed82bc
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
2022-09-07 07:43:51 +09:00
bors
699bfa882b 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`
2022-09-06 22:06:54 +00:00
Laurențiu Nicola
d0588007a9 ⬆️ rust-analyzer 2022-09-06 21:20:49 +03:00
bors
78a891d364 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
2022-09-06 18:10:14 +00:00
Michael Howell
e1f5d4f23f 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 2fd378b82b (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 593d6d1cb1.
2022-09-06 10:36:51 -07:00
Michael Howell
4282802706 rustdoc: remove unused CSS #results > table
This code was added in 96ef2f8ab9 to improve
rendering of the search results table, but results have not used a table
since b615c0c854 switched it to rendering with
`<div>` tags.
2022-09-06 09:15:41 -07:00
Oli Scherer
a0130e62ec Check all operands, they may contain indirections in their place 2022-09-06 15:32:35 +00:00
asquared31415
ad275f5096 add list of recognized repr attributes to the unrecognized repr error 2022-09-06 11:02:42 -04:00
Guillaume Gomez
f21b6129a0
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`
2022-09-06 17:00:30 +02:00
Guillaume Gomez
7d2e150e92
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`.
2022-09-06 17:00:29 +02:00
Guillaume Gomez
b59c1aa298
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`
2022-09-06 17:00:28 +02:00
Guillaume Gomez
78968e5959
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.
2022-09-06 17:00:28 +02:00
Guillaume Gomez
7c7548cd37
Rollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, r=oli-obk
Suggest introducing an explicit lifetime if it does not exist

Fixes #101027
2022-09-06 17:00:27 +02:00
Guillaume Gomez
4d830b7775
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`
2022-09-06 17:00:26 +02:00
Guillaume Gomez
d13aefdc65
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
2022-09-06 17:00:25 +02:00
Oli Scherer
cd928b0ecf Test bump 2022-09-06 14:59:46 +00:00
bors
380addd7d2 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.
2022-09-06 14:33:31 +00:00
Oli Scherer
7348284073 Update docs 2022-09-06 14:18:32 +00:00
Oli Scherer
104f97e5aa Move CTFE handling of nondiverging intrinsics to intrinsics.rs 2022-09-06 14:18:32 +00:00
Oli Scherer
b7413511dc Generalize the Assume intrinsic statement to a general Intrinsic statement 2022-09-06 14:18:32 +00:00
Oli Scherer
3f07645120 Lower the assume intrinsic to a MIR statement 2022-09-06 14:18:32 +00:00
Oli Scherer
9c4fb018ca Remove dead broken code from const zst handling in backends 2022-09-06 14:09:49 +00:00
Santiago Pastorino
3f45dc1472
fix RPIT ICE for implicit HRTB when missing dyn 2022-09-06 11:00:29 -03:00
Chris Denton
774e71228c
Fix compile errors for uwp-windows-msvc targets 2022-09-06 14:57:42 +01:00
bors
3c72788461 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
2022-09-06 11:16:02 +00:00
Dylan DPC
8936211661
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
2022-09-06 16:34:45 +05:30
Dylan DPC
00db13fcc9
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`
2022-09-06 16:34:44 +05:30
Dylan DPC
24f998932e
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)!
2022-09-06 16:34:43 +05:30
Dylan DPC
36144f2b3d
Rollup merge of #101021 - MingyuChen1:diagnostic, r=davidtwco
Migrate ``rustc_middle`` diagnostic

Part of #100717
2022-09-06 16:34:42 +05:30
Dylan DPC
3f22020006
Rollup merge of #100658 - chenyukang:100631-check-get-attr, r=lcnr
TyCtxt::get_attr should check that no duplicates are allowed

Fixes #100631
2022-09-06 16:34:41 +05:30
Vadim Petrochenkov
c34047cbd5 Fix CI failures on windows and aarch64-linux 2022-09-06 14:05:54 +04:00
Daniil Belov
b67271507d change stdlib circular dependencies handling 2022-09-06 14:05:54 +04:00
bors
a594044533 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.
2022-09-06 08:49:54 +00:00
Michael Goulet
38935bbe6a Report number of delayed bugs properly with -Ztreat-err-as-bug 2022-09-06 07:12:52 +00:00
yukang
00b10a5552 get_attr should check that no duplicates are allowed 2022-09-06 14:16:54 +08:00
bors
098cf88022 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.
2022-09-06 05:57:39 +00:00
Nicholas Nethercote
246d126edd Add more size assertions for MIR types.
And move them into a module, as has been done previously for AST, HIR,
etc.
2022-09-06 15:25:54 +10:00
bors
6c358c67d4 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.
2022-09-06 03:16:29 +00:00
bors
56b27110e7 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
2022-09-06 00:23:01 +00:00