Commit Graph

243528 Commits

Author SHA1 Message Date
Nadrieril
19d6f068ee Don't rely on contiguous VariantIds outside of rustc 2024-01-17 03:09:06 +01:00
bors
714b29a17f Auto merge of #119610 - Nadrieril:never_pattern_bindings, r=compiler-errors
never patterns: Check bindings wrt never patterns

Never patterns:
- Shouldn't contain bindings since they never match anything;
- Don't count when checking that or-patterns have consistent bindings.

r? `@compiler-errors`
2024-01-15 21:24:13 +00:00
bors
bfcc027a75 Auto merge of #119988 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? ghost
2024-01-15 18:43:19 +00:00
bors
67e7b84425 Auto merge of #119987 - matthiaskrgr:rollup-f7lkx4w, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119818 (Silence some follow-up errors [3/x])
 - #119870 (std: Doc blocking behavior of LazyLock)
 - #119897 (`OutputTypeParameterMismatch` -> `SignatureMismatch`)
 - #119963 (Fix `allow_internal_unstable` for `(min_)specialization`)
 - #119971 (Use `zip_eq` to enforce that things being zipped have equal sizes)
 - #119974 (Minor `trimmed_def_paths` improvements)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-15 16:45:41 +00:00
Laurențiu Nicola
32bd51eebf Merge commit '9d8889cdfcc3aa0302353fc988ed21ff9bc9925c' into sync-from-ra 2024-01-15 11:40:09 +02:00
bors
1ead4761e9 Auto merge of #119878 - scottmcm:inline-always-unwrap, r=workingjubilee
Tune the inlinability of `unwrap`

Fixes #115463
cc `@thomcc`

This tweaks `unwrap` on ~~`Option` &~~ `Result` to be two parts:
- `#[inline(always)]` for checking the discriminant
- `#[cold]` for actually panicking

The idea here is that checking the discriminant on a `Result` ~~or `Option`~~ should always be trivial enough to be worth inlining, even in `opt-level=z`, especially compared to passing it to a function.

As seen in the issue and codegen test, this will hopefully help particularly for things like `.try_into().unwrap()`s that are actually infallible, but in a way that's only visible with the inlining.

EDIT: I've restricted this to `Result` to avoid combining effects
2024-01-15 09:20:46 +00:00
Matthias Krüger
82f38ab62e
Rollup merge of #119974 - nnethercote:trimmed_def_paths-improvements, r=compiler-errors
Minor `trimmed_def_paths` improvements

r? `@compiler-errors`
2024-01-15 08:44:50 +01:00
Matthias Krüger
b6f68a7fca
Rollup merge of #119971 - compiler-errors:zip-eq, r=nnethercote
Use `zip_eq` to enforce that things being zipped have equal sizes

Some `zip`s are best enforced to be equal, since size mismatches suggest deeper bugs in the compiler.
2024-01-15 08:44:49 +01:00
Matthias Krüger
0891cb4d81
Rollup merge of #119963 - clubby789:spec-allow-internal-unstable, r=compiler-errors
Fix `allow_internal_unstable` for `(min_)specialization`

Fixes #119950

Blocked on #119949 (comment doesn't make sense until that merges)

I'd like to follow this up and look for more instances of not properly checking spans for features but I wanted to fix the motivating issue.
2024-01-15 08:44:49 +01:00
Matthias Krüger
1e46be6a53
Rollup merge of #119897 - compiler-errors:fulfillment-errors, r=lcnr
`OutputTypeParameterMismatch` -> `SignatureMismatch`

I'm probably missing something that made this rename more complicated. What did you end up getting stuck on when renaming this selection error, `@lcnr?`

**also** I renamed the `FulfillmentErrorCode` variants. This is just churn but I wanted to do it forever. I can move it out of this PR if desired.

r? lcnr
2024-01-15 08:44:48 +01:00
Matthias Krüger
6f2670da7b
Rollup merge of #119870 - behnam-oneschema:lazylock-blocking-1, r=tgross35,ChrisDenton
std: Doc blocking behavior of LazyLock

Adding notes about blocking behavior of calls that can block the current thread, similar to those on https://doc.rust-lang.org/std/sync/struct.OnceLock.html

I'm not sure if the "This method never blocks." counterparts would be desired. If so, can add those, as well.
2024-01-15 08:44:48 +01:00
Matthias Krüger
73256c68b8
Rollup merge of #119818 - oli-obk:even_more_follow_up_errors3, r=compiler-errors
Silence some follow-up errors [3/x]

this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449

Keep error types around, even in obligations.

These help silence follow-up errors, as we now figure out that some types (most notably inference variables) are equal to an error type.

But it also allows figuring out more types in the presence of errors, possibly causing more errors.
2024-01-15 08:44:46 +01:00
bors
73252d51d1 Auto merge of #119508 - Zalathar:graph, r=compiler-errors
coverage: Simplify building the coverage graph with `CoverageSuccessors`

This is a collection of simplifications to the code that builds the *basic coverage block* graph, which is a simplified view of the MIR control-flow graph that ignores panics and merges straight-line sequences of blocks into a single BCB node.

The biggest change is to how we determine the coverage-relevant successors of a block. Previously we would call `Terminator::successors` and apply some ad-hoc postprocessing, but with this PR we instead have our own `match` on the terminator kind that produces a coverage-specific enum `CoverageSuccessors`. That enum also includes information about whether a block has exactly one successor that it can be chained into as part of a single BCB.
2024-01-15 06:45:33 +00:00
bors
9567c3ee73 Auto merge of #119581 - Nadrieril:detangle-arena, r=compiler-errors
Exhaustiveness: remove the need for arena-allocation within the algorithm

After https://github.com/rust-lang/rust/pull/119688, exhaustiveness checking doesn't need access to the arena anymore. This simplifies the lifetime story and makes it compile on stable without the extra dependency.

r? `@compiler-errors`
2024-01-15 00:04:09 +00:00
Nicholas Nethercote
32de78cade Replace TrimmedDefPaths with a bool.
It's a tri-state enum but the `Always` variant is never used, so a bool
is simpler.
2024-01-15 09:16:14 +11:00
Nicholas Nethercote
086d17b7cb Refactor try_print_trimmed_def_path.
Inverting the condition lets us merge the two `Ok(false)` paths. I also
find the inverted condition easier to read: "all the things that must be
true for trimming to occur", instead of "any of the things that must be
true for trimming to not occur".
2024-01-15 09:04:31 +11:00
Nicholas Nethercote
4efddb141a Add some helpful comments in trimmed_def_paths.
To explain things that took me a minute to work out.
2024-01-15 08:58:36 +11:00
bors
30dfb9e046 Auto merge of #119970 - GuillaumeGomez:rollup-p53c19o, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #119561 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5))
 - #119742 (ARMv6K HorizonOS - Fix backlog for UnixListener)
 - #119960 (Inline 2 functions that appear in dep-graph profiles.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-14 21:15:48 +00:00
Michael Goulet
c811662fb0 Use zip_eq to enforce that things being zipped have equal sizes 2024-01-14 20:01:12 +00:00
Michael Goulet
c5cb87cf0c Closure body was being built incorrectly on error... 2024-01-14 19:59:10 +00:00
Guillaume Gomez
d635cec7c6
Rollup merge of #119960 - cjgillot:inline-dg, r=WaffleLapkin
Inline 2 functions that appear in dep-graph profiles.

Those functions are small enough not to deserve a dedicated symbol.
2024-01-14 20:17:24 +01:00
Guillaume Gomez
e401754717
Rollup merge of #119742 - Meziu:armv6k-nintendo-3ds, r=Mark-Simulacrum
ARMv6K HorizonOS - Fix backlog for UnixListener

Simple `#[cfg]` fix to avoid using `libc::SOMAXCONN`, which isn't defined for the `armv6k-nintendo-3ds` target.

Edit: This is similar to #119632.
2024-01-14 20:17:23 +01:00
Guillaume Gomez
8914ca722c
Rollup merge of #119561 - notriddle:master, r=fmease
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
* https://github.com/rust-lang/rust/pull/118105
2024-01-14 20:17:23 +01:00
bors
665d2c6f2c Auto merge of #119796 - androm3da:bcain/compiler_builtins_0_1_105, r=Mark-Simulacrum
Update compiler_builtins to 0.1.105

This provides the builtins for the hexagon architecture.
2024-01-14 19:15:37 +00:00
clubby789
eb63d3a49d allow_internal_unstable(min_specialization) on newtype_index 2024-01-14 19:07:13 +00:00
Behnam Esfahbod
a596159dca std: Doc blocking behavior of LazyLock methods 2024-01-14 10:28:13 -08:00
bors
273035458d Auto merge of #119962 - GuillaumeGomez:rollup-mj7agm6, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #119944 (Don't ICE when noting GAT bounds in `report_no_match_method_error`)
 - #119949 (Add note on SpecOptionPartialEq to `newtype_index`)
 - #119961 ([meta] Remove Zulip rustdoc nomination alert)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-14 17:13:30 +00:00
clubby789
0529ccf341 Fix allow_internal_unstable for (min_)specialization 2024-01-14 13:50:02 +00:00
Guillaume Gomez
7841d26641
Rollup merge of #119961 - fmease:triagebot-rustdoc-i-nominated, r=GuillaumeGomez
[meta] Remove Zulip rustdoc nomination alert

There no longer exists the label <kbd>I-nominated</kbd>, it's no longer possible to trigger the Zulip nomination alert. Nowadays, there are separate <kbd>I-{team}-nominated</kbd> labels one for each team that make use of such a nomination system.

Since t-rustdoc has never really used this nomination system, I figured I should remove it outright. However, instead of that, I could create the label <kbd>I-rustdoc-nominated</kbd> and adjust the triagebot entry. Whatever you prefer.

r? GuillaumeGomez or rustdoc
2024-01-14 14:02:29 +01:00
Guillaume Gomez
a9146ce683
Rollup merge of #119949 - clubby789:spec-newtype-comment, r=nnethercote
Add note on SpecOptionPartialEq to `newtype_index`

https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.60SpecOptionPartialEq.60.20error

r? `@nnethercote`
2024-01-14 14:02:29 +01:00
Guillaume Gomez
5ad0ed52e9
Rollup merge of #119944 - compiler-errors:no-match-due-to-gat-bounds, r=fmease
Don't ICE when noting GAT bounds in `report_no_match_method_error`

We can encounter `BindingObligation`s from GATs that we should handle in `report_no_match_method_error`. I assume we can encounter them from methods, though I didn't really feel like wasting my time creating a repro.

Fixes #119942
2024-01-14 14:02:28 +01:00
Camille GILLOT
c6f83b8ff6 Inline 2 functions that appear in dep-graph profiles. 2024-01-14 12:57:13 +00:00
León Orell Valerian Liehr
5788f3d350
Remove Zulip rustdoc nomination alert 2024-01-14 13:55:18 +01:00
bors
8847bda592 Auto merge of #119361 - sjwang05:issue-119352, r=WaffleLapkin
Fix ICE when suggesting dereferencing binop operands

Fixes #119352
2024-01-14 09:39:03 +00:00
bors
0dab65b8a1 Auto merge of #119934 - compiler-errors:could-impl, r=jackh726
Make `InferCtxtExt::could_impl_trait` more precise, less ICEy

The implementation for `InferCtxtExt::could_impl_trait` was very wrong. Along with being pretty poorly named, way too specific to ADTs, it was also doing impl substitution wrong -- this caused an ICE (#119915).

This PR generalizes that code, gives it a clearer name, makes it stop using the new trait solver (lol), and fixes some fallout bad suggestions that are made worse with the code fix.

Fixes #119915
2024-01-14 06:37:15 +00:00
bors
aa5f781bd4 Auto merge of #119341 - sjwang05:issue-58462, r=WaffleLapkin
Suggest quoting unquoted idents in attrs

Closes #58462
2024-01-14 04:37:45 +00:00
Zalathar
5eae9452b6 coverage: Simplify computing successors in the BCB graph 2024-01-14 12:11:26 +11:00
Zalathar
867950f8c6 coverage: Move helper add_basic_coverage_block into a local closure
This also switches from `split_off(0)` to `std::mem::take` when emptying the
accumulated list of blocks, because `split_off(0)` handles capacity in a way
that is unintuitive when used in a loop.
2024-01-14 12:11:25 +11:00
Zalathar
229d0983b5 coverage: Simplify the loop that combines blocks into BCBs
The old loop had two separate places where it would flush the acumulated list
of straight-line blocks into a new BCB. One occurred at the start of the loop
body when the current block couldn't be chained into, and the other occurred at
the end of the loop body when the current block couldn't be chained from.

The latter check can be hoisted to the start of the loop body by making it
examine the previous block (which has added itself to the list) instead of the
current block. With that done, we can combine the two separate flushes into one
flush with two possible trigger conditions.
2024-01-14 12:11:25 +11:00
Zalathar
c412cd4bc2 coverage: Indicate whether a block's successors allow BCB chaining 2024-01-14 12:11:25 +11:00
Zalathar
6d1c396399 coverage: Determine a block's successors from just the terminator
Filtering out unreachable successors is only needed by the main graph traversal
loop, so we can move the filtering step into that loop instead, eliminating the
need to pass the MIR body into `bcb_filtered_successors`.
2024-01-14 12:11:25 +11:00
clubby789
4ca6342eb3 Add note on SpecOptionPartialEq to newtype_index 2024-01-14 00:24:39 +00:00
bors
3deb9bbf84 Auto merge of #119945 - matthiaskrgr:rollup-oy3e1j2, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #119189 (Move section "Installing from Source" to seperate file)
 - #119925 (store the segment name when resolution fails)
 - #119935 (Move personality implementation out of PAL)
 - #119937 (Improve UEFI target docs)
 - #119938 (Allow unauthorized users to user the has-merge-commits label)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-13 22:05:46 +00:00
Michael Goulet
7724ba7bd5 assert that trait solver is only created in proper infcx 2024-01-13 22:00:35 +00:00
Michael Goulet
04a6fd241b Make InferCtxtExt::could_impl_trait less messed up 2024-01-13 22:00:34 +00:00
Matthias Krüger
847aad75ad
Rollup merge of #119938 - Nilstrieb:has-merge-commits-unauthenticated, r=fmease
Allow unauthorized users to user the has-merge-commits label

So they can remove it after they've removed the merge commit.
2024-01-13 22:35:10 +01:00
Matthias Krüger
f7a76a9d0b
Rollup merge of #119937 - nicholasbishop:bishop-uefi-doc-improve, r=ehuss
Improve UEFI target docs

* Add a section showing exactly how to build a driver instead of an application
* Add links to the crates mentioned in the doc

CC `@dvdhrm`
2024-01-13 22:35:10 +01:00
Matthias Krüger
3a33a4b8f5
Rollup merge of #119935 - joboet:move_pal_personality, r=ChrisDenton
Move personality implementation out of PAL

The module already follows the new convention described in #117276. This PR also includes a small fix in the tidy pal check, that was just an oversight in #117285.
2024-01-13 22:35:09 +01:00
Matthias Krüger
70bc26d0e7
Rollup merge of #119925 - bvanjoi:fix-112672, r=Nilstrieb
store the segment name when resolution fails

Fixes #112672

The `find_cfg_stripped` does indeed get executed within `smart_resolve_report_errors`. However, this error is not reported as it is subsequently overridden by `parent_err`. (See: https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/late.rs#L3760)

This PR changes `last_segment` to `segment`, which stores the name of the failed resolution, and ensures that the result of `find_cfg_stripped` is also included in `parent_err`.

r? ```@Nilstrieb```
2024-01-13 22:35:08 +01:00
Matthias Krüger
0bbc88809d
Rollup merge of #119189 - henrispriet:move-installing-from-source, r=Mark-Simulacrum
Move section "Installing from Source" to seperate file

cc #118627
2024-01-13 22:35:08 +01:00