about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-06-19Rollup merge of #126553 - Nadrieril:expand-or-pat-into-above, r=matthewjasperLeón Orell Valerian Liehr-113/+366
match lowering: expand or-candidates mixed with candidates above This PR tweaks match lowering of or-patterns. Consider this: ```rust match (x, y) { (1, true) => 1, (2, false) => 2, (1 | 2, true | false) => 3, (3 | 4, true | false) => 4, _ => 5, } ``` One might hope that this can be compiled to a single `SwitchInt` on `x` followed by some boolean checks. Before this PR, we compile this to 3 `SwitchInt`s on `x`, because an arm that contains more than one or-pattern was compiled on its own. This PR groups branch `3` with the two branches above, getting us down to 2 `SwitchInt`s on `x`. We can't in general expand or-patterns freely, because this interacts poorly with another optimization we do: or-pattern simplification. When an or-pattern doesn't involve bindings, we branch the success paths of all its alternatives to the same block. The drawback is that in a case like: ```rust match (1, true) { (1 | 2, false) => unreachable!(), (2, _) => unreachable!(), _ => {} } ``` if we used a single `SwitchInt`, by the time we test `false` we don't know whether we came from the `1` case or the `2` case, so we don't know where to go if `false` doesn't match. Hence the limitation: we can process or-pattern alternatives alongside candidates that precede it, but not candidates that follow it. (Unless the or-pattern is the only remaining match pair of its candidate, in which case we can process it alongside whatever). This PR allows the processing of or-pattern alternatives alongside candidates that precede it. One benefit is that we now process or-patterns in a single place in `mod.rs`. r? ``@matthewjasper``
2024-06-19Rollup merge of #125787 - Oneirical:infinite-test-a-novel, r=jieyouxuLeón Orell Valerian Liehr-15/+39
Migrate `bin-emit-no-symbols` `run-make` test to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: armhf-gnu
2024-06-19Rollup merge of #124580 - gurry:124556-suggest-remove-tuple-field, r=jackh726León Orell Valerian Liehr-45/+109
Suggest removing unused tuple fields if they are the last fields Fixes #124556 We now check if dead/unused fields are the last fields of the tuple and suggest their removal instead of suggesting them to be changed to `()`.
2024-06-19Rollup merge of #123782 - oli-obk:equal_tait_args, r=compiler-errorsLeón Orell Valerian Liehr-0/+95
Test that opaque types can't have themselves as a hidden type with incompatible lifetimes fixes #122876 This PR used to add extra logic to prevent those cases, but after https://github.com/rust-lang/rust/pull/113169 this is implicitly rejected, because such usages are not defining.
2024-06-19Auto merge of #126657 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 13 commits in a1f47ec3f7cd076986f1bfcd7061f2e8cb1a726e..3ed207e416fb2f678a40cc79c02dcf4f936a21ce 2024-06-15 01:10:07 +0000 to 2024-06-18 19:18:22 +0000 - test: prefer raw string for regex reduction (rust-lang/cargo#14099) - test: migrate tree and tree_graph_features to snapbox (rust-lang/cargo#14094) - test: Migrate some files to snapbox (rust-lang/cargo#14069) - remove some legacy public dependency code from the resolver (rust-lang/cargo#14090) - fix(fix): Address problems with implicit -&gt; explicit feature migration (rust-lang/cargo#14018) - refactor: 1.79 cleanup (rust-lang/cargo#14088) - test: migrate `git_(gc|shallow)` to snapbox (rust-lang/cargo#14087) - test: migrate timings_works to snapbox (rust-lang/cargo#14082) - test: migrate minimal_versions to snapbox (rust-lang/cargo#14080) - Remove `run_expect_error` to avoid tests incorrectly passing (rust-lang/cargo#14078) - test: migrate help to snapbox (rust-lang/cargo#14060) - test: Migrate tests/testsuite/co*.rs to snapbox (rust-lang/cargo#14079) - Use `std::fs::absolute` instead of reimplementing it (rust-lang/cargo#14075) <!-- r? ghost -->
2024-06-18Update cargoWeihang Lo-0/+0
2024-06-19Auto merge of #126655 - jieyouxu:rollup-z7k1k6l, r=jieyouxubors-654/+2188
Rollup of 10 pull requests Successful merges: - #124135 (delegation: Implement glob delegation) - #125078 (fix: break inside async closure has incorrect span for enclosing closure) - #125293 (Place tail expression behind terminating scope) - #126422 (Suggest using a standalone doctest for non-local impl defs) - #126493 (safe transmute: support non-ZST, variantful, uninhabited enums) - #126504 (Sync fuchsia test runner with clang test runner) - #126558 (hir_typeck: be more conservative in making "note caller chooses ty param" note) - #126586 (Add `@badboy` and `@BlackHoleFox` as Mac Catalyst maintainers) - #126615 (Add `rustc-ice*` to `.gitignore`) - #126632 (Replace `move||` with `move ||`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-19Rollup merge of #126632 - Vonr:fix/moving-closure-formatting-v2, r=Nilstrieb许杰友 Jieyou Xu (Joe)-18/+18
Replace `move||` with `move ||` Edit from #126631 to revert changes in `tests/ui`. There are 18 instances of `move||` across 6 files in the repo: - `compiler/rustc_hir_typeck/src/typeck_root_ctxt.rs` - `library/core/src/sync/atomic.rs` - `library/std/src/sync/condvar.rs` - `library/std/src/sync/mpsc/mod.rs` - `library/std/src/sync/barrier.rs` - `library/std/src/thread/local.rs` I have replaced all such instances with `move ||` instead as it better adheres to modern formatting standards. Ideally, we would have this automated by rustfmt or some other tool, but I do not have the time to implement such a feature or tool. Nonetheless, I would encourage any effort invested into such a tool or feature.
2024-06-19Rollup merge of #126615 - tgross35:gitignore-ice, r=compiler-errors许杰友 Jieyou Xu (Joe)-0/+1
Add `rustc-ice*` to `.gitignore` I am a bit surprised this wasn't already here but there doesn't seem to be any reason not to add it. This will be nice to cut down on `git {add, diff, etc}` noise when debugging crashes.
2024-06-19Rollup merge of #126586 - madsmtm:mac-catalyst-maintainers, r=Nilstrieb许杰友 Jieyou Xu (Joe)-0/+2
Add @badboy and @BlackHoleFox as Mac Catalyst maintainers Assented in https://github.com/rust-lang/compiler-team/issues/761#issuecomment-2173071316 and https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Promote.20Mac.20Catalyst.20targets.20to.20Tier.202.20compiler-team.23761/near/444590303.
2024-06-19Rollup merge of #126558 - jieyouxu:caller-chooses-ty, r=fmease许杰友 Jieyou Xu (Joe)-16/+49
hir_typeck: be more conservative in making "note caller chooses ty param" note In https://github.com/rust-lang/rust/pull/122195 I added a "caller chooses ty for type param" note for when the return expression type a.k.a. found type does not match the expected return type. #126547 found that this note was confusing when the found return type *contains* the expected type, e.g. ```rs fn f<T>(t: &T) -> T { t } ``` because the found return type `&T` will *always* be different from the expected return type `T`, so the note was needlessly redundant and confusing. This PR addresses that by not making the note if the found return type contains the expected return type. r? ``@fmease`` (since you reviewed the original PR) Fixes https://github.com/rust-lang/rust/issues/126547
2024-06-19Rollup merge of #126504 - erickt:bump-fuchsia, r=tmandry许杰友 Jieyou Xu (Joe)-386/+628
Sync fuchsia test runner with clang test runner This synchronizes the fuchsia test running code with the clang test runner. This brings with it: * Improved logging * Uses the fuchsia image from the SDK version * Caches the product bundle across test runs * Strips the binaries to reduce the data sent to the emulator r? ``@tmandry``
2024-06-19Rollup merge of #126493 - jswrenn:fix-126460, r=compiler-errors许杰友 Jieyou Xu (Joe)-30/+89
safe transmute: support non-ZST, variantful, uninhabited enums Previously, `Tree::from_enum`'s implementation branched into three disjoint cases: 1. enums that uninhabited 2. enums for which all but one variant is uninhabited 3. enums with multiple variants This branching (incorrectly) did not differentiate between variantful and variantless uninhabited enums. In both cases, we assumed (and asserted) that uninhabited enums are zero-sized types. This assumption is false for enums like: enum Uninhabited { A(!, u128) } ...which, currently, has the same size as `u128`. This faulty assumption manifested as the ICE reported in #126460. In this PR, we revise the first case of `Tree::from_enum` to consider only the narrow category of "enums that are uninhabited ZSTs". These enums, whose layouts are described with `Variants::Single { index }`, are special in their layouts otherwise resemble the `!` type and cannot be descended into like typical enums. This first case captures uninhabited enums like: enum Uninhabited { A(!, !), B(!) } The second case is revised to consider the broader category of "enums that defer their layout to one of their variants"; i.e., enums whose layouts are described with `Variants::Single { index }` and that do have a variant at `index`. This second case captures uninhabited enums that are not ZSTs, like: enum Uninhabited { A(!, u128) } ...which represent their variants with `Variants::Single`. Finally, the third case is revised to cover the broader category of "enums with multiple variants", which captures uninhabited enums like: enum Uninhabited { A(u8, !), B(!, u32) } ...which represent their variants with `Variants::Multiple`. This PR also adds a comment requested by ````@RalfJung```` in his review of #126358 to `compiler/rustc_const_eval/src/interpret/discriminant.rs`. Fixes #126460 r? ````@compiler-errors````
2024-06-19Rollup merge of #126422 - Urgau:doctest-impl-non-local-def, r=fmease许杰友 Jieyou Xu (Joe)-46/+125
Suggest using a standalone doctest for non-local impl defs This PR tweaks the lint output of the `non_local_definitions` lint to suggest using a standalone doctest instead of a moving the `impl` def to an impossible place as was already done with `macro_rules!` case in https://github.com/rust-lang/rust/pull/124568. Fixes #126339 r? ```@fmease```
2024-06-19Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, ↵许杰友 Jieyou Xu (Joe)-23/+376
r=estebank,davidtwco Place tail expression behind terminating scope This PR implements #123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
2024-06-19Rollup merge of #125078 - linyihai:issue-124496, r=compiler-errors许杰友 Jieyou Xu (Joe)-12/+22
fix: break inside async closure has incorrect span for enclosing closure Fixes #124496
2024-06-19Rollup merge of #124135 - petrochenkov:deleglob, r=fmease许杰友 Jieyou Xu (Joe)-123/+878
delegation: Implement glob delegation Support delegating to all trait methods in one go. Overriding globs with explicit definitions is also supported. The implementation is generally based on the design from https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823, but unlike with list delegation in https://github.com/rust-lang/rust/pull/123413 we cannot expand glob delegation eagerly. We have to enqueue it into the queue of unexpanded macros (most other macros are processed this way too), and then a glob delegation waits in that queue until its trait path is resolved, and enough code expands to generate the identifier list produced from the glob. Glob delegation is only allowed in impls, and can only point to traits. Supporting it in other places gives very little practical benefit, but significantly raises the implementation complexity. Part of https://github.com/rust-lang/rust/issues/118212.
2024-06-18Auto merge of #126607 - Oneirical:the-testern-world, r=jieyouxubors-29/+46
Rewrite `separate-link`, `separate-link-fail` and `allocator-shim-circular-deps` `run-make` tests to `ui` or `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-06-18tests: update tests for more conservative return ty mismatch note许杰友 Jieyou Xu (Joe)-6/+27
2024-06-18hir_typeck: be more conservative in making "note caller chooses ty param" note许杰友 Jieyou Xu (Joe)-10/+22
- Avoid "caller chooses ty for type param" note if the found type a.k.a. the return expression type *contains* the type parameter, because e.g. `&T` will always be different from `T` (i.e. "well duh"). - Rename `note_caller_chooses_ty_for_ty_param` to `try_note_caller_chooses_ty_for_ty_param` because the note is not always made. Issue: https://github.com/rust-lang/rust/issues/126547
2024-06-18Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnrbors-1823/+2824
Uplift next trait solver to `rustc_next_trait_solver` 🎉 There's so many FIXMEs! Sorry! Ideally this merges with the FIXMEs and we track and squash them over the near future. Also, this still doesn't build on anything other than rustc. I still need to fix `feature = "nightly"` in `rustc_type_ir`, and remove and fix all the nightly feature usage in the new trait solver (notably: let-chains). Also, sorry `@lcnr` I know you asked for me to separate the commit where we `mv rustc_trait_selection/solve/... rustc_next_trait_solver/solve/...`, but I had already done all the work by that point. Luckily, `git` understands the file moves so it should still be relatively reviewable. If this is still very difficult to review, then I can do some rebasing magic to try to separate this out. Please let me know! r? lcnr
2024-06-18use llvm_readobj in run-make test instead of nmOneirical-63/+28
2024-06-18try implementing suggestionsOneirical-3/+5
2024-06-18run_make_support nm implementation + bin-emit-no-symbols rmake rewriteOneirical-10/+67
2024-06-18rewrite allocator-shim-circular-deps to ui testOneirical-14/+17
2024-06-18Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwcobors-915/+773
Replace all `&DiagCtxt` with a `DiagCtxtHandle<'_>` wrapper type r? `@davidtwco` This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle Basically I will add a field to the `DiagCtxtHandle` that refers back to the `InferCtxt`'s (and others) `Option<ErrorHandled>`, allowing us to immediately taint these contexts when emitting an error and not needing manual tainting anymore (which is easy to forget and we don't do in general anyway)
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-542/+361
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-328/+363
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Test that opaque types can't have themselves as a hidden type with ↵Oli Scherer-0/+95
incompatible lifetimes
2024-06-18Replace `move||` with `move ||` in `compiler/` and `library/`Vonr-18/+18
Edit from #126631 to revert changes on ui tests
2024-06-18Fix transmute goalMichael Goulet-39/+59
2024-06-18Explicitly import tracing macrosMichael Goulet-7/+14
2024-06-18Fix impl for SolverDelegateMichael Goulet-85/+385
2024-06-18Uplift the new trait solverMichael Goulet-1443/+2000
2024-06-18SolverDelegateMichael Goulet-310/+363
2024-06-18Uplift PredefinedOpaquesDataMichael Goulet-12/+22
2024-06-18Make SearchGraph fully genericMichael Goulet-95/+149
2024-06-18Auto merge of #126630 - GuillaumeGomez:rollup-hlwbpa2, r=GuillaumeGomezbors-88/+992
Rollup of 5 pull requests Successful merges: - #125988 (Migrate `run-make/used` to `rmake.rs`) - #126500 (Migrate `error-found-staticlib-instead-crate`, `output-filename-conflicts-with-directory`, `output-filename-overwrites-input`, `native-link-modifier-verbatim-rustc` and `native-link-verbatim-linker` `run-make` tests to `rmake.rs` format) - #126583 (interpret: better error when we ran out of memory) - #126587 (coverage: Add debugging flag `-Zcoverage-options=no-mir-spans`) - #126621 (More thorough status-quo tests for `#[coverage(..)]`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-18Prefer `dcx` methods over fields or fields' methodsOli Scherer-58/+62
2024-06-18Use a more precise lifetimeOli Scherer-4/+4
2024-06-18Rollup merge of #126621 - Zalathar:test-coverage-attr, r=petrochenkovGuillaume Gomez-0/+604
More thorough status-quo tests for `#[coverage(..)]` In light of the stabilization push at https://github.com/rust-lang/rust/issues/84605#issuecomment-2166514660, I have written some tests to more thoroughly capture the current behaviour of the `#[coverage(..)]` attribute. These tests aim to capture the *current* behaviour, which is not necessarily the desired behaviour. For example, some of the error message are not great, some things that perhaps ought to cause an error do not, and recursive coverage attributes have not been implemented yet. `@rustbot` label +A-code-coverage
2024-06-18Rollup merge of #126587 - Zalathar:no-mir-spans, r=oli-obkGuillaume Gomez-20/+234
coverage: Add debugging flag `-Zcoverage-options=no-mir-spans` When set, this flag skips the code that normally extracts coverage spans from MIR statements and terminators. That sometimes makes it easier to debug branch coverage and MC/DC coverage instrumentation, because the coverage output is less noisy. For internal debugging only. If future code changes would make it hard to keep supporting this flag, it should be removed at that time. `@rustbot` label +A-code-coverage
2024-06-18Rollup merge of #126583 - RalfJung:interpret-oom, r=saethlinGuillaume Gomez-2/+5
interpret: better error when we ran out of memory
2024-06-18Rollup merge of #126500 - Oneirical:test-for-the-holy-grail, r=jieyouxuGuillaume Gomez-58/+134
Migrate `error-found-staticlib-instead-crate`, `output-filename-conflicts-with-directory`, `output-filename-overwrites-input`, `native-link-modifier-verbatim-rustc` and `native-link-verbatim-linker` `run-make` tests to `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-06-18Rollup merge of #125988 - GuillaumeGomez:migrate-run-make-used, r=jieyouxuGuillaume Gomez-8/+15
Migrate `run-make/used` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-06-18Auto merge of #126437 - Oneirical:test-we-forget, r=jieyouxubors-44/+109
Migrate `issue-64153`, `invalid-staticlib` and `no-builtins-lto` `run-make` tests to `rmake` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc
2024-06-18Add more thorough coverage tests for `#[coverage(..)]` in nested functionsZalathar-0/+468
These tests reflect the current implementation behaviour, which is not necessarily the desired behaviour.
2024-06-18Add a more thorough test of incorrect/unusal `#[coverage(..)]` syntaxZalathar-0/+136
This test reflects the current implementation behaviour, which is not necessarily the desired behaviour.
2024-06-18Create `tests/ui/coverage-attr/`Zalathar-0/+0
2024-06-18Auto merge of #126049 - compiler-errors:rework-use, r=oli-obkbors-574/+628
Rework `feature(precise_capturing)` to represent `use<...>` as a syntactical bound Reworks `precise_capturing` for a recent lang-team consensus. Specifically: > The conclusion of the team is that we'll make use<..> a bound. That is, we'll support impl use<..> + Trait, impl Trait + use<..>, etc. > For now, we will support at most one such bound in a list of bounds, and semantically we'll only support these bounds in the item bounds of RPIT-like impl Trait opaque types (i.e., in the places discussed in the RFC). Lang decision in favor of this approach: - https://github.com/rust-lang/rust/issues/125836#issuecomment-2151351849 Tracking: - https://github.com/rust-lang/rust/issues/123432