Commit Graph

233106 Commits

Author SHA1 Message Date
Matthias Krüger
0b62835043
Rollup merge of #115373 - lqd:come-on-bors, r=compiler-errors
Fix bors missing a commit when merging #115355

bors incorrectly merged an outdated version of PR #115355 (via rollup #115370):
- it [recorded r+](https://github.com/rust-lang/rust/pull/115355#issuecomment-1698372365) as approving commit 325b585259, and thus merged the original revision 7762ac7bb5
- but the branch at the time was at commit eefa07d69b, so bors missed the `compiler/rustc_trait_selection/src/solve/search_graph/mod.rs` cleanup in commit 0e1e964a34 😓

Thankfully the change that bors missed was small, and this new PR corrects the situation (as I'd rather avoid having confusing multiple merge commits of PR #115355 in the git history)

r? ``@compiler-errors``
2023-08-31 07:52:43 +02:00
The Miri Conjob Bot
f57b41519d fmt 2023-08-31 05:42:55 +00:00
The Miri Conjob Bot
31d9ac14f5 Merge from rustc 2023-08-31 05:40:49 +00:00
The Miri Conjob Bot
4b915b8a86 Preparing for merge from rustc 2023-08-31 05:34:07 +00:00
bors
008c21c977 Auto merge of #115323 - onur-ozkan:curl-download-checksum-fix, r=Mark-Simulacrum
avoid stdout redirection on `curl` executions

Avoid redirecting the curl output directly to the stdout. This alteration affects the integrity of the file during the retry process, as it also redirects the logs from the retries. Consequently, this leads to the bootstrap process failing because of an invalid checksum.

For more information, see the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/checksum.20errors)

Fixes #115275
2023-08-31 02:19:55 +00:00
bors
e51c5ea16f Auto merge of #115392 - compiler-errors:coherence-spans, r=aliemjay
Don't record spans for predicates in coherence

Should improve perf (https://github.com/rust-lang/rust/pull/115107#issuecomment-1695090589) for https://github.com/rust-lang/rust/pull/114023#issuecomment-1688514709

r? aliemjay
2023-08-31 00:34:04 +00:00
bors
b1b244da65 Auto merge of #115194 - tmiasko:inline-always-encode-mir, r=compiler-errors
Fix inlining with -Zalways-encode-mir

Only inline functions that are considered eligible for inlining
by the reachability pass.

This constraint was previously indirectly enforced by only exporting MIR
of eligible functions, but that approach doesn't work with
-Zalways-encode-mir enabled.
2023-08-30 22:51:12 +00:00
Michael Goulet
bf66723c0e Test and note unsafe ctor to fn ptr coercion
Also remove a note that I don't consider to be very useful in context.
2023-08-30 15:09:40 -07:00
Michael Goulet
0100a94231 rustc_layout_scalar_valid_range makes ctors unsafe 2023-08-30 15:01:58 -07:00
Christian Legnitto
da86cdf3a5
Make termcolor types public in rustc_errors
After https://github.com/rust-lang/rust/pull/114104, `rust-gpu` is unable to create a custom `Emitter` as the bounds have changed to include `WriteColor`.

I was able to work around this by adding `termcolor` as a direct dependency, but I believe this should be exposed as part of `rustc_errors` proper.

See https://github.com/rust-lang/rust/pull/102992 for why `rust-gpu` needs to create a custom emitter.
2023-08-30 16:06:49 -04:00
bors
59a8294849 Auto merge of #115144 - Zoxc:parallel-guard, r=compiler-errors
Add `ParallelGuard` type to handle unwinding in parallel sections

This adds a `ParallelGuard` type to handle unwinding in parallel sections instead of manually dealing with panics in each parallel operation. This also adds proper panic handling to the `join` operation.

cc `@SparrowLii`
2023-08-30 19:33:13 +00:00
Michael Goulet
4647aea7aa Don't record spans for predicates in coherence 2023-08-30 18:24:18 +00:00
bors
8c79e8d756 Auto merge of #115058 - Swatinem:inline-add-coverage, r=compiler-errors
Inline functions called from `add_coverage`

This removes quite a bit of indirection and duplicated code related to getting the `FunctionCoverage`.

CC `@Zalathar`
2023-08-30 17:43:38 +00:00
John Kåre Alsaker
c303c8abdd Use a parallel_guard function to handle the parallel guard 2023-08-30 18:17:38 +02:00
John Kåre Alsaker
d36393b839 Use Mutex to avoid issue with conditional locks 2023-08-30 18:17:38 +02:00
John Kåre Alsaker
242805442b Update failure status 2023-08-30 18:13:09 +02:00
John Kåre Alsaker
b56acac41d Add ParallelGuard type to handle unwinding in parallel sections 2023-08-30 18:13:06 +02:00
John Kåre Alsaker
51eb8427bf Make parallel! an expression 2023-08-30 18:12:18 +02:00
bors
ac02e40380 Auto merge of #114616 - oli-obk:gotta_capture_'em_all, r=compiler-errors
Capture all lifetimes for TAITs and impl trait in associated types

This reverts commit cb9467515b, reversing changes made to 57781b24c5. (This is only true for the tests, the change itself was done from scratch, as the compiler has diverged sufficiently for a revert to not make sense anymore).

This implements the lang team decision from this meeting: https://hackmd.io/sFaSIMJOQcuwCdnUvCxtuQ?view

r? `@cjgillot` on the impl
2023-08-30 15:57:26 +00:00
Ralf Jung
c37bd09d88 miri function ABI check: specifically look for repr(transparent) 2023-08-30 17:07:25 +02:00
Ralf Jung
c1a34729e1 organize failing ABI compat tests and add some more 2023-08-30 17:04:54 +02:00
Ralf Jung
1e95aa0c49 interpret: make sure we accept transparent newtypes as ABI-compatible
also we were missing the case for Vector arguments, so handle those as well
2023-08-30 17:04:54 +02:00
Rémy Rakic
f3a1bae88c add test for issue 114907 2023-08-30 14:10:52 +00:00
Rémy Rakic
a725436c29 return default UniverseInfo cause in RegionInferenceContext
Query canonicalization can create local super-universes without causes,
creating ICEs when accessed during diagnostics.
2023-08-30 13:51:09 +00:00
bors
26089ba0a2 Auto merge of #114483 - RalfJung:unsized-fields, r=oli-obk
interpret: fix projecting into an unsized field of a local

See the new Miri testcase that didn't work before.

r? `@oli-obk`
2023-08-30 11:55:48 +00:00
Oli Scherer
5d850e0f50 Permit recursive weak type aliases 2023-08-30 11:55:03 +00:00
Ralf Jung
6d1ce9bd13 storage_live: avoid computing the layout unless necessary 2023-08-30 13:46:55 +02:00
Ralf Jung
f87e91de7d unify passing of sized and unsized function arguments :-) 2023-08-30 13:46:55 +02:00
Ralf Jung
7cdeff266c a bit of meta-related cleanup on Projectable 2023-08-30 13:46:55 +02:00
Ralf Jung
a09df43d9f move marking-locals-live out of push_stack_frame, so it happens with argument passing
this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30 13:46:54 +02:00
Lukas Wirth
76ee9acc61 ignore-cross-compile remaining tests that run binaries 2023-08-30 13:45:57 +02:00
Ralf Jung
bdd5855b8e interpret: fix projecting into an unsized field of a local
new invariant: Place::Local never refers to something unsized
2023-08-30 13:43:34 +02:00
Oli Scherer
e82ccd52db Test variances of TAITs 2023-08-30 11:23:42 +00:00
Oli Scherer
e0a60f0740 Revert "Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726"
This reverts commit cb9467515b, reversing
changes made to 57781b24c5.
2023-08-30 11:06:46 +00:00
Rémy Rakic
72725529e1 clean up local_overflow_limit computation
fixes bors snafu where it merged an outdated commit and missed this
change
2023-08-30 09:43:36 +00:00
Ding Xiang Fei
39cf0b5dd5
use if only on lhs of binary logical exprs 2023-08-30 17:24:11 +08:00
Ding Xiang Fei
d9ed11872f
lower bare boolean expression with if-construct 2023-08-30 17:24:11 +08:00
Ding Xiang Fei
e5453b4806
lower ExprKind::Use, LogicalOp::Or and UnOp::Not
Co-authored-by: Abdulaziz Ghuloum <aghuloum@gmail.com>
2023-08-30 17:24:10 +08:00
Ding Xiang Fei
b290d69738
mir-opt test before patch 2023-08-30 17:24:09 +08:00
Oli Scherer
92cfd209f1 Move some logic using rustc datastructures to the rustc_smir module 2023-08-30 08:10:28 +00:00
Oli Scherer
03b03f9fee Reuse the ty::Const: Stable impl 2023-08-30 08:09:41 +00:00
Oli Scherer
3a736a747d Exhaustively match on ty::Const::kind 2023-08-30 08:08:39 +00:00
Oli Scherer
9b8e3eb8f7 Move around constants' Stable impls a bit 2023-08-30 08:08:39 +00:00
bors
61efe9d298 Auto merge of #111713 - Zoxc:lock-switch, r=nnethercote
Use conditional synchronization for Lock

This changes `Lock` to use synchronization only if `mode::is_dyn_thread_safe` could be true. This reduces overhead for the parallel compiler running with 1 thread.

The emitters are changed to use `DynSend` instead of `Send` so they can still use `Lock`.

A Rayon thread pool is not used with 1 thread anymore, as session globals contains `Lock`s which are no longer `Sync`.

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.7665s</td><td align="right">1.7336s</td><td align="right">💚  -1.86%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2780s</td><td align="right">0.2736s</td><td align="right">💚  -1.61%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9994s</td><td align="right">0.9824s</td><td align="right">💚  -1.70%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5875s</td><td align="right">1.5656s</td><td align="right">💚  -1.38%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.0682s</td><td align="right">5.9532s</td><td align="right">💚  -1.90%</td></tr><tr><td>Total</td><td align="right">10.6997s</td><td align="right">10.5083s</td><td align="right">💚  -1.79%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9831s</td><td align="right">💚  -1.69%</td></tr></table>

cc `@SparrowLii`
2023-08-30 08:03:43 +00:00
bors
7659abc63d Auto merge of #115370 - matthiaskrgr:rollup-l0e1zuj, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113565 (Make SIGSEGV handler emit nicer backtraces)
 - #114704 (parser: not insert dummy field in struct)
 - #115272 (miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors)
 - #115313 (Make `get_return_block()` return `Some` only for HIR nodes in body)
 - #115347 (suggest removing `impl` in generic trait bound position)
 - #115355 (new solver: handle edge case of a recursion limit of 0)
 - #115363 (Don't suggest adding parentheses to call an inaccessible method.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-30 06:16:17 +00:00
Matthias Krüger
ea2347843c
Rollup merge of #115363 - kpreid:suggest-private, r=compiler-errors
Don't suggest adding parentheses to call an inaccessible method.

Previously, code of this form would emit E0615 (attempt to use a method as a field), thus emphasizing the existence of private methods that the programmer probably does not care about. Now it ignores their existence instead, producing error E0609 (no field). The motivating example is:

```rust
let x = std::rc::Rc::new(());
x.inner;
```

which would previously mention the private method `Rc::inner()`, even though `Rc<T>` intentionally has no public methods so that it can be a transparent smart pointer for any `T`.

```rust
error[E0615]: attempted to take value of method `inner` on type `Rc<()>`
 --> src/main.rs:3:3
  |
3 | x.inner;
  |   ^^^^^ method, not a field
  |
help: use parentheses to call the method
  |
3 | x.inner();
  |        ++
  ```

  With this change, it emits E0609 and no suggestion.
2023-08-30 07:18:13 +02:00
Matthias Krüger
36182f1f13
Rollup merge of #115355 - lqd:issue-115351, r=compiler-errors
new solver: handle edge case of a recursion limit of 0

Apparently a recursion limit of 0 is possible/valid/useful/used/cute, the more you know 🌟 .

(It's somewhat interesting to me that the old solver seemingly handles this, and that the new solver currently requires a recursion limit of 2 here)

r? `@compiler-errors.`

Fixes #115351.
2023-08-30 07:18:13 +02:00
Matthias Krüger
58c690729c
Rollup merge of #115347 - y21:generic-bound-impl-trait-ty, r=compiler-errors
suggest removing `impl` in generic trait bound position

rustc already does this recovery in type param position (`<T: impl Trait>` -> `<T: Trait>`).
This PR also adds that suggestion in trait bound position (e.g. `where T: impl Trait` or `trait Trait { type Assoc: impl Trait; }`)
2023-08-30 07:18:12 +02:00
Matthias Krüger
2128efd87f
Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errors
Make `get_return_block()` return `Some` only for HIR nodes in body

Fixes #114918

The issue occurred while compiling the following input:

```rust
fn uwu() -> [(); { () }] {
    loop {}
}
```

It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: 1bd043098e/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs (L68-L75)

The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding).

The PR fixes the issue by fixing this behaviour of `get_return_block()`.
2023-08-30 07:18:11 +02:00
Matthias Krüger
23f86255ef
Rollup merge of #115272 - RalfJung:miri-error-print, r=saethlin
miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors

This should fix the missing output encountered [here](https://github.com/rust-lang/rust/issues/115145#issuecomment-1694334410).

r? `@saethlin`
2023-08-30 07:18:11 +02:00