Commit graph

284228 commits

Author SHA1 Message Date
bit-aloo
1954494ec9
change config.toml to bootstrap.toml for bootstrap module 2025-03-17 12:56:41 +05:30
bors
10bcdad7df Auto merge of #138583 - jhpratt:rollup-h699hty, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - #136293 (document capacity for ZST as example)
 - #136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - #136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - #138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - #138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-17 03:45:06 +00:00
Jacob Pratt
5144055055
Rollup merge of #138573 - Noratrieb:no-unsound-bad-bonk-bonk, r=workingjubilee
Make `_Unwind_Action` a type alias, not enum

It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.

I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi
a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D)

fixes #138558

r? workingjubilee have fun
2025-03-16 21:47:45 -04:00
Jacob Pratt
6da26f7cfe
Rollup merge of #138552 - jieyouxu:print-request-cleanups, r=Urgau
Misc print request handling cleanups + a centralized test for print request stability gating

I was working on implementing `--print=supported-crate-types`, then I noticed some things that were mildly annoying me, so I pulled out these changes. In this PR:

- First commit adds a centralized test `tests/ui/print/stability.rs` that is responsible for exercising stability gating of the print requests.
    - AFAICT we didn't have any test that systematically checks this.
    - I coalesced `tests/ui/feature-gates/feature-gate-print-check-cfg.rs` (for `--print=check-cfg`) into this test too, since `--print=check-cfg` is only `-Z unstable-options`-gated like other unstable print requests, and is not additionally feature-gated. cc ``@Urgau`` in case you have any concerns.
- Second commit alphabetically sorts the `PrintKind` enum for consistency because the `PRINT_KINDS` list (using the enum) is *already* alphabetically sorted.
- Third commit pulls out two helpers:
    1. A helper `check_print_request_stability` for checking stability of print requests and the diagnostics for using unstable print requests without `-Z unstable-options`, to avoid repeating the same logic over and over.
    2. A helper `emit_unknown_print_request_help` for the unknown print request diagnostics to make print request collection control flow more obvious.
- Fourth commit renames `PrintKind::{TargetSpec,AllTargetSpecs}` to `PrintKind::{TargetSpecJson,AllTargetSpecsJson}` to better reflect their actual print names, `--print={target-spec-json,all-target-specs-json}`.

r? ``@nnethercote`` (or compiler/reroll)
2025-03-16 21:47:44 -04:00
Jacob Pratt
04032ab233
Rollup merge of #136816 - yotamofek:pr/notable-traits-button-cleanup, r=aDotInTheVoid
refactor `notable_traits_button` to use iterator combinators  instead of for loop

~Small cleanup.
Use `Iterator::any` instead of `for` loop with `predicate = true;`.
I think this makes the code more readable... and also has the additional benefit of short-circuiting the iterator when a notable trait is found (a `break` statement was missing in the `for` loop version, I think). Probably won't be significant enough to show on perf results, though.~

Three commits, each attempting to optimize `notable_trait_buttons` by a little bit.
2025-03-16 21:47:43 -04:00
Jacob Pratt
feb6cb4132
Rollup merge of #136359 - hkBst:ptr_copy_docs, r=Amanieu
doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove

Fixes #79430
2025-03-16 21:47:42 -04:00
Jacob Pratt
c7700406f4
Rollup merge of #136293 - hkBst:patch-32, r=Amanieu
document capacity for ZST as example

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes #80747
2025-03-16 21:47:42 -04:00
bors
c3dd4eefd6 Auto merge of #138363 - beetrees:f16-f128-integer-convert, r=Amanieu
Add `From<{integer}>` for `f16`/`f128` impls

This PR adds `impl From<{bool,i8,u8}> for f16` and `impl From<{bool,i8,u8,i16,u16,i32,u32}> for f128`.

The `From<{i64,u64}> for f128` impls are left commented out as adding them would allow using `f128` on stable before it is stabilised like in the following example:
```rust
fn f<T: From<u64>>(x: T) -> T { x }

fn main() {
    let x = f(1.0); // the type of the literal is inferred to be `f128`
}
```
None of the impls added in this PR have this issue as they are all, at minimum, also implemented by `f64`.

This PR will need a crater run for the `From<{i32,u32}>` impls, as `f64` is no longer the only float type to implement them (similar to the cause of #125198).

cc `@bjoernager`
r? `@tgross35`

Tracking issue: #116909
2025-03-17 00:33:36 +00:00
Noratrieb
f20a6c70fb make _Unwind_Action a type alias, not enum
It's bitflags in practice, so an enum is unsound, as an enum must only
have the described values. The x86_64 psABI declares it as a `typedef
int _Unwind_Action`, which seems reasonable. I made a newtype first but
that was more annoying than just a typedef. We don't really use this
value for much other than a short check.
2025-03-16 21:32:41 +01:00
bors
227690a258 Auto merge of #137011 - LuuuXXX:promote-ohos-with-host-tools, r=Amanieu
Promote ohos targets to tier2 with host tools.

### What does this PR try to resolve?

Try to promote the following [[Tier 2 without Host Tools](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-without-host-tools)](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-without-host-tools) targets to [[Tier 2 with Host Tools](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-with-host-tools)](https://doc.rust-lang.org/rustc/platform-support.html#tier-2-with-host-tools):

- `aarch64-unknown-linux-ohos`
- `armv7-unknown-linux-ohos`
- `x86_64-unknown-linux-ohos`

### More Information?

see MCP: https://github.com/rust-lang/compiler-team/issues/811

### Blockage to be solved?

- [x] Submit an MCP
- [x] Submit code of promote ohos targets
- [x] Resolve related dependencies (`measureme`)

The modified code of the measureme has been merged (see https://github.com/rust-lang/measureme/pull/238). [done]
The new version will was released (https://github.com/rust-lang/measureme/pull/240). [done]
2025-03-16 18:42:18 +00:00
bors
8b87fefd76 Auto merge of #138537 - yotamofek:pr/lib/multi-char-pattern, r=jhpratt
Optimize multi-char string patterns

Uses specialization for `[T]::contains` from #130991 to optimize multi-char patterns in string searches.
Requesting a perf run to see if this actually has an effect 🙏
(I think that adding `char` to the list of types for which the `SliceContains` is specialized is a good idea, even if it doesn't show up on perf - might be helpful for downstream users)
2025-03-16 14:23:18 +00:00
Jieyou Xu
24edbfbc24
Rename PrintKind::{AllTargetSpecs,TargetSpec} to {AllTargetSpecsJson,TargetSpecJson}
To correspond to their actual print request names, `target-spec-json`
and `all-target-specs-json`, and for consistency with other print name
<-> print kind mappings.
2025-03-16 21:56:02 +08:00
Jieyou Xu
f9eabc28d9
Extract print request stability gating and unknown print request help into helpers
To avoid duplicating stability check logic and make the print request
collection logic more straightforward.
2025-03-16 21:56:02 +08:00
Jieyou Xu
5f8e0920f9
Alphabetically sort PrintKind and enforce with tidy 2025-03-16 21:56:02 +08:00
Jieyou Xu
ab7fb0d483
Add a centralized test for print request stability gating
I can't find any dedicated tests that actually exercises the stability
gating (via `-Z unstable-options`) of print requests, so here's a
dedicated one.

I coalesced `tests/ui/feature-gates/feature-gate-print-check-cfg.rs`
into this test, because AFAICT that print request is not feature gated,
but only `-Z unstable-options`-gated just like other unstable print
requests.
2025-03-16 21:56:01 +08:00
bors
d497e43a16 Auto merge of #138551 - jieyouxu:rollup-ttktelm, r=jieyouxu
Rollup of 4 pull requests

Successful merges:

 - #135080 (core: Make `Debug` impl of raw pointers print metadata if present)
 - #137492 (libstd: rustdoc: correct note on fds 0/1/2 pre-main)
 - #137538 (fix doc path in std::fmt macro)
 - #138549 (Fix the OperandRef type for NullOp::{UbChecks,ContractChecks})

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-16 11:15:56 +00:00
许杰友 Jieyou Xu (Joe)
e714c3be9f
Rollup merge of #138549 - scottmcm:option-ssa, r=saethlin
Fix the OperandRef type for NullOp::{UbChecks,ContractChecks}

Stumbled on this while looking at something totally unrelated 🙃

r? saethlin
2025-03-16 13:19:53 +08:00
许杰友 Jieyou Xu (Joe)
c29a29e717
Rollup merge of #137538 - tapanprakasht:fix-doc-path, r=thomcc
fix doc path in std::fmt macro

fixes https://github.com/rust-lang/rust/issues/137519
2025-03-16 13:19:52 +08:00
许杰友 Jieyou Xu (Joe)
26dea1d944
Rollup merge of #137492 - nabijaczleweli:master, r=thomcc
libstd: rustdoc: correct note on fds 0/1/2 pre-main

Closes: #137490
2025-03-16 13:19:52 +08:00
许杰友 Jieyou Xu (Joe)
a23a93cb4e
Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc
core: Make `Debug` impl of raw pointers print metadata if present

Make Rust pointers appear less magic by including metadata information in their `Debug` output.

This does not break Rust stability guarantees because `Debug` impl are explicitly exempted from stability:
https://doc.rust-lang.org/std/fmt/trait.Debug.html#stability

> ## Stability
>
> Derived `Debug` formats are not stable, and so may change with future Rust versions. Additionally, `Debug` implementations of types provided by the standard library (`std`, `core`, `alloc`, etc.) are not stable, and may also change with future Rust versions.

Note that a regression test is added as a separate commit to make it clear what impact the last commit has on the output.

Closes #128684 because the output of that code now becomes:

```
thread 'main' panicked at src/main.rs:5:5:
assertion `left == right` failed
  left: Pointer { addr: 0x7ffd45c6fc6b, metadata: 5 }
 right: Pointer { addr: 0x7ffd45c6fc6b, metadata: 3 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2025-03-16 13:19:51 +08:00
bors
5f3b84a421 Auto merge of #137278 - heiseish:101210-extra-codegen-tests, r=scottmcm
added some new test to check for result and options opt

Apologies for the delay. Finally have some time to get back into contributing.

## Context
- Added some tests to show optimization on result and options for 64 and 128 bits
- Relevant issue https://github.com/rust-lang/rust/issues/101210

## Some newb questions from me
- [x] My local llvm IR has `nuw` in `result_nop_match_128` etc whereas [godbolt version](https://rust.godbolt.org/z/Td9zoT5zn) doesn't have. So I put optional there, but not sure if it's desirable (maybe I'm not using the compiled llvm in the repo). I ran the test with
```bash
./x test tests/codegen/try_question_mark_nop.rs
```
- [x] Unless I'm reading it wrongly, but `option_nop_match_128` and `option_nop_traits_128` look to be **not** optimized away?

Update:
Here's the test for future reference
```rust
// CHECK-LABEL: `@option_nop_match_128`
#[no_mangle]
pub fn option_nop_match_128(x: Option<i128>) -> Option<i128> {
    // CHECK: start:
    // CHECK-NEXT: %trunc = trunc nuw i128 %0 to i1
    // CHECK-NEXT: br i1 %trunc, label %bb3, label %bb4
    // CHECK: bb3:
    // CHECK-NEXT: %2 = getelementptr inbounds {{(nuw )?}}i8, ptr %_0, i64 16
    // CHECK-NEXT: store i128 %1, ptr %2, align 16
    // CHECK: bb4:
    // CHECK-NEXT: %storemerge = phi i128 [ 1, %bb3 ], [ 0, %start ]
    // CHECK-NEXT: store i128 %storemerge, ptr %_0, align 16
    // CHECK-NEXT: ret void
    match x {
        Some(x) => Some(x),
        None => None,
    }
}
```

r? `@scottmcm`
2025-03-16 05:17:07 +00:00
Scott McMurray
3d42541313 Fix the OperandRef type for NullOp::{UbChecks,ContractChecks} 2025-03-15 19:39:15 -07:00
bors
66678e6822 Auto merge of #138548 - jieyouxu:rollup-xpslct5, r=jieyouxu
Rollup of 16 pull requests

Successful merges:

 - #133055 (Expand `CloneToUninit` documentation.)
 - #137147 (Add exclude to config.toml)
 - #137864 (Don't drop `Rvalue::WrapUnsafeBinder` during GVN)
 - #137890 (doc: clarify that consume can be called after BufReader::peek)
 - #137956 (Add RTN support to rustdoc)
 - #137968 (Properly escape regexes in Python scripts)
 - #138082 (Remove `#[cfg(not(test))]` gates in `core`)
 - #138275 (expose `is_s390x_feature_detected!` from `std::arch`)
 - #138303 (Fix Ptr inconsistency in {Rc,Arc})
 - #138309 (Add missing doc for intrinsic (Fix PR135334))
 - #138323 (Expand and organize `offset_of!` documentation.)
 - #138329 (debug-assert that the size_hint is well-formed in `collect`)
 - #138465 (linkchecker: bump html5ever)
 - #138471 (Clean up some tests in tests/ui)
 - #138472 (Add codegen test for #129795)
 - #138484 (Use lit span when suggesting suffix lit cast)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-16 02:02:45 +00:00
许杰友 Jieyou Xu (Joe)
f4372f5d12
Rollup merge of #138484 - xizheyin:issue-138392, r=compiler-errors
Use lit span when suggesting suffix lit cast

Fixes #138392
2025-03-16 09:40:10 +08:00
许杰友 Jieyou Xu (Joe)
c05a643ca8
Rollup merge of #138472 - KonaeAkira:master, r=Mark-Simulacrum
Add codegen test for #129795

Adds test for #129795.

Min LLVM version is 20 because the optimization only happens since LLVM 20.
2025-03-16 09:40:09 +08:00
许杰友 Jieyou Xu (Joe)
7c1555cb9b
Rollup merge of #138471 - spencer3035:move-ui-test-1ofn, r=jieyouxu
Clean up some tests in tests/ui

I cleaned up 3 top level tests, keeping the changes minor because it is my first PR and wanted to get feedback before doing more changes/PRs.

Tracking issues:
https://github.com/rust-lang/rust/issues/73494
https://github.com/rust-lang/rust/issues/133895

r? jieyouxu
2025-03-16 09:40:08 +08:00
许杰友 Jieyou Xu (Joe)
e42f33970c
Rollup merge of #138465 - klensy:linkchecker-b, r=Mark-Simulacrum
linkchecker: bump html5ever

Bumping html5ever to 0.28 required small refactoring, see https://github.com/servo/html5ever/pull/548
2025-03-16 09:40:08 +08:00
许杰友 Jieyou Xu (Joe)
01bc95417c
Rollup merge of #138329 - scottmcm:assert-hint, r=Mark-Simulacrum
debug-assert that the size_hint is well-formed in `collect`

Closes #137919

In the hopes of helping to catch any future accidentally-incorrect rustc or stdlib iterators (like the ones #137908 accidentally found), this has `Iterator::collect` call `size_hint` and check its `low` doesn't exceed its `Some(high)`.

There's of course a bazillion more places this *could* be checked, but the hope is that this one is a good tradeoff of being likely to catch lots of things while having minimal maintenance cost (especially compared to putting it in *every* container's `from_iter`).
2025-03-16 09:40:07 +08:00
许杰友 Jieyou Xu (Joe)
5b9225070c
Rollup merge of #138323 - kpreid:offset-of-doc, r=Mark-Simulacrum
Expand and organize `offset_of!` documentation.

* Give example of how to get the offset of an unsized tail field (prompted by discussion <https://github.com/rust-lang/rust/pull/133055#discussion_r1986422206>).
* Specify the return type.
* Add section headings.
* Reduce “Visibility is respected…”, to a single sentence.
* Move `offset_of_enum` documentation to unstable book (with link to it).
* Add `offset_of_slice` documentation in unstable book.

r? Mark-Simulacrum
2025-03-16 09:40:07 +08:00
许杰友 Jieyou Xu (Joe)
413600c2de
Rollup merge of #138309 - DiuDiu777:intrinsic-doc-fix, r=thomcc
Add missing doc for intrinsic (Fix PR135334)

The previous [PR135334](https://github.com/rust-lang/rust/pull/135334) mentioned that some of the intrinsic APIs were missing safety descriptions.

Among intrinsic APIs that miss safety specifications, most are related to numerical operations. They might need to be discussed and then seen how to organize.

Apart from them, only a few intrinsics lack safety. So this PR deals with the APIs with non-numerical operations in priority.
2025-03-16 09:40:06 +08:00
许杰友 Jieyou Xu (Joe)
7112951caa
Rollup merge of #138303 - DiuDiu777:rc-fix, r=Mark-Simulacrum
Fix Ptr inconsistency in {Rc,Arc}

### PR Description
This pr aims to address the problem discussed on [zulip](504259637).

### Problem Clarification
As this post presents, the `{Rc, Arc}::{in/de-crement_strong_count_/in}` do not limit the layout of the memory that `ptr` points to, while internally `Rc::from_raw_in` is called directly.

UB doesn't just appear when the strong count is decremented to zero. Miri also detects the UB of `out-of-bounds pointer use` when increment strong count is called on a pointer with an incorrect layout(shown as below).

```rust
use std::rc::Rc;
#[repr(align(8))]
struct Aligned8(u64);

#[repr(align(16))]
struct Aligned16(u64);

fn main() {
    let rc: Rc<Aligned8> = Rc::new(Aligned8(42));
    let raw_ptr = Rc::into_raw(rc);

    unsafe {
        Rc::increment_strong_count(raw_ptr as *const Aligned16);
    }
}
```

Miri output:
```
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to 32 bytes of memory, but got alloc954 which is only 24 bytes from the end of the allocation
```
2025-03-16 09:40:06 +08:00
许杰友 Jieyou Xu (Joe)
8210b84aaf
Rollup merge of #138275 - folkertdev:expose-is-s390x-feature-detected, r=Mark-Simulacrum
expose `is_s390x_feature_detected!` from `std::arch`

tracking issue: https://github.com/rust-lang/rust/issues/135413
implementation: https://github.com/rust-lang/stdarch/pull/1699 (more features added in https://github.com/rust-lang/stdarch/pull/1720)

This macro was part of the recent `stdarch` synchronization, but not yet exposed via `std::arch`.

r? libs
2025-03-16 09:40:05 +08:00
许杰友 Jieyou Xu (Joe)
e0846806db
Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc
Remove `#[cfg(not(test))]` gates in `core`

These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-16 09:40:05 +08:00
许杰友 Jieyou Xu (Joe)
199e714a66
Rollup merge of #137968 - dingxiangfei2009:patch-1, r=Mark-Simulacrum
Properly escape regexes in Python scripts

According to the [Python 3.12 release note](https://docs.python.org/3/whatsnew/3.12.html#other-language-changes) string literals containing typical invalid escape sequences like `"\d"` are now rejected. There seems to remain only two instances of escape sequences in regex. This change will allow us to work with newer Python interpreter.
2025-03-16 09:40:04 +08:00
许杰友 Jieyou Xu (Joe)
8882dac342
Rollup merge of #137956 - compiler-errors:rtn-rustdoc, r=fmease
Add RTN support to rustdoc

This adds support to rustdoc and rustdoc-json for rendering `(..)` RTN (return type notation) style generics.

---

Cleaning `rustc_middle::ty::Ty` is not correct still, though, and ends up rendering a function like:

```rust
pub fn foreign<T: Foreign<bar(..): Send>>()
where
    <T as Foreign>::bar(..): 'static,
    T::bar(..): Sync,
```

Into this:

```rust
pub fn foreign<T>()
where
    T: Foreign,
    impl Future<Output = ()>: Send + 'static + Sync,
```

This is because `clean_middle_ty` doesn't actually have sufficient context about whether the RPITIT is in its "defining scope" or not, so we don't know if the type was originally written like `-> impl Trait` or with RTN like `T::method(..)`.

Partially addresses #123996 (i.e., HIR side, not middle::ty one)
2025-03-16 09:40:04 +08:00
许杰友 Jieyou Xu (Joe)
f16ce2ae6c
Rollup merge of #137890 - lolbinarycat:docs-bufreader-peek-consume, r=Mark-Simulacrum
doc: clarify that consume can be called after BufReader::peek

tracking issue #128405
2025-03-16 09:40:03 +08:00
许杰友 Jieyou Xu (Joe)
903b526e32
Rollup merge of #137864 - compiler-errors:unsafe-binder-gvn, r=oli-obk
Don't drop `Rvalue::WrapUnsafeBinder` during GVN

...and instead use `Value::WrapUnsafeBinder` to properly propagate consts through `wrap_binder!()` in GVN.

Fixes #137846

r? oli-obk
2025-03-16 09:40:03 +08:00
许杰友 Jieyou Xu (Joe)
b8c51f4e17
Rollup merge of #137147 - Shourya742:2025-02-16-support-exclude-in-config.toml, r=onur-ozkan
Add exclude to config.toml

Closes: https://github.com/rust-lang/rust/issues/35678

r? `@onur-ozkan`

try-job: x86_64-msvc-2
2025-03-16 09:40:02 +08:00
许杰友 Jieyou Xu (Joe)
4946818306
Rollup merge of #133055 - kpreid:clone-uninit-doc, r=Mark-Simulacrum
Expand `CloneToUninit` documentation.

* Clarify relationship to `dyn` after #133003.
* Add an example of using it with `dyn` as #133003 enabled.
* Replace parameter name `dst` with `dest` to avoid confusion between abbreviations for “DeSTination” and “Dynamically-Sized Type”.
* Add an example of implementing it.
* Add links to Rust Reference for the mentioned concepts.
* Mention that its method should rarely be called.
* Various small corrections.

Please review the `unsafe` code closely, as I am not an expert in the best possible ways to express these operations. (It might also be better to omit the implementation example entirely.)

cc `@zachs18` #126799
2025-03-16 09:40:01 +08:00
bors
9f274ba399 Auto merge of #137665 - Kobzol:update-sccache, r=marcoieni
Update sccache to 0.10.0

This time, does it also for Windows and macOS. This unifies the sccache version across all OSes that we use.

r? `@ghost`

try-job: dist-aarch64-apple
try-job: dist-x86_64-apple
try-job: dist-x86_64-msvc
try-job: dist-x86_64-msvc-alt
try-job: dist-i686-msvc
try-job: dist-aarch64-msvc
try-job: dist-x86_64-linux
try-job: dist-x86_64-netbsd
2025-03-15 20:13:16 +00:00
Michael Goulet
e3ac1fa81a Add RTN support to rustdoc 2025-03-15 18:13:27 +00:00
Michael Goulet
13134dd096 Don't drop Rvalue::WrapUnsafeBinder during GVN 2025-03-15 18:10:55 +00:00
Spencer
27077b94c2 improves duplicate lang item test 2025-03-15 10:52:08 -06:00
Spencer
62075593a8 improves duplicate label test 2025-03-15 10:52:07 -06:00
Spencer
9f06585c0e improves outer mod attribute test 2025-03-15 10:52:07 -06:00
Yotam Ofek
bfe536342f Optimize multi-char string patterns 2025-03-15 14:14:25 +00:00
Yotam Ofek
9d9bac0e96 refactor notable_traits_button to use iterator combinators instead of for loop 2025-03-15 13:54:20 +00:00
bors
4d30011f6c Auto merge of #138532 - matthiaskrgr:rollup-mgcynqu, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #138283 (Enforce type of const param correctly in MIR typeck)
 - #138439 (feat: check ARG_MAX on Unix platforms)
 - #138502 (resolve: Avoid some unstable iteration)
 - #138514 (Remove fake borrows of refs that are converted into non-refs in `MakeByMoveBody`)
 - #138524 (Mark myself as unavailable for reviews temporarily)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-15 11:40:17 +00:00
Matthias Krüger
35aa49dead
Rollup merge of #138524 - jieyouxu:vac, r=jieyouxu
Mark myself as unavailable for reviews temporarily

Medical.
r? `@ghost`
2025-03-15 11:29:28 +01:00
Matthias Krüger
81ba55746d
Rollup merge of #138514 - compiler-errors:fake-borrow-ref-to-value, r=oli-obk
Remove fake borrows of refs that are converted into non-refs in `MakeByMoveBody`

Remove fake borrows of closure captures if that capture has been replaced with a by-move version of that capture.

For example, given an async closure that looks like:

```
let f: Foo;
let c = async move || {
    match f { ... }
};
```

... in this pair of coroutine-closure + coroutine, we capture `Foo` in the parent and `&Foo` in the child. We will emit two fake borrows like:

```
_2 = &fake shallow (*(_1.0: &Foo));
_3 = &fake shallow (_1.0: &Foo);
```

However, since the by-move-body transform is responsible for replacing `_1.0: &Foo` with `_1.0: Foo` (since the `AsyncFnOnce` coroutine will own `Foo` by value), that makes the second fake borrow obsolete since we never have an upvar of type `&Foo`, and we should replace it with a `nop`.

As a side-note, we don't actually even care about fake borrows here at all since they're fully a MIR borrowck artifact, and we don't need to borrowck by-move MIR bodies. But it's best to preserve as much as we can between these two bodies :)

Fixes #138501

r? oli-obk
2025-03-15 11:29:27 +01:00