Commit Graph

283332 Commits

Author SHA1 Message Date
Nicholas Nethercote
beba32cebb Specify rust lints for compiler/ crates via Cargo.
By naming them in `[workspace.lints.rust]` in the top-level
`Cargo.toml`, and then making all `compiler/` crates inherit them with
`[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`,
because they're a bit different.)

The advantages of this over the current approach:
- It uses a standard Cargo feature, rather than special handling in
  bootstrap. So, easier to understand, and less likely to get
  accidentally broken in the future.
- It works for proc macro crates.

It's a shame it doesn't work for rustc-specific lints, as the comments
explain.
2025-03-08 08:41:09 +11:00
Nicholas Nethercote
a8eeb4b53b Remove [lints.rust] section from rustc_builtin_macros.
`llvm_enzyme` is now in the extra `check-cfg` list in bootstrap, so it
doesn't need to be handled explicitly here.
2025-03-08 08:38:49 +11:00
Nicholas Nethercote
8af0aa25c3 Remove [lints.rust] section from rustc_type_ir.
It was added in #129523 to enable building on stable when there were
`cfg(bootstrap)` occurrences in the crate. But those are gone now, so
the section can be removed.
2025-03-08 08:38:28 +11:00
bors
98a48781fe Auto merge of #138114 - compiler-errors:rollup-7xr4b69, r=compiler-errors
Rollup of 25 pull requests

Successful merges:

 - #135733 (Implement `&pin const self` and `&pin mut self` sugars)
 - #135895 (Document workings of successors more clearly)
 - #136922 (Pattern types: Avoid having to handle an Option for range ends in the type system or the HIR)
 - #137303 (Remove `MaybeForgetReturn` suggestion)
 - #137327 (Undeprecate env::home_dir)
 - #137358 (Match Ergonomics 2024: add context and examples to the unstable book)
 - #137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden))
 - #137565 (Try to point of macro expansion from resolver and method errors if it involves macro var)
 - #137637 (Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck)
 - #137643 (Add DWARF test case for non-C-like `repr128` enums)
 - #137744 (Re-add `Clone`-derive on `Thir`)
 - #137758 (fix usage of ty decl macro fragments in attributes)
 - #137764 (Ensure that negative auto impls are always applicable)
 - #137772 (Fix char count in `Display` for `ByteStr`)
 - #137798 (ci: use ubuntu 24 on arm large runner)
 - #137802 (miri native-call support: all previously exposed provenance is accessible to the callee)
 - #137805 (adjust Layout debug printing to match the internal field name)
 - #137808 (Do not require that unsafe fields lack drop glue)
 - #137820 (Clarify why InhabitedPredicate::instantiate_opt exists)
 - #137825 (Provide more context on resolve error caused from incorrect RTN)
 - #137834 (rustc_fluent_macro: use CARGO_CRATE_NAME instead of CARGO_PKG_NAME)
 - #137868 (Add minimal platform support documentation for powerpc-unknown-linux-gnuspe)
 - #137910 (Improve error message for `AsyncFn` trait failure for RPIT)
 - #137920 (interpret/provenance_map: consistently use range_is_empty)
 - #138038 (Update `compiler-builtins` to 0.1.151)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-06 23:39:38 +00:00
bors
b74da9613a Auto merge of #136831 - ehuss:update-stdarch, r=Amanieu
Update stdarch

Updates stdarch

- core_arch: Add LoongArch basic intrinsics: https://github.com/rust-lang/stdarch/pull/1688
- New ARM intrinsic generator: https://github.com/rust-lang/stdarch/pull/1693
- Fix the bug in CMPINT intrinsics with IMM3=7: https://github.com/rust-lang/stdarch/pull/1694
- Expand feature detection on AArch64 Darwin: https://github.com/rust-lang/stdarch/pull/1695
- Tidying x86 `as_*` functions: https://github.com/rust-lang/stdarch/pull/1696
- Fix typo and prettify comment: https://github.com/rust-lang/stdarch/pull/1697
- add is_s390x_feature_detected: https://github.com/rust-lang/stdarch/pull/1699
- add vec_add for s390x: https://github.com/rust-lang/stdarch/pull/1703
- s390x: add vec_sub, vec_mul, vec_min, vec_max, vec_abs and vec_splats: https://github.com/rust-lang/stdarch/pull/1704
- Fix build and CLI behaviour for stdarch-gen-arm. https://github.com/rust-lang/stdarch/pull/1705
- Fix some test naming, and refactor stdarch-verify in general: https://github.com/rust-lang/stdarch/pull/1707
- Update all stdarch crates to Rust 2024: https://github.com/rust-lang/stdarch/pull/1710
- Add keylocker (kl and widekl) intrinsics and runtime feature detection: https://github.com/rust-lang/stdarch/pull/1706
- S390x vector bitwise operations: https://github.com/rust-lang/stdarch/pull/1709
- Update CI to FreeBSD 13.4: https://github.com/rust-lang/stdarch/pull/1715
- Update wasm sub sat intrinsics for LLVM 20: https://github.com/rust-lang/stdarch/pull/1719
- powerpc: use more target-independent llvm intrinsics (min, max, round, countlz): https://github.com/rust-lang/stdarch/pull/1713
- S390x float rounding: https://github.com/rust-lang/stdarch/pull/1712
- mark riscv intrinsics as safe: https://github.com/rust-lang/stdarch/pull/1717
- change redundant transmutations of sign to cast_unsigned: https://github.com/rust-lang/stdarch/pull/1711
- Fix - AArch64 Big Endian Intrinsics: https://github.com/rust-lang/stdarch/pull/1708
- mark x86 intrinsics as safe: https://github.com/rust-lang/stdarch/pull/1714
- AArch64: Add NEON fp16 intrinsics: https://github.com/rust-lang/stdarch/pull/1726
- wasm: use simd_as for float to integer conversions: https://github.com/rust-lang/stdarch/pull/1724
- nvptx: use simd_fmin and simd_fmax for minnum and maxnum: https://github.com/rust-lang/stdarch/pull/1725
- powerpc: use simd_ceil and simd_floor: https://github.com/rust-lang/stdarch/pull/1723
- Changed altivec.rs to new intrinsic declaration: https://github.com/rust-lang/stdarch/pull/1722
- Remove some allow(unsafe_op_in_unsafe_fn)s and use target_feature 1.1 in examples: https://github.com/rust-lang/stdarch/pull/1727
- fix - neon type signed unsigned conversions: https://github.com/rust-lang/stdarch/pull/1729
- s390x_is_feature_detected!: detect more features: https://github.com/rust-lang/stdarch/pull/1720
- Fix doctests failing due to unused_unsafe: https://github.com/rust-lang/stdarch/pull/1731
- fix compilation on armebv7r-none-eabi: https://github.com/rust-lang/stdarch/pull/1733
- wasm: update for rintf intrinsic rename: https://github.com/rust-lang/stdarch/pull/1721
- powerpc: use the simd_fma intrinsic for vec_madd: https://github.com/rust-lang/stdarch/pull/1734
- powerpc: use llvm.fshl for vec_rl: https://github.com/rust-lang/stdarch/pull/1735
- s390x: add more intrinsics: https://github.com/rust-lang/stdarch/pull/1728
- make _mm256_zero{upper,all} safe: https://github.com/rust-lang/stdarch/pull/1736
- fix unnecessary unsafe error in doctest: https://github.com/rust-lang/stdarch/pull/1739
- Feat - Aarch64 FEAT_FAMINMAX: https://github.com/rust-lang/stdarch/pull/1732
- feat - FEAT_LUT neon instrinsics: https://github.com/rust-lang/stdarch/pull/1741
2025-03-06 20:34:20 +00:00
Eric Huss
a78d1b092c Update stdarch 2025-03-06 11:11:55 -08:00
Michael Goulet
071bc46880
Rollup merge of #138038 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.151

This enables `f16` builtins for loongarch [1] and adds support for Cygwin [2].

[1]: https://github.com/rust-lang/compiler-builtins/pull/770
[2]: https://github.com/rust-lang/compiler-builtins/pull/774

try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
2025-03-06 12:22:29 -05:00
Michael Goulet
d21fc9d4f1
Rollup merge of #137920 - RalfJung:provenance-map-emptiness, r=oli-obk
interpret/provenance_map: consistently use range_is_empty

https://github.com/rust-lang/rust/pull/137704 started using this for per-ptr provenance; let's be consistent and use it also for the per-byte provenance check. Also rename the methods to avoid having both "get" and "is_empty" in the name.

r? ````@oli-obk````
2025-03-06 12:22:27 -05:00
Michael Goulet
1458b3560f
Rollup merge of #137910 - compiler-errors:async-fn-goal-error, r=oli-obk
Improve error message for `AsyncFn` trait failure for RPIT

Use a `WellFormedDerived` obligation cause to make sure we can turn an `AsyncFnKindHelper` trait goal into its parent `AsyncFn*` goal, then fix the logic for reporting `AsyncFn*` kind mismatches.

Best reviewed without whitespace.

Fixes #137905

r? oli-obk
2025-03-06 12:22:25 -05:00
Michael Goulet
38b48203af
Rollup merge of #137868 - taiki-e:powerpcspe-doc, r=workingjubilee
Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per https://github.com/rust-lang/rust/pull/137860#issuecomment-2692358259, add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ```@glaubitz```
cc ```@BKPepe```
r? workingjubilee

```@rustbot``` label +O-PowerPC
2025-03-06 12:22:24 -05:00
Michael Goulet
56f0a60ccb
Rollup merge of #137834 - lolbinarycat:rustc_fluent_macro-137815, r=BoxyUwU
rustc_fluent_macro: use CARGO_CRATE_NAME instead of CARGO_PKG_NAME

fixes #137815
2025-03-06 12:22:22 -05:00
Michael Goulet
484d8dd5b4
Rollup merge of #137825 - estebank:rtn-sugg-2, r=compiler-errors
Provide more context on resolve error caused from incorrect RTN

When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.

```
error[E0575]: expected associated type, found associated function `Trait::method`
  --> $DIR/bad-inputs-and-output.rs:31:36
   |
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
   |
help: you might have meant to use the return type notation syntax
   |
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
   |
```

Built on top of #137824, only second commit is relevant for review.

r? ````````@compiler-errors````````
2025-03-06 12:22:21 -05:00
Michael Goulet
1e3a0388a5
Rollup merge of #137820 - meithecatte:instantiate-opt, r=BoxyUwU
Clarify why InhabitedPredicate::instantiate_opt exists

At first glance, the extra casework seems pointless and needlessly error-prone. Clarify that there is a reason for it being there.
2025-03-06 12:22:20 -05:00
Michael Goulet
1c3733aa69
Rollup merge of #137808 - jswrenn:droppy-unsafe-fields, r=nnethercote
Do not require that unsafe fields lack drop glue

Instead, we adopt the position that introducing an `unsafe` field itself carries a safety invariant: that if you assign an invariant to that field weaker than what the field's destructor requires, you must ensure that field is in a droppable state in your destructor.

See:
- https://github.com/rust-lang/rfcs/pull/3458#discussion_r1971676100
- https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/unsafe.20fields.20RFC/near/502113897

Tracking Issue: #132922
2025-03-06 12:22:19 -05:00
Michael Goulet
73d033f5a1
Rollup merge of #137805 - RalfJung:layout-debug-print, r=Noratrieb
adjust Layout debug printing to match the internal field name

The field got renamed a while ago, but the debug printing was not updated to match.
2025-03-06 12:22:19 -05:00
Michael Goulet
b7b2179b5e
Rollup merge of #137802 - RalfJung:miri-native-call-exposed, r=oli-obk
miri native-call support: all previously exposed provenance is accessible to the callee

When Miri invokes a native C function, the memory C can access needs to be "prepared": to avoid false positives, we need to consider all that memory initialized, and we need to consider it to have arbitrary provenance. So far we did this for all pointers passed to C, but not for pointers that were exposed already before the native call. This PR adjusts the logic so that we now "prepare" all memory that has ever been exposed.

This fixes cases such as:
- cast a pointer to integer, send that integer to C, and access the memory there (`test_pass_ptr_as_int`)
- send a pointer to some memory to C, which stores it somewhere; then in Rust store another pointer in that memory, and access that via C (`test_pass_ptr_via_previously_shared_mem`)

r? `````@oli-obk`````
2025-03-06 12:22:18 -05:00
Michael Goulet
59cd96770b
Rollup merge of #137798 - marcoieni:ubuntu-24-large-runner-arm, r=Kobzol
ci: use ubuntu 24 on arm large runner

try-job: dist-aarch64-linux
2025-03-06 12:22:17 -05:00
Michael Goulet
fe926384c1
Rollup merge of #137772 - thaliaarchi:bstr-display, r=joshtriplett
Fix char count in `Display` for `ByteStr`

`ByteStr as Display` performs a byte count when a char count is required.

r? ```````````@joshtriplett```````````
2025-03-06 12:22:16 -05:00
Michael Goulet
00132141c7
Rollup merge of #137764 - compiler-errors:always-applicable-negative-impl, r=lcnr
Ensure that negative auto impls are always applicable

r? lcnr (or reassign if you dont want to review)

https://github.com/rust-lang/rust/issues/68318#issuecomment-2689265030
2025-03-06 12:22:16 -05:00
Michael Goulet
34d273b4bf
Rollup merge of #137758 - jdonszelmann:fix-137662, r=nnethercote
fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in #137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes #137662
2025-03-06 12:22:15 -05:00
Michael Goulet
91175bd932
Rollup merge of #137744 - skius:master, r=Nadrieril
Re-add `Clone`-derive on `Thir`

This PR adds back `Clone` for `Thir`.

If a tool wants to access a `thir_body` query result in the `Callbacks::after_analysis` hook, it can't do so (I think) without a `Clone` impl on `Thir`, because `check_unsafety` steals the value. With `Clone`, the `thir_body` query provider can be overriden to cache a clone of the `Thir`, circumventing that issue.

Specifically, we need it for https://github.com/rust-corpus/qrates, [here](ca7a230196/extractor/src/lib.rs (L205)).

Please let me know if there are issues with this PR/if there's another way to solve the problem at hand
2025-03-06 12:22:14 -05:00
Michael Goulet
e05a97769b
Rollup merge of #137643 - beetrees:repr128-dwarf-variant-test, r=jieyouxu
Add DWARF test case for non-C-like `repr128` enums

LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future.

Tracking issue: #56071
2025-03-06 12:22:14 -05:00
Michael Goulet
3152f16ada
Rollup merge of #137637 - compiler-errors:dyn-cast-from-dyn-star, r=oli-obk
Check dyn flavor before registering upcast goal on wide pointer cast in MIR typeck

See the comment on the test :)

Fixes #137579
2025-03-06 12:22:13 -05:00
Michael Goulet
aab7b145d0
Rollup merge of #137565 - compiler-errors:macro-ex, r=estebank
Try to point of macro expansion from resolver and method errors if it involves macro var

In the case that a macro caller passes an identifier into a macro generating a path or method expression, point out that identifier in the context of the *macro* so it's a bit more clear how the macro is involved in causing the error.

r? ``````````@estebank`````````` or reassign
2025-03-06 12:22:13 -05:00
Michael Goulet
cc5d90cbad
Rollup merge of #137534 - xizheyin:issue-137342, r=GuillaumeGomez
[rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden)

Part of #137342

![image](https://github.com/user-attachments/assets/68b4649a-a64a-43b2-8a73-6ac92b486e9e)
2025-03-06 12:22:12 -05:00
Michael Goulet
98dfe93e41
Rollup merge of #137358 - dianne:new-match-ergonomics-examples, r=Nadrieril
Match Ergonomics 2024: add context and examples to the unstable book

The examples here are pretty limited and don't illustrate the differences between the two feature gates, but my hope is that they get the general idea across. I can try and add some more nuance or more comprehensive examples too if that would help.

Hopefully the doctest isn't too sneaky. I wanted to make the bindings' types explicit, and the most readable way I could think of was to use a helper.

~~Unfortunately it looks like the "run this code" button doesn't work yet, but I made sure the examples are cross-edition, so that should resolve on its own once playground's nightly updates (or if playground's default becomes edition 2024, or if the edition in the markdown gets forwarded to playground).~~ It looks like the default edition on playground is now 2024, so the run button works! There's no output, but having a button to show that it compiles is nice, I think.

Relevant tracking issue: #123076

r? ``````@Nadrieril``````
2025-03-06 12:22:11 -05:00
Michael Goulet
978893ac40
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
Undeprecate env::home_dir

#132515 fixed the implementation of `env::home_dir`, but didn't remove the deprecation.

Based on [this comment](https://github.com/rust-lang/rust/pull/132515#discussion_r1829715262), libs-api decided to undeprecate in the next release. Let's do that!

cc #132650
2025-03-06 12:22:11 -05:00
Michael Goulet
ca9f615525
Rollup merge of #137303 - compiler-errors:maybe-forgor, r=cjgillot
Remove `MaybeForgetReturn` suggestion

#115196 implemented a suggestion to add a missing `return` when there is an ambiguity error, when that ambiguity error could be constrained by the return type of the function.

I initially reviewed it and thought it could be useful; however, looking back at that code now, I feel like it's a bit too much of a hack to be worth keeping around in typeck, especially given how rare it's expected to fire in practice. This is especially true because it depends on `StashKey::MaybeForgetReturn`, which is only stashed when we have *Sized* obligation ambiguity errors. Let's remove it for now.

I'd like to note that it's basically impossible to get this suggestion to apply in its current state except for what I'd consider somewhat artificial examples, involving no generic trait bounds. For example, it's not triggered for:

```rust
struct W<T>(T);

fn bar<T: Default>() -> W<T> { todo!() }

fn foo() -> W<i32> {
    if true {
        bar();
    }
    W(0)
}
```

Nor is it triggered for:

```
fn foo() -> i32 {
    if true {
        Default::default();
    }
    0
}
```

It's basically only triggered iff there's only one ambiguity error on the type, which is `Sized`.

Generally, suggesting something that affects control flow is a pretty dramatic suggestion; therefore, both the accuracy and precision of this diagnostic should be pretty high.

One other, somewhat unrelated observation is that this might be using stashed diagnostics incorrectly (or at least unnecessarily). Stashed diagnostics are used when error detection is fragmented over several major stages of the compiler, like a parse or resolver error which later can be recovered in typeck. However, this one is a bit different since it is fully handled within typeck -- perhaps that suggests that if this were to be reimplemented, it wouldn't need to be so complicated of an implementation.
2025-03-06 12:22:10 -05:00
Michael Goulet
6ac714d526
Rollup merge of #136922 - oli-obk:pattern-types-option-ends, r=BoxyUwU
Pattern types: Avoid having to handle an Option for range ends in the type system or the HIR

Instead,

1. during hir_ty_lowering, we now generate constants for the min/max when the range doesn't have a start/end specified.
2. in a later commit we generate those constants during ast lowering, simplifying everything further by not having to handle the range end inclusivity anymore in the type system (and thus avoiding any issues of `0..5` being different from `0..=4`

I think it makes all the type system code simpler, and the cost of the extra `ConstKind::Value` processing seems negligible.

r? `@BoxyUwU`

cc `@joshtriplett` `@scottmcm`
2025-03-06 12:22:10 -05:00
Michael Goulet
5b074125e5
Rollup merge of #135895 - hkBst:patch-15, r=joboet
Document workings of successors more clearly

This is an attempt to fix #135087 together with https://github.com/rust-lang/rust/pull/135886, but I am not sure if I've succeeded in adding much clarity here, so don't be shy with your comments.
2025-03-06 12:22:09 -05:00
Michael Goulet
91826b687c
Rollup merge of #135733 - frank-king:feature/pin-self-receiver, r=oli-obk,traviscross
Implement `&pin const self` and `&pin mut self` sugars

This PR implements part of #130494.

It introduces the sugars `&pin const self` and `&pin mut self` for `self: Pin<&Self>` and `self: Pin<&mut Self>`.
2025-03-06 12:22:08 -05:00
bors
e6af292f91 Auto merge of #138039 - onur-ozkan:handle-forced-compiler-on-tools, r=jieyouxu
handle forced compiler and revert #137476

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

I would appreciate it if we could measure CI pipelines with the current changes to see if this reduces recent CI overhead. cc `@rust-lang/infra`

try-job: dist-powerpc64le-linux
2025-03-06 17:20:24 +00:00
Oli Scherer
a2c1211b6d Hide the end of ranges in pretty printing if it's also the maximum of the type 2025-03-06 10:50:23 +00:00
Oli Scherer
e8f7a382be Remove the Option part of range ends in the HIR 2025-03-06 10:47:40 +00:00
Oli Scherer
0e7b283573 Avoid having to handle an Option in the type system 2025-03-06 10:03:11 +00:00
Oli Scherer
4f2b108816 Prefer a two value enum over bool 2025-03-06 10:03:11 +00:00
bors
30f168ef81 Auto merge of #137907 - compiler-errors:inline-fnonce, r=saethlin
Inline `FnOnce`/`FnMut`/`Fn` shims once again

This PR fixes the argument checking for `extern "rust-call"` ABI functions with a spread arg, which do no expect their arguments to be exploded from a tuple like closures do.

Secondly, it removes the hack that prevented them from being inlined. This results in more work done by the compiler, but it does end up allowing us to inline functions we didn't before.

Fixes #137901
2025-03-05 18:39:17 +00:00
bors
07b5eeebc9 Auto merge of #138058 - jieyouxu:rollup-skdt0oz, r=jieyouxu
Rollup of 20 pull requests

Successful merges:

 - #134063 (dec2flt: Clean up float parsing modules)
 - #136581 (Retire the legacy `Makefile`-based `run-make` test infra)
 - #136662 (Count char width at most once in `Formatter::pad`)
 - #136764 (Make `ptr_cast_add_auto_to_object` lint into hard error)
 - #136798 (Added documentation for flushing per #74348)
 - #136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes)
 - #136975 (Look for `python3` first on MacOS, not `py`)
 - #136977 (Upload Datadog metrics with citool)
 - #137240 (Slightly reformat `std::fs::remove_dir_all` error docs)
 - #137298 (Check signature WF when lowering MIR body)
 - #137463 ([illumos] attempt to use posix_spawn to spawn processes)
 - #137477 (uefi: Add Service Binding Protocol abstraction)
 - #137569 (Stabilize `string_extend_from_within`)
 - #137633 (Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack)
 - #137679 (Various coretests improvements)
 - #137723 (Make `rust.description` more general-purpose and pass `CFG_VER_DESCRIPTION`)
 - #137728 (Remove unsizing coercions for tuples)
 - #137731 (Resume one waiter at once in deadlock handler)
 - #137875 (mir_build: Integrate "simplification" steps into match-pair-tree creation)
 - #138028 (compiler: add `ExternAbi::is_rustic_abi`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-05 15:09:49 +00:00
Frank King
50d0f992ac Simplify rewrite_explicit_self 2025-03-05 22:50:50 +08:00
Frank King
52cd8746ba Simplify parse_self_param 2025-03-05 22:50:27 +08:00
Frank King
cb7d687e96 Implement &pin const self and &pin mut self sugars 2025-03-05 22:37:53 +08:00
许杰友 Jieyou Xu (Joe)
fe4c0850fe
Rollup merge of #138028 - workingjubilee:is-rustic-abi, r=compiler-errors
compiler: add `ExternAbi::is_rustic_abi`

Various parts of the compiler were hand-rolling this extremely simple check that is nonetheless easy to get wrong as the compiler evolves over time. Discourage them from being so "original" again by replacing it with a single implementation on the type that represents these ABIs. This simplifies a surprising amount of code as a result.

Also fixes #132981, an ICE that emerged due to other checks being made stricter.
2025-03-05 21:46:46 +08:00
许杰友 Jieyou Xu (Joe)
9d1b2f7fda
Rollup merge of #137875 - Zalathar:irrefutable, r=Nadrieril
mir_build: Integrate "simplification" steps into match-pair-tree creation

The “simplification” step helps to prepare THIR patterns for lowering into MIR, and originally dates back to the earliest days of MIR in the compiler.

Over time, various intermediate data structures have been introduced (e.g. `MatchPair`, later renamed to `MatchPairTree`) that reduce the need for a separate simplification step, because some of the necessary simplifications can be built into the construction of those intermediate structures instead. This PR continues that process to its logical conclusion and removes the simplification step entirely, by integrating its remaining responsibilities into match-pair-tree creation: flattening “irrefutable” nodes, collecting bindings/ascriptions in flat lists, and sorting or-patterns after other subpatterns.

This has a few immediate benefits:
- We can remove `TestCase::Irrefutable`, which was not allowed to exist after simplification, and was much larger than other test-case variants.
- We can make `MatchPairTree::place` non-optional, because only irrefutable nodes could fail to have a place.

In the future, this should also help with some ideas I have for simplifying how `AscribeUserType` and `ExpandedConstant` nodes are handled, by representing them as side-data keyed by THIR pattern ID, so that they are no longer their own kinds of THIR pattern node.
2025-03-05 21:46:45 +08:00
许杰友 Jieyou Xu (Joe)
927c11fcb7
Rollup merge of #137731 - SparrowLii:waiter, r=nnethercote
Resume one waiter at once in deadlock handler

When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing.

This fixes the UI failures in #132051

cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`

Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon)

Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge #132051
UPDATES #129912
UPDATES #120757
UPDATES #129911
2025-03-05 21:46:45 +08:00
许杰友 Jieyou Xu (Joe)
257b4947ed
Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk
Remove unsizing coercions for tuples

See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification.

Tracking issue: #42877
Fixes: #135217
2025-03-05 21:46:44 +08:00
许杰友 Jieyou Xu (Joe)
dac4ffd5c0
Rollup merge of #137723 - onur-ozkan:cfg-ver-description, r=pietroalbini,weihanglo
Make `rust.description` more general-purpose and pass `CFG_VER_DESCRIPTION`

Moves the `description` field from the `rust` section to the `build` section as it can be useful for tools and is not specific to rustc. Also passes this value to tool builds through the `CFG_VER_DESCRIPTION` env.

Motivated from https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Propagate.20rust.2Edescription.20to.20tools.20in.20dist.20build
2025-03-05 21:46:43 +08:00
许杰友 Jieyou Xu (Joe)
4aa61e77ff
Rollup merge of #137679 - bjorn3:coretests_improvements, r=jieyouxu,onur-ozkan
Various coretests improvements

The first commit is not yet strictly necessary as directly testing libcore works though useless work, but will be necessary once https://github.com/rust-lang/rust/pull/136642 migrates the liballoc tests into a separate package. The second commit fixes https://github.com/rust-lang/rust/issues/137478 and ensures that coretests actually gets tested on all CI job. The third commit fixes an error that didn't get caught because coretests doesn't run on the wasm32 CI job.
2025-03-05 21:46:42 +08:00
许杰友 Jieyou Xu (Joe)
6c60abf51a
Rollup merge of #137633 - compiler-errors:no-implied-bounds-hack-unless-bevy, r=lcnr
Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack

Consolidates the implied bounds computation mode into a single function, which deeply normalizes, and if it's in **compat** mode (for bevy), it extracts outlives bounds from the infcx.

Previously, we were using the implied bounds compat mode in two cases:
1. During WF, if it detects `ParamSet`
2. EVERYWHERE ELSE (lol) -- e.g. borrowck, predicate entailment, etc.

While I think this is fine, and the net effect was just that we emitted fewer diagnostics, it makes me uncomfortable that all crates were using the supposed "compat" code.

Fixes #137767
2025-03-05 21:46:42 +08:00
许杰友 Jieyou Xu (Joe)
604d1ba61c
Rollup merge of #137569 - aDotInTheVoid:for-iurii, r=ibraheemdev
Stabilize `string_extend_from_within`

FCP'd here: https://github.com/rust-lang/rust/issues/103806#issuecomment-2674989531.

Closes  #103806.
2025-03-05 21:46:41 +08:00
许杰友 Jieyou Xu (Joe)
24d481cc29
Rollup merge of #137477 - Ayush1325:uefi-service-binding, r=Noratrieb
uefi: Add Service Binding Protocol abstraction

- Some UEFI protocols such as TCP4, TCP6, UDP4, UDP6, etc are managed by service binding protocol.
- A new instance of such protocols is created and destroyed using the corresponding service binding protocol.
- This PR adds abstractions to make using such protocols simpler using Rust Drop trait.
- The reason to add these abstractions in a seperate PR from TCP4 Protocol is to make review easier.

[EFI_SERVICE_BINDING_PROTCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol)

cc ````@nicholasbishop````
2025-03-05 21:46:40 +08:00