Commit Graph

225030 Commits

Author SHA1 Message Date
lcnr
5119f7da18 directory size limit :< 2023-05-30 13:04:25 +02:00
lcnr
6f9041bd15 add the leak check to the new solver 2023-05-30 13:03:40 +02:00
lcnr
04056b5c04 update revision names 2023-05-30 13:03:40 +02:00
lcnr
6b92d45342 change redundant clear() to assertion 2023-05-30 13:03:40 +02:00
lcnr
a0245bb3cb rework the leak_check to take the outer_universe
clean up coherence to not rely on probes anymore
2023-05-30 13:03:38 +02:00
lcnr
2a4467da9f add FIXME to a test which seems wrong. 2023-05-30 12:40:35 +02:00
lcnr
aa13288e22 remove unused revision 2023-05-30 12:40:35 +02:00
lcnr
0a6ae29fe8 coherence: don't add hidden types for opaques
we can otherwise assign a hidden type to the opaque which
causes ICE if we don't use `take_opaque_types` during
coherence. This is annoying so I didn't bother. Added a test
showing the behavior this prevents.
2023-05-30 12:40:35 +02:00
lcnr
200ed9f8cd leak_check: remove unused codepath 2023-05-30 12:40:35 +02:00
bors
578bcbc2b4 Auto merge of #112083 - scottmcm:simpler-range-next, r=thomcc
Make `TrustedStep` require `Copy`

All the implementations of the trait already are `Copy`, and this seems to be enough to simplify the implementations enough to make the MIR inliner willing to inline basics like `Range::next`.

r? `@thomcc`
2023-05-30 07:27:05 +00:00
bors
45eec0fe93 Auto merge of #112075 - WaffleLapkin:unmkII, r=lcnr
Replace `tcx.mk_re_*` with `Region::new_*`

Second step in implementing https://github.com/rust-lang/compiler-team/issues/616
r? `@lcnr`
2023-05-30 04:26:59 +00:00
bors
165cddafe9 Auto merge of #111989 - klensy:deps-up-26-05-23, r=Mark-Simulacrum
deps: bump crates

Updates few deps:

drops a lot of cxx* crates:
```console
$ cargo update -p iana-time-zone-haiku
    Updating crates.io index
    Updating cc v1.0.77 -> v1.0.79
    Removing codespan-reporting v0.11.1
    Removing cxx v1.0.94
    Removing cxx-build v1.0.94
    Removing cxxbridge-flags v1.0.94
    Removing cxxbridge-macro v1.0.94
    Updating iana-time-zone-haiku v0.1.1 -> v0.1.2
    Removing link-cplusplus v1.0.8
    Removing scratch v1.0.5
```
cc: https://github.com/rust-lang/cc-rs/releases/tag/1.0.78, https://github.com/rust-lang/cc-rs/releases/tag/1.0.79
iana-time-zone-haiku: https://github.com/strawlab/iana-time-zone/releases/tag/haiku%2Fv0.1.2

fixed https://github.com/crossbeam-rs/crossbeam/pull/972 (similar fixed in rust repo https://github.com/rust-lang/rust/pull/110089)
```console
$ cargo update -p crossbeam-channel
    Updating crates.io index
    Updating crossbeam-channel v0.5.6 -> v0.5.8
```
https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-channel/CHANGELOG.md#version-058

dedupes memoffset versions:
```console
$ cargo update -p crossbeam-epoch
    Updating crates.io index
    Updating crossbeam-epoch v0.9.13 -> v0.9.14
    Removing memoffset v0.7.1
```
https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-epoch/CHANGELOG.md#version-0914
https://github.com/Gilnaa/memoffset/compare/v0.6.5...v0.8.0
https://github.com/rust-lang/rust/pull/108638#discussion_r1193157265

dedupes bstr versions
```console
$ cargo update -p ignore -p opener
    Updating crates.io index
    Removing bstr v0.2.17
    Updating globset v0.4.9 -> v0.4.10
    Updating ignore v0.4.18 -> v0.4.20
    Updating opener v0.5.0 -> v0.5.2
```

globset ac8fecbbf2
ignore https://github.com/BurntSushi/ripgrep/commits/master/crates/ignore hard to track, but drop dep on crossbeam-utils (e95254a86f), don't stat git if require_git is false (009dda1488) and added bunch of formats to ignore list
opener https://github.com/Seeker14491/opener/compare/v0.5.0...v0.5.2 nothing interesting
2023-05-30 01:28:54 +00:00
bors
d9a4d5eca3 Auto merge of #112080 - matthiaskrgr:rollup-pmpbe49, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #111558 (Move tests)
 - #111827 (Add build instructions for cranelift backend as part of Rust repo)
 - #111988 (Make `TyKind: Debug` have less verbose output)
 - #112022 (Check nested obligations during coercion unify in new solver)
 - #112057 (Suggest correct `self_ty`)
 - #112063 (Add a test for issue 110457/incremental ICE with closures with the same span)

Failed merges:

 - #112068 (Move tests from `ui/discrim` dir)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-29 22:36:23 +00:00
Scott McMurray
50e01f4d68 Update a MIRI fake-time test that this makes "faster" 2023-05-29 13:57:18 -07:00
Scott McMurray
11fa1764ee Make TrustedStep require Copy
All the implementations of the trait already are `Copy`, and this seems to be enough to simplify the implementations enough to make the MIR inliner willing to inline basics like `Range::next`.
2023-05-29 13:19:47 -07:00
Matthias Krüger
36526cf657
Rollup merge of #112063 - WaffleLapkin:test_incremental_ice, r=cjgillot
Add a test for issue 110457/incremental ICE with closures with the same span

Closes #110457

It's probably possible to minimize the test case more, considering that we now know the underlying reason for the ICE, but I didn't.

r? `@cjgillot`
2023-05-29 21:34:18 +02:00
Matthias Krüger
880da380f1
Rollup merge of #112057 - MU001999:fix/self-sugg, r=compiler-errors
Suggest correct `self_ty`

Fixes #112036
2023-05-29 21:34:18 +02:00
Matthias Krüger
ef9a681183
Rollup merge of #112022 - compiler-errors:coercion-check-deep, r=lcnr
Check nested obligations during coercion unify in new solver

Found when triaging failing opaque tests with new solver.

r? `@lcnr`
2023-05-29 21:34:17 +02:00
Matthias Krüger
9f83e56f0d
Rollup merge of #111988 - BoxyUwU:make_tykind_debug_good, r=compiler-errors
Make `TyKind: Debug` have less verbose output

Current `TyKind: Debug` impl is basically unusable for debugging, its too verbose even for verbose debugging 🤣 This PR replaces the debug logic for `TyKind` with a more manual debug impl instead of a hand expanded derived impl. This should help make #107084 more reasonable to land since the output of `Ty: Debug` will be better.

This isn't a fully completed change to the `Debug` impl of `TyKind` as there's still logic from the derive macro for some variants. Some of the variants are also not consisten with the `-Zverbose` printing of `Ty`, ideally `-Zverbose` printing of `Ty` would also just defer to the debug impl instead of having lots of checks in pretty printing. I plan on fixing this in follow up PRs since it seems tricky to do in this one and its already a large PR 😅
2023-05-29 21:34:17 +02:00
Matthias Krüger
3fead07491
Rollup merge of #111827 - AngelicosPhosphoros:add_docs_to_cranelift, r=bjorn3
Add build instructions for cranelift backend as part of Rust repo

All other instructions assume that user works with separate repository than Rust compiler repository. When one follows default instructions, cranelift codegen tries to use different sys-root and compiler internal crates which leads to compiler errors when building it.

I needed to do all this steps while adding new intrinsic to rustc.

r? bjorn3
2023-05-29 21:34:16 +02:00
Matthias Krüger
9e47e90071
Rollup merge of #111558 - c410-f3r:t3st3ss, r=WaffleLapkin
Move tests

r? `@petrochenkov`
2023-05-29 21:34:16 +02:00
Maybe Waffle
e33e20824f Rename tcx.mk_re_* => Region::new_* 2023-05-29 17:54:53 +00:00
Caio
c62d49e75e Address comment 2023-05-29 12:07:41 -03:00
Maybe Waffle
8d406b8459 Add a test for issue 110457 2023-05-29 13:49:20 +00:00
bors
498553fc04 Auto merge of #111235 - loongarch-rs:stabilize-asm, r=Amanieu
Stabilize inline asm for LoongArch64

This PR is used to tracking for stabilize `inline asm` for LoongArch64.

**Status**

- [x] https://github.com/rust-lang/rust/pull/111237
- [x] https://github.com/rust-lang/rust/pull/111332
- [ ] https://github.com/rust-lang/reference/pull/1357

Any others I missed?

r? `@Amanieu`
2023-05-29 13:31:53 +00:00
bors
99ff5afeb8 Auto merge of #111329 - jyn514:metadata-ice, r=bjorn3
Load only the crate header for `locator::crate_matches`

Previously, we used the following info to determine whether to load the crate:
1. The METADATA_HEADER, which includes a METADATA_VERSION constant
2. The embedded rustc version
3. Various metadata in the `CrateRoot`, including the SVH

This worked ok most of the time. Unfortunately, when building locally the rustc version is always
the same because `omit-git-hash` is on by default. That meant that we depended only on 1 and 3, and
we are not very good about bumping METADATA_VERSION (it's currently at 7) so in practice we were
only depending on 3. `CrateRoot` is a very large struct and changes somewhat regularly, so this led
to a steady stream of crashes from trying to load it.

Change the logic to add an intermediate step between 2 and 3: introduce a new `CrateHeader` struct
that contains only the minimum info needed to decide whether the crate should be loaded or not. That
avoids having to load all of `CrateRoot`, which in practice means we should crash much less often.

Note that this works because the SVH should be different between any two dependencies, even if the
compiler has changed, because we use `-Zbinary-dep-depinfo` in bootstrap. See
https://github.com/rust-lang/rust/pull/111329#issuecomment-1538303474 for more details about how the
original crash happened.
2023-05-29 10:40:32 +00:00
bors
70e04bd88d Auto merge of #111748 - nnethercote:Cow-DiagnosticMessage, r=WaffleLapkin
Use `Cow` in `{D,Subd}iagnosticMessage`.

Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment:
```
// FIXME(davidtwco): can a `Cow<'static, str>` be used here?
```
This commit answers that question in the affirmative. It's not the most compelling change ever, but it might be worth merging.

This requires changing the `impl<'a> From<&'a str>` impls to `impl From<&'static str>`, which involves a bunch of knock-on changes that require/result in call sites being a little more precise about exactly what kind of string they use to create errors, and not just `&str`. This will result in fewer unnecessary allocations, though this will not have any notable perf effects given that these are error paths.

Note that I was lazy within Clippy, using `to_string` in a few places to preserve the existing string imprecision. I could have used `impl Into<{D,Subd}iagnosticMessage>` in various places as is done in the compiler, but that would have required changes to *many* call sites (mostly changing `&format("...")` to `format!("...")`) which didn't seem worthwhile.

r? `@WaffleLapkin`
2023-05-29 07:10:44 +00:00
mu001999
2f65aac667 Determine self_ty with expected ty 2023-05-29 12:26:27 +08:00
bors
dc0943d2ee Auto merge of #112055 - matthiaskrgr:rollup-y3exx8c, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #112029 (Recover upon mistyped error on typo'd `const` in const param def)
 - #112037 (Add details about `unsafe_op_in_unsafe_fn` to E0133)
 - #112039 (compiler: update solaris/illumos to enable tsan support.)
 - #112042 (Migrate GUI colors test to original CSS color format)
 - #112045 (Followup to #111973)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-29 03:04:06 +00:00
Matthias Krüger
e71b3b3cfa
Rollup merge of #112045 - Sp00ph:update_current_impl, r=Amanieu
Followup to #111973

I somehow forgot to update the comment on `select_nth_unstable_by_key` in #111973, so this PR fixes that.

r? `@Amanieu`
2023-05-29 04:03:03 +02:00
Matthias Krüger
760d46ed06
Rollup merge of #112042 - GuillaumeGomez:migrate-gui-test-color-8, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-05-29 04:03:03 +02:00
Matthias Krüger
1e07e5c1f7
Rollup merge of #112039 - devnexen:solarish_compiler_spec_update, r=jackh726
compiler: update solaris/illumos to enable tsan support.
2023-05-29 04:03:02 +02:00
Matthias Krüger
c5a93ba9fe
Rollup merge of #112037 - Nemo157:e0133-unsafe_op_in_unsafe_fn, r=petrochenkov
Add details about `unsafe_op_in_unsafe_fn` to E0133

This was mentioned in https://github.com/rust-lang/rust/pull/99827#discussion_r933899901
2023-05-29 04:03:02 +02:00
Matthias Krüger
45ca2f732e
Rollup merge of #112029 - jieyouxu:typo-const-in-const-param-def, r=cjgillot
Recover upon mistyped error on typo'd `const` in const param def

And add machine-applicable fix for the typo'd `const` keyword.

### Before

```
error: expected one of `,`, `:`, `=`, or `>`, found `N`
 --> src/lib.rs:1:18
  |
1 | pub fn bar<Const N: u8>() {}
  |                  ^ expected one of `,`, `:`, `=`, or `>`
```

### After This PR

```
error: `const` keyword was mistyped as `Const`
 --> test.rs:1:8
  |
1 | fn bar<Const N: u8>() {}
  |        ^^^^^
  |
help: use the `const` keyword
  |
1 | fn bar<const N: u8>() {}
  |        ~~~~~

```

Fixes #111941.
2023-05-29 04:03:01 +02:00
bors
f8447b9638 Auto merge of #111963 - nnethercote:inline-derived-hash, r=lqd
Inline derived `hash`

Because most of the other derived functions are inlined: `clone`, `default`, `eq`, `partial_cmp`, `cmp`. The exception is `fmt`, but it tends to not be on hot paths as much.

r? `@ghost`
2023-05-29 00:25:54 +00:00
Nicholas Nethercote
781111ef35 Use Cow in {D,Subd}iagnosticMessage.
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment:
```
// FIXME(davidtwco): can a `Cow<'static, str>` be used here?
```
This commit answers that question in the affirmative. It's not the most
compelling change ever, but it might be worth merging.

This requires changing the `impl<'a> From<&'a str>` impls to `impl
From<&'static str>`, which involves a bunch of knock-on changes that
require/result in call sites being a little more precise about exactly
what kind of string they use to create errors, and not just `&str`. This
will result in fewer unnecessary allocations, though this will not have
any notable perf effects given that these are error paths.

Note that I was lazy within Clippy, using `to_string` in a few places to
preserve the existing string imprecision. I could have used `impl
Into<{D,Subd}iagnosticMessage>` in various places as is done in the
compiler, but that would have required changes to *many* call sites
(mostly changing `&format("...")` to `format!("...")`) which didn't seem
worthwhile.
2023-05-29 09:23:43 +10:00
bors
089677eb32 Auto merge of #111813 - scottmcm:pretty-mir, r=cjgillot
MIR: opt-in normalization of `BasicBlock` and `Local` numbering

This doesn't matter at all for actual codegen, but after spending some time reading pre-codegen MIR, I was wishing I didn't have to jump around so much in reading post-inlining code.

So this add two passes that are off by default for every mir level, but can be enabled (`-Zmir-enable-passes=+ReorderBasicBlocks,+ReorderLocals`) for humans.
2023-05-28 21:53:56 +00:00
bors
1c53407e8c Auto merge of #112006 - kylematsuda:earlybinder-private, r=jackh726
Make `EarlyBinder`'s inner value private

Currently, `EarlyBinder(T)`'s inner value is public, which allows implicitly skipping the binder by indexing into the tuple struct (i.e., `x.0`). `@lcnr` suggested making `EarlyBinder`'s inner value private so users are required to explicitly call `skip_binder` (https://github.com/rust-lang/rust/issues/105779#issuecomment-1549933424) .

This PR makes the inner value private, adds `EarlyBinder::new` for constructing a new instance, and replaces uses of `x.0` with `x.skip_binder()` (or similar). It also adds some documentation to `EarlyBinder::skip_binder` explaining how to skip the binder of `&EarlyBinder<T>` to get `&T` now that the inner value is private (since previously we could just do `&x.0`).

r? `@lcnr`
2023-05-28 18:04:53 +00:00
Guillaume Gomez
2eaa4e65ff Migrate GUI colors test to original CSS color format 2023-05-28 18:47:29 +02:00
Kyle Matsuda
c29c212f8d Add documentation on skip_binder on how to get &T from &EarlyBinder<T> 2023-05-28 10:44:53 -06:00
Kyle Matsuda
c40e9cc7ca Make EarlyBinder's inner value private; and fix all of the resulting errors 2023-05-28 10:44:53 -06:00
Kyle Matsuda
03534ac8b7 Replace EarlyBinder(x) with EarlyBinder::new(x) 2023-05-28 10:44:50 -06:00
Markus Everling
448a388387 Update current impl comment for select_nth_unstable_by_key 2023-05-28 16:12:48 +00:00
bors
3fae1b9fc3 Auto merge of #111755 - Zoxc:sharded-switch, r=cjgillot
Use only one shard with a single thread

This changes `Sharded` to only access a single shard using a mask set to `0` when a single thread is used, which leads to cache utilization improvements.

Performance improvement with 1 thread and `cfg(parallel_compiler)`:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7402s</td><td align="right">1.7004s</td><td align="right">💚  -2.29%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2633s</td><td align="right">0.2550s</td><td align="right">💚  -3.12%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9716s</td><td align="right">0.9482s</td><td align="right">💚  -2.41%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5679s</td><td align="right">1.5358s</td><td align="right">💚  -2.05%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.0569s</td><td align="right">5.9272s</td><td align="right">💚  -2.14%</td></tr><tr><td>Total</td><td align="right">10.5999s</td><td align="right">10.3666s</td><td align="right">💚  -2.20%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9760s</td><td align="right">💚  -2.40%</td></tr></table>

cc `@SparrowLii`
2023-05-28 15:07:33 +00:00
John Kåre Alsaker
8abafd085a Add some comments 2023-05-28 15:54:52 +02:00
John Kåre Alsaker
5843858c01 Don't access self.mask with a single shard 2023-05-28 15:47:44 +02:00
David Carlier
1cae91e9f6 compiler: update solaris and illumos spec to support TSAN. 2023-05-28 13:46:23 +01:00
bors
39c03fb652 Auto merge of #112026 - saethlin:misaligned-addrof, r=pnkfelix
Don't check for misaligned raw pointer derefs inside Rvalue::AddressOf

From https://github.com/rust-lang/rust/pull/112026#issuecomment-1565686697:

rustc 1.70 (stable next week) added a Mir pass to add pointer alignment checks in debug mode. Adding these checks caused some crates to break, but that was expected, since they contain broken code (https://github.com/rust-lang/rust/issues/111487) for tracking that.

However, the checks added are slightly more aggressive than they should have been. Specifically, they also check the place in an `addr_of!` expression. Whether lack of alignment there is or isn't UB is unclear. This PR modifies the pass to not affect those cases.

I spot checked the crater regressions and the ones I saw were not the case that this PR is modifying. It still seems good to not land anything overaggressive though
2023-05-28 12:33:52 +00:00
John Kåre Alsaker
6620882089 Use only one shard with a single thread 2023-05-28 14:08:59 +02:00
Wim Looman
8f94253254
Add details about unsafe_op_in_unsafe_fn to E0133 2023-05-28 13:11:30 +02:00