Commit Graph

211392 Commits

Author SHA1 Message Date
Esteban Küber 6f64432a39 Tweak output 2022-11-28 00:11:12 -08:00
Esteban Küber ab04080b56 Change multiline span ASCII art visual order 2022-11-28 00:11:12 -08:00
bors 454784afba Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
Separate lifetime ident from lifetime resolution in HIR

Drive-by: change how suggested generic args are computed.
Fixes https://github.com/rust-lang/rust/issues/103815

I recommend reviewing commit-by-commit.
2022-11-27 14:30:19 +00:00
bors df04d28163 Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr
Various cleanups around scalar layout restrictions

Pulled out of https://github.com/rust-lang/rust/pull/103724
2022-11-27 10:35:00 +00:00
bors 5ac7e08aaf Auto merge of #103786 - tshepang:obsolete, r=jyn514
Don't build `compiler_builtins` with `-C panic=abort`
2022-11-27 07:12:30 +00:00
bors 0e9eee6811 Auto merge of #96451 - JakobDegen:dest-prop, r=tmiasko
Fix Dest Prop

Closes #82678, #79191 .

This was not originally a total re-write of the pass but is has gradually turned into one. Notable changes:

 1. Significant improvements to documentation all around. The top of the file has been extended with a more precise argument for soundness. The code should be fairly readable, and I've done my best to add useful comments wherever possible. I would very much like for the bus factor to not be one on this code.
 3. Improved handling of conflicts that are not visible in normal dataflow.  This was the cause of #79191. Handling this correctly requires us to make decision about the semantics and specifically evaluation order of basically all MIR constructs (see specifically #68364 #71117.  The way this is implemented is based on my preferred resolution to these questions around the semantics of assignment statements.
 4. Some re-architecting to improve performance. More details below.
 5. Possible future improvements to this optimization are documented, and the code is written with the needs of those improvements in mind. The hope is that adding support for more precise analyses will not require a full re-write of this opt, but just localized changes.

### Regarding Performance

The previous approach had some performance issues; letting `l` be the number of locals and `s` be the number of statements/terminators, the runtime of the pass was `O(l^2 * s)`, both in theory and in practice. This version is smarter about not calculating unnecessary things and doing more caching. Our runtime is now dominated by one invocation of `MaybeLiveLocals` for each "round," and the number of rounds is less than 5 in over 90% of cases. This means it's linear-ish in practice.

r? `@oli-obk` who reviewed the last version of this, but review from anyone else would be more than welcome
2022-11-27 04:09:53 +00:00
Jakob Degen 245c60749a Rewrite dest prop.
This fixes a number of correctness issues from the previous version. Additionally, we use a new
strategy which has much better performance charactersitics and also finds more opportunities to
apply the optimization.
2022-11-26 18:04:54 -08:00
bors faf1891deb Auto merge of #104818 - scottmcm:refactor-extend-func, r=the8472
Stop peeling the last iteration of the loop in `Vec::resize_with`

`resize_with` uses the `ExtendWith` code that peels the last iteration:
341d8b8a2c/library/alloc/src/vec/mod.rs (L2525-L2529)

But that's kinda weird for `ExtendFunc` because it does the same thing on the last iteration anyway:
341d8b8a2c/library/alloc/src/vec/mod.rs (L2494-L2502)

So this just has it use the normal `extend`-from-`TrustedLen` code instead.

r? `@ghost`
2022-11-27 00:58:50 +00:00
bors c0e9c86b3f Auto merge of #104950 - jyn514:revert-preview, r=Mark-Simulacrum
Revert "Don't set `is_preview` for clippy and rustfmt"

This reverts commit fb3e724d76, which broke `rustup update` for anyone with clippy or rustfmt installed.

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

r? `@Mark-Simulacrum`

`@bors` p=50 fixes nightly
2022-11-26 21:47:17 +00:00
Joshua Nelson c80b484eff Revert "Don't set `is_preview` for clippy and rustfmt"
This reverts commit fb3e724d76, which broke `rustup update` for anyone with clippy or rustfmt installed.
2022-11-26 15:24:46 -05:00
bors 80a96467ec Auto merge of #104945 - GuillaumeGomez:rollup-ygzbpbe, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #104786 (Use the power of adding helper function to simplify code w/ `Mutability`)
 - #104788 (Do not record unresolved const vars in generator interior)
 - #104909 (Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`)
 - #104921 (Remove unnecessary binder from `get_impl_future_output_ty`)
 - #104924 (jsondoclint: Accept trait alias is places where trait expected.)
 - #104928 (rustdoc: use flexbox CSS to align sidebar button instead of position)
 - #104943 (jsondoclint: Handle using enum variants and glob using enums.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-26 17:58:12 +00:00
Guillaume Gomez 95e63560a0
Rollup merge of #104943 - aDotInTheVoid:jsondoclint-use-enum, r=GuillaumeGomez
jsondoclint: Handle using enum variants and glob using enums.

More work on jsondoclint for `core.json`

Closes #104942

r? `@GuillaumeGomez`

`@rustbot` modify labels: +A-testsuite
2022-11-26 17:47:26 +01:00
Guillaume Gomez d99201c381
Rollup merge of #104928 - notriddle:notriddle/sidebar-toggle-flexbox, r=GuillaumeGomez
rustdoc: use flexbox CSS to align sidebar button instead of position

This accomplishes the same thing with significantly less code.

Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-toggle-flexbox/src/test_dingus/lib.rs.html
2022-11-26 17:47:25 +01:00
Guillaume Gomez c4f8546fbc
Rollup merge of #104924 - aDotInTheVoid:jsondocck-trait-alias, r=GuillaumeGomez
jsondoclint: Accept trait alias is places where trait expected.

More work to make `jsondoclint` work for `core.json`

Closes #104923

r? `@GuillaumeGomez`

`@rustbot` modify labels: +A-testsuite
2022-11-26 17:47:25 +01:00
Guillaume Gomez 4019c8aaf7
Rollup merge of #104921 - compiler-errors:no-binder-on-fut-ty, r=cjgillot
Remove unnecessary binder from `get_impl_future_output_ty`

We never construct an `async fn` with a higher-ranked `impl Future` bound anyways, and basically all the call-sites already skip the binder.
2022-11-26 17:47:24 +01:00
Guillaume Gomez 75352dddf3
Rollup merge of #104909 - compiler-errors:normalize_opaque_types-is-misleading, r=fee1-dead
Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`

1. The query name is a bit misleading, since it doesn't do any associated type normalization, and
2. since it only takes a predicate list, it sounds a bit more powerful than it actually is.
2022-11-26 17:47:24 +01:00
Guillaume Gomez e6c83d9e42
Rollup merge of #104788 - compiler-errors:unresolved-ct-in-gen, r=fee1-dead
Do not record unresolved const vars in generator interior

Don't record types in the generator interior when we see unresolved const variables.

We already do this for associated types -- this is important to avoid unresolved inference variables in the generator results during writeback, since the writeback results get stable hashed in incremental mode.

Fixes #104787
2022-11-26 17:47:23 +01:00
Guillaume Gomez a2e485c25c
Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errors
Use the power of adding helper function to simplify code w/ `Mutability`

r? `@compiler-errors`
2022-11-26 17:47:23 +01:00
Nixon Enraght-Moony ed0f097e4d jsondoclint: Handle using enum variants and glob using enums.
Closes #104942
2022-11-26 15:08:40 +00:00
bors c3a1c023c0 Auto merge of #104731 - compiler-errors:early-binder-iter-size-hint, r=cjgillot
Add size hints to early binder iterator adapters

probably doesn't do anything, but definitely doesn't hurt
2022-11-26 14:59:30 +00:00
bors 579c993b35 Auto merge of #104935 - matthiaskrgr:rollup-nuca86l, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #104121 (Refine `instruction_set` MIR inline rules)
 - #104675 (Unsupported query error now specifies if its unsupported for local or external crate)
 - #104839 (improve array_from_fn documenation)
 - #104880 ([llvm-wrapper] adapt for LLVM API change)
 - #104899 (rustdoc: remove no-op CSS `#help dt { display: block }`)
 - #104906 (Remove AscribeUserTypeCx)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-26 12:11:32 +00:00
Matthias Krüger 1fe18a5dad
Rollup merge of #104906 - spastorino:remove-ascribeusertypecx, r=compiler-errors
Remove AscribeUserTypeCx

r? ``@compiler-errors``

This basically inlines `AscribeUserTypeCx::relate_mir_and_user_ty` into `type_op_ascribe_user_type_with_span` which is the only place where it's used and makes direct use of `ObligationCtxt` API.
2022-11-26 10:39:12 +01:00
Matthias Krüger 8586544855
Rollup merge of #104899 - notriddle:notriddle/help-dt, r=GuillaumeGomez
rustdoc: remove no-op CSS `#help dt { display: block }`

`display: block` is the [default UA style] for dt.

[default UA style]: https://html.spec.whatwg.org/multipage/rendering.html#lists
2022-11-26 10:39:12 +01:00
Matthias Krüger 0f28e403d4
Rollup merge of #104880 - krasimirgg:llvm-16-ctx, r=cuviper
[llvm-wrapper] adapt for LLVM API change

Adapt for the LLVM API changes from 721f975d35.

Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15203#0184ae73-5169-4b9b-92f4-d4e6e9b86ad9/194-531
2022-11-26 10:39:11 +01:00
Matthias Krüger 1fc83aee1e
Rollup merge of #104839 - HintringerFabian:docs_array_from_fn, r=scottmcm
improve array_from_fn documenation

Improves array::from_fn documentation
Fixes #102609

There were also unresolved comments from [this PR #100462](https://github.com/rust-lang/rust/pull/100462), which have been added to my PR
2022-11-26 10:39:11 +01:00
Matthias Krüger 42010a23f5
Rollup merge of #104675 - SarthakSingh31:issue-101666, r=jyn514
Unsupported query error now specifies if its unsupported for local or external crate

Fixes #101666.
I had to move `keys.rs` from `rustc_query_impl` to `rustc_middle`. I don't know if that is problematic. I couldn't think of any other way to get the needed information inside `rustc_middle`.

r? ```@jyn514```
2022-11-26 10:39:10 +01:00
Matthias Krüger 4733312e09
Rollup merge of #104121 - Lokathor:mir-opt-when-instruction-set-missing-on-callee, r=tmiasko
Refine `instruction_set` MIR inline rules

Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller.

cc ``@oli-obk``

[Edit] Zulip Context: https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/What.20exactly.20does.20the.20MIR.20optimizer.20do.3F
2022-11-26 10:39:10 +01:00
bors 8841bee954 Auto merge of #103556 - clubby789:specialize-option-partial-eq, r=scottmcm
Manually implement PartialEq for Option<T> and specialize non-nullable types

This PR manually implements `PartialEq` and `StructuralPartialEq` for `Option`, which seems to produce slightly better codegen than the automatically derived implementation.

It also allows specializing on the `core::num::NonZero*` and `core::ptr::NonNull` types, taking advantage of the niche optimization by transmuting the `Option<T>` to `T` to be compared directly, which can be done in just two instructions.

A comparison of the original, new and specialized code generation is available [here](https://godbolt.org/z/dE4jxdYsa).
2022-11-26 08:56:20 +00:00
bors f8a2e491eb Auto merge of #104730 - petrochenkov:modchild5, r=cjgillot
rustc_metadata: Switch module children decoding to an iterator

Previously https://github.com/rust-lang/rust/pull/103578, https://github.com/rust-lang/rust/pull/103524 and previous PRs simplified it as much as possible.

A couple of cleanup commits is also added.
r? `@cjgillot`
2022-11-26 05:41:34 +00:00
Michael Goulet 6210812494 Do not record unresolved const vars in generator interior 2022-11-26 05:38:43 +00:00
Michael Goulet 1472b38039 Remove unnecessary binder from get_impl_future_output_ty 2022-11-26 05:22:52 +00:00
Michael Howell 8b001b4da0 rustdoc: use flexbox CSS to align sidebar button instead of position
This accomplishes the same thing with significantly less code.
2022-11-25 22:06:22 -07:00
bors 5fa44b5464 Auto merge of #104431 - alistair23:alistair/rv64-profiler, r=Mark-Simulacrum
Enable profiler in dist-riscv64-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on riscv64-linux.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2022-11-26 02:43:08 +00:00
Nixon Enraght-Moony b1cdb05003 jsondoclint: Accept trait alias is places where trait expected.
Closes #104923
2022-11-26 01:41:30 +00:00
bors aff003becd Auto merge of #99798 - JulianKnodt:ac1, r=BoxyUwU
Add `ConstKind::Expr`

Starting to implement `ty::ConstKind::Abstract`, most of the match cases are stubbed out, some I was unsure what to add, others I didn't want to add until a more complete implementation was ready.

r? `@lcnr`
2022-11-25 22:56:59 +00:00
Lokathor ea47943212 Refine instruction_set inline rules
Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller.
2022-11-25 15:19:16 -07:00
Michael Goulet 6b63d6c918 Rename normalize_opaque_types to reveal_opaque_types_in_bounds 2022-11-25 19:39:46 +00:00
bors 8681d4cffc Auto merge of #104902 - matthiaskrgr:rollup-oo27a4u, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104716 (move 2 candidates into builtin candidate)
 - #104760 (Clarify `SyntaxExtensionKind::LegacyDerive`.)
 - #104797 (rustc_codegen_ssa: write `.dwp` in a streaming fashion)
 - #104835 (Use infcx.partially_normalize_associated_types_in)
 - #104853 (Fix typo in miri sysroot)
 - #104879 (jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath)
 - #104887 (rustbuild: Don't build doc::SharedAssets when building JSON docs.)
 - #104896 (rustdoc: fix broken tooltip CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-25 19:09:30 +00:00
Santiago Pastorino 3c9b30e658
Define all clauses as dummy_with_span as the usages are all equivalent 2022-11-25 16:00:08 -03:00
Santiago Pastorino aaa1db63ce
Remove AscribeUserTypeCx 2022-11-25 15:25:00 -03:00
Matthias Krüger 12e1b84e95
Rollup merge of #104896 - notriddle:notriddle/tooltip, r=GuillaumeGomez
rustdoc: fix broken tooltip CSS

text `#ffffff` on background `#fdffd3` fails the [WCAG color contrast checker], and seems like a mistake in 16b55903ee.

Making the cursor a pointer is misleading, since clicking it doesn't do anything.

[WCAG color contrast checker]: https://accessibleweb.com/color-contrast-checker/
2022-11-25 18:35:42 +01:00
Matthias Krüger c72db77ecb
Rollup merge of #104887 - aDotInTheVoid:rustbuild-json-doc-shared-assets, r=jyn514
rustbuild: Don't build doc::SharedAssets when building JSON docs.

Previously, running `./x doc library/core/ --json` on a plain build would panic bootstrap.

```
$ ./x doc library/core/ --json
Building rustbuild
    Blocking waiting for file lock on package cache
   Compiling bootstrap v0.0.0 (/home/nixon/dev/rust/rust/src/bootstrap)
    Finished dev [unoptimized] target(s) in 4.47s
thread 'main' panicked at 'fs::write(&version_info, &info) failed with No such file or directory (os error 2) ("/home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/doc/version_info.html")', doc.rs:410:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:04
```

Becuase the `SharedAssets` step assumes that the HTML out dir has been created. This isn't true for JSON.

The fix is to not build shared assets when doing a JSON doc build, as it doesn't need them.

r? ``@jyn514``

``@rustbot`` modify labels: +A-rustdoc-json
2022-11-25 18:35:42 +01:00
Matthias Krüger 996de3adf6
Rollup merge of #104879 - aDotInTheVoid:jsondoclint-typedef, r=GuillaumeGomez
jsondoclint: Recognise Typedef as valid kind for Type::ResolvedPath

Closes #104851

r? ``@GuillaumeGomez``

``@rustbot`` modify labels: +A-testsuite
2022-11-25 18:35:42 +01:00
Matthias Krüger 287bb6d252
Rollup merge of #104853 - jyn514:sysroot-typo, r=RalfJung
Fix typo in miri sysroot

r? ``@RalfJung``
2022-11-25 18:35:41 +01:00
Matthias Krüger 7fac5048c4
Rollup merge of #104835 - spastorino:use-partially_normalize_associated_types_in, r=lcnr
Use infcx.partially_normalize_associated_types_in

r? ``@lcnr``
2022-11-25 18:35:41 +01:00
Matthias Krüger aec60c6b7c
Rollup merge of #104797 - weihanglo:stream-write-dwp, r=jackh726
rustc_codegen_ssa: write `.dwp` in a streaming fashion

When writing a `.dwp` file, rustc writes to a Vec first then to a BufWriter-wrapped file. It seems very likely that we can write in a streaming fashion to avoid double buffering in an intermediate Vec.

On my Linux machine, `.dwp` from the latest rust-lang/cargo is 113MiB. It may worth a stream writer, though I didn't do any benchmark 🙇🏾‍♂️.
2022-11-25 18:35:40 +01:00
Matthias Krüger 8f3f4980b4
Rollup merge of #104760 - nnethercote:rm-LegacyDerive, r=petrochenkov
Clarify `SyntaxExtensionKind::LegacyDerive`.

It's always treated the same as `SyntaxExtensionKind::Derive`.
2022-11-25 18:35:39 +01:00
Matthias Krüger 9c7dc3e30b
Rollup merge of #104716 - lcnr:selection-candidate, r=jackh726
move 2 candidates into builtin candidate

having separate candidates for these isn't too helpful i think

r? types
2022-11-25 18:35:39 +01:00
Michael Howell 20cb41f466 rustdoc: remove no-op CSS `#help dt { display: block }`
`display: block` is the [default UA style] for dt.

[default UA style]: https://html.spec.whatwg.org/multipage/rendering.html#lists
2022-11-25 10:07:21 -07:00
Michael Howell 75e4de61d4 rustdoc: revert tooltip background color on light theme to readable
text #fff on background #fdffd3 fails the [WCAG color contrast checker], and
seems like a mistake in 16b55903ee.

[WCAG color contrast checker]: https://accessibleweb.com/color-contrast-checker/
2022-11-25 09:28:25 -07:00