304394 Commits

Author SHA1 Message Date
LorrensP-2158466
cfba491e67 fix 2025-08-31 10:03:49 +02:00
bors
64a99db105 Auto merge of #145582 - estebank:issue-107806, r=chenyukang
Detect missing `if let` or `let-else`

During `let` binding parse error and encountering a block, detect if there is a likely missing `if` or `else`:

```
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{`
  --> $DIR/missing-if-let-or-let-else.rs:14:25
   |
LL |     let Some(x) = foo() {
   |                         ^ expected one of `.`, `;`, `?`, `else`, or an operator
   |
help: you might have meant to use `if let`
   |
LL |     if let Some(x) = foo() {
   |     ++
help: alternatively, you might have meant to use `let else`
   |
LL |     let Some(x) = foo() else {
   |                         ++++
```

Fix rust-lang/rust#107806.
2025-08-31 03:00:54 +00:00
bors
cd60c60d9f Auto merge of #146043 - tgross35:rollup-hdumq5v, r=tgross35
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#144964 (std: clarify `OpenOptions` error for create without write access)
 - rust-lang/rust#146030 (Fix `sys::process::windows::tests::test_thread_handle` spurious failure)
 - rust-lang/rust#146035 (Update `browser-ui-test` version to `0.21.3`)
 - rust-lang/rust#146036 (Use move_file for rename in tracing)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-30 23:51:29 +00:00
Trevor Gross
7185ec6056
Rollup merge of #146036 - Mark-Simulacrum:rust-1, r=Kobzol
Use move_file for rename in tracing

This avoids panicking when the source and destination are on different filesystems.
2025-08-30 18:49:50 -05:00
Trevor Gross
226517e55f
Rollup merge of #146035 - GuillaumeGomez:update-browser-ui-test, r=GuillaumeGomez
Update `browser-ui-test` version to `0.21.3`

I cannot test it locally because of this bug:

```
error: couldn't generate documentation: failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8
  |
  = note: failed to create or modify "build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/": failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8
```

So I'll iterate through CI checks I guess.

r? ghost
2025-08-30 18:49:49 -05:00
Trevor Gross
b86c601a71
Rollup merge of #146030 - ChrisDenton:wait-timeout, r=tgross35
Fix `sys::process::windows::tests::test_thread_handle` spurious failure

Instead of sleeping, wait for the process to finish so that we can be sure it's done. We use a timeout because otherwise this test can be stuck indefinitely if it fails (unfortunately std doesn't currently have a way to wait with a timeout so a manual OS API call is necessary).

I also changed the test to run `whoami` and pipe the output to null so that it doesn't clutter up the test output.

Fixes rust-lang/rust#146024
2025-08-30 18:49:49 -05:00
Trevor Gross
9489339118
Rollup merge of #144964 - 0xdeafbeef:fix-open-options, r=ibraheemdev
std: clarify `OpenOptions` error for create without write access

Fixes rust-lang/rust#140621
2025-08-30 18:49:48 -05:00
Esteban Küber
3af81cf0b7 review comment: move Visitor 2025-08-30 18:42:07 +00:00
Chris Denton
3516e25eed
Fix spurious test timeout 2025-08-30 18:07:09 +00:00
bors
523d3999dc Auto merge of #146029 - JonathanBrouwer:incorrect-fixme, r=jdonszelmann
Remove incorrect fixme on deprecation target

This does actually working suprisingly enough, applying deprecation to all methods in the impl block

r? `@jdonszelmann`
2025-08-30 18:04:07 +00:00
Mark Rousskov
2dc57526c2 Use move_file for rename in tracing
This avoids panicking when the source and destinations are on different
filesystems.
2025-08-30 13:20:44 -04:00
Guillaume Gomez
9e8d907807 Update browser-ui-test version to 0.21.3 2025-08-30 17:28:14 +02:00
bors
0f50696801 Auto merge of #145479 - Kmeakin:km/hardcode-char-is-control, r=joboet
Hard-code `char::is_control`

Split off from https://github.com/rust-lang/rust/pull/145219

According to
https://www.unicode.org/policies/stability_policy.html#Property_Value, the set of codepoints in `Cc` will never change. So we can hard-code the patterns to match against instead of using a table.

This doesn't change the generated assembly, since the lookup table is small enough that[ LLVM is able to inline the whole search](https://godbolt.org/z/bG8dM37YG). But this does reduce the chance of regressions if LLVM's heuristics change in the future, and means less generated Rust code checked in to `unicode-data.rs`.
2025-08-30 14:18:21 +00:00
Vladimir Petrzhikovskii
0858b14e25
std: clarify OpenOptions error for create without write access
Previously, attempting to create/truncate a file without write/append access
would result in platform-specific error messages:
 - Unix: "Invalid argument"
 - Windows: raw OS error code 87
These error codes look like system errors, which could waste hours 
of debugging for what is actually an API misuse issue.
2025-08-30 14:59:17 +02:00
Jonathan Brouwer
fcd6f284a1
Remove incorrect FIXME 2025-08-30 13:44:13 +02:00
bors
e95db591a4 Auto merge of #146026 - Zalathar:rollup-urbmv0t, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#143462 (fix(lib-std-fs): handle `usize` overflow in `read*`)
 - rust-lang/rust#144651 (Implementation: `#[feature(nonpoison_condvar)]`)
 - rust-lang/rust#145465 (Stabilize `array_repeat` feature)
 - rust-lang/rust#145776 (Optimize `.ilog({2,10})` to `.ilog{2,10}()`)
 - rust-lang/rust#145969 (Add Duration::from_nanos_u128)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-30 11:08:59 +00:00
Stuart Cook
f655e6a863
Rollup merge of #145969 - actuallylost:duration-from-nanos-128, r=tgross35
Add Duration::from_nanos_u128

Feature Gate: `#![feature(duration_from_nanos_u128)]`
ACP: https://github.com/rust-lang/libs-team/issues/567
Tracking issue: https://github.com/rust-lang/rust/issues/139201
Recreated from https://github.com/rust-lang/rust/pull/139243
2025-08-30 20:29:08 +10:00
Stuart Cook
dfbba07012
Rollup merge of #145776 - ChaiTRex:ilog_specialization, r=joboet
Optimize `.ilog({2,10})` to `.ilog{2,10}()`

Optimize `.ilog({2,10})` to `.ilog{2,10}()`

Inform compiler of optimizations when the base is known at compile time and there's a cheaper method available:

* `{integer}.checked_ilog(2)` -> `{integer}.checked_ilog2()`
* `{integer}.checked_ilog(10)` -> `{integer}.checked_ilog10()`
* `{integer}.ilog(2)` -> `{integer}.ilog2()`
* `{integer}.ilog(10)` -> `{integer}.ilog10()`
2025-08-30 20:29:07 +10:00
Stuart Cook
b5c19e839f
Rollup merge of #145465 - Kivooeo:stabilize-array_repeat, r=joboet
Stabilize `array_repeat` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/126695) and stabilises `array::repeat`
2025-08-30 20:29:06 +10:00
Stuart Cook
eda6dc9283
Rollup merge of #144651 - connortsui20:nonpoison_condvar, r=joboet
Implementation: `#[feature(nonpoison_condvar)]`

Tracking Issue: https://github.com/rust-lang/rust/issues/134645

This PR continues the effort made in https://github.com/rust-lang/rust/pull/144022 by adding the implementation of `nonpoison::condvar`.

Many of the changes here are similar to the changes made to implement `nonpoison::mutex`.

There are two other changes here. The first is that the `Barrier` implementation is migrated to use the `nonpoison::Condvar` instead of the `poison` variant. The second (which might be subject to some discussion) is that `WaitTimeoutResult` is moved up to `mod.rs`, as both `condvar` variants need that type (and I do not know if there is a better place to put it now).

### Related PRs

- `nonpoison_rwlock` implementation: https://github.com/rust-lang/rust/pull/144648
- `nonpoison_once` implementation: https://github.com/rust-lang/rust/pull/144653
2025-08-30 20:29:06 +10:00
Stuart Cook
6421031e57
Rollup merge of #143462 - Rudxain:read_to_string_usize, r=joboet
fix(lib-std-fs): handle `usize` overflow in `read*`

I assume this is a non-breaking change, as there would be an OOM `panic` anyways. This patch ensures a fast-fail when there's not enough memory to load the file. This only changes behavior on platforms where `usize` is smaller than 64bits
2025-08-30 20:29:05 +10:00
bors
846e377215 Auto merge of #123319 - no92:managarm-target, r=davidtwco
Add managarm as a tier 3 target

This PR aims to introduce the `x86_64-unknown-managarm-mlibc` as a tier 3 target to Rust.

[managarm](https://github.com/managarm/managarm) is a microkernel with fully asynchronous I/O that also provides a POSIX server. Despite the differences, managarm provides good compatability with POSIX and Linux APIs. As a rule of thumb, barring OS-specific code, it should be mostly source-compatible with Linux.

We have been shipping a patched rust for over 25 releases now, and we would like to upstream our work. For a smoother process, this PR only adds the target to rustc and some documentation. `std` support will be added in a future PR.

## Addressing the tier 3 target policy

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

`@no92,` `@64` and `@Dennisbonke` will be target maintainers.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.
> - Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.
> - If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

`x86_64-unknown-managarm-mlibc` is what we use for LLVM as well.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.
> - The target must not introduce license incompatibilities.
> - Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).
> - The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.
> - Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.
> - "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

[managarm](https://github.com/managarm/managarm) is licensed as MIT. No dependencies were added.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.
> - This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Understood. None of the listed maintainers are on a Rust team.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

Support for `std` will be provided in a future PR. Only minor changes are required, however they depend on support in the `libc` crate which will be PRed in soon.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

The steps needed to take are described in the documentation provided with this PR.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.
> - Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Understood.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.
> - In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

We have no indication that anything breaks due to this PR.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target.

No problems here, as we target `x86_64`.

r? compiler-team
2025-08-30 07:59:16 +00:00
bors
b53c72ffaa Auto merge of #144494 - scottmcm:min_bigint_helpers, r=Mark-Simulacrum
Partial-stabilize the basics from `bigint_helper_methods`

Direct link to p-FCP comment: https://github.com/rust-lang/rust/pull/144494#issuecomment-3133172161

After libs-api discussion, this is now the following methods:

- [`uN::carrying_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_add): uN + uN + bool -> (uN, bool)
- [`uN::borrowing_sub`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.borrowing_sub): uN + uN + bool -> (uN, bool)
- [`uN::carrying_mul`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul): uN * uN + uN -> (uN, uN)
- [`uN::carrying_mul_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul_add): uN * uN + uN + uN -> (uN, uN)

Specifically, these are the ones that are specifically about working with `uN` as a "digit" (or "limb") where the output, despite being larger than can fit in a single digit, wants to be phrased in terms of those *digits*, not in terms of a wider type.

(This leaves open the possibility of things like `widening_mul: u32 * u32 -> u64` for places where one wants to only think in terms of the *number*s, rather than as carries between multiple digits.  Though of course discussions about how best to phrase such a thing are best for the tracking issue, not for this PR.)

---

**Original PR description**:

A [conversation on IRLO](https://internals.rust-lang.org/t/methods-for-splitting-integers-into-their-halves/23210/7?u=scottmcm) the other day pushed me to write this up 🙂

This PR proposes a partial stabilization of `bigint_helper_methods` (rust-lang/rust#85532), focusing on a basic set that hopefully can be non-controversial.  Specifically:

- [`uN::carrying_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_add): uN + uN + bool -> (uN, bool)
- [`uN::widening_mul`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.widening_mul): uN * uN -> (uN, uN)
- [`uN::carrying_mul_add`](https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.carrying_mul_add): uN * uN + uN + uN -> (uN, uN)

Why these?

- We should let people write Rust without needing to be backend experts to know what the magic incantation is to do this.  Even `carrying_add`, which doesn't seem that complicated, actually broke in 1.82 (see rust-lang/rust#133674) so we should just offer something fit-for-purpose rather than making people keep up with whatever the secret sauce is today.  We also get to do things that users cannot, like have the LLVM version emit operations on `i256` in the implementation of `u128::carrying_mul_add` (https://rust.godbolt.org/z/cjG7eKcxd).
- Unsigned only because the behaviour is much clearer than when signed is involved, as everything is just unsigned (vs questions like whether `iN * iN` should give `(uN, iN)`) and carries can only happen in one direction (vs questions about whether the carry from `-128_u8 + -128_u8` should be considered `-1`).
- `carrying_add` is the core [full adder](https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder) primitive for implementing addition.
- `carrying_mul_add` is the core primitive for [grade school](https://en.wikipedia.org/wiki/Multiplication_algorithm#Long_multiplication) multiplication (see the example in its docs for why both carries are needed).
- `widening_mul` even though it's not strictly needed (its implementation is just `carrying_mul_add(a, b, 0, 0)` right now) as the simplest way for users to get to [cranelift's `umulhi`](https://docs.rs/cranelift/latest/cranelift/prelude/trait.InstBuilder.html#method.umulhi), RISC-V's `MULHU`, Arm's `UMULL`, etc.  (For example, I added an ISLE pattern d12e4237de (diff-2041f67049d5ac3d8f62ea91d3cb45cdb8608d5f5cdab988731ae2addf90ef01) so Cranelift can notice what's happening from the fallback, even if the intrinsics aren't overridden specifically.  And on x86 this is one of the simplest possible non-trivial functions <https://rust.godbolt.org/z/4oadWKTc1> because `MUL` puts the results in exactly the registers that the scalar pair result happens to want.)

(I did not const-stabilize them in this PR because [the fallbacks](https://github.com/rust-lang/rust/blob/master/library/core/src/intrinsics/fallback.rs) are using `#[const_trait]` plus there's two [new intrinsic](https://doc.rust-lang.org/nightly/std/intrinsics/fn.disjoint_bitor.html)s involved, so I didn't want to *also* open those cans of worms here.  Given that both intrinsics *have* fallbacks, and thus don't do anything that can't already be expressed in existing Rust, const-stabilizing these should be straight-forward once the underlying machinery is allowed on stable.  But that doesn't need to keep these from being usable at runtime in the mean time.)
2025-08-30 04:14:07 +00:00
Chai T. Rex
2c21b884a5 Optimize .ilog({2,10}) to .ilog{2,10}()
Inform compiler of optimizations when the base is known at compile time
and there's a cheaper method available:

* `{integer}.checked_ilog(2)` -> `{integer}.checked_ilog2()`
* `{integer}.checked_ilog(10)` -> `{integer}.checked_ilog10()`
* `{integer}.ilog(2)` -> `{integer}.ilog2()`
* `{integer}.ilog(10)` -> `{integer}.ilog10()`
2025-08-29 21:51:10 -04:00
bors
e004014d1b Auto merge of #146023 - tgross35:rollup-gbec538, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX)
 - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature)
 - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature)
 - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`)
 - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved)
 - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`)
 - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed)
 - rust-lang/rust#146017 (Mark pipe2 supported in Android)
 - rust-lang/rust#146022 (compiler-builtins subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-30 01:06:25 +00:00
Trevor Gross
319d5547da
Rollup merge of #146022 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to ac3a4cd846.

Created using https://github.com/rust-lang/josh-sync.

r? `@ghost`
2025-08-29 19:33:06 -05:00
Trevor Gross
98806c8fdc
Rollup merge of #146017 - maurer:pipe2, r=Mark-Simulacrum
Mark pipe2 supported in Android

Android has supported pipe2 since 2010, long before the current min SDK.
2025-08-29 19:33:05 -05:00
Trevor Gross
b722da955f
Rollup merge of #146000 - GuillaumeGomez:rustdoc-error-improvement, r=notriddle
Improve librustdoc error when a file creation/modification failed

The message before looks like this:

```
failed to create or modify "/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/"
```

And with this change it looks like this:

```
failed to create or modify "/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/": failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8
```

r? ``````@lolbinarycat``````
2025-08-29 19:33:05 -05:00
Trevor Gross
a7fd14f89d
Rollup merge of #145991 - GrigorenkoPV:haiku, r=tgross35
std: haiku: fix `B_FIND_PATH_IMAGE_PATH`

Fixes https://github.com/rust-lang/rust/issues/145952, which was caused by https://github.com/rust-lang/libc/pull/4575

```````@rustbot``````` label T-libs O-haiku
2025-08-29 19:33:04 -05:00
Trevor Gross
4d5ca4cd38
Rollup merge of #145990 - lcnr:final-ty-no-resolve, r=davidtwco
`AutoDeref::final_ty` is already resolved

What is a `bool` argument doing here :<

The initial value is already resolved 41f2b6b39e/compiler/rustc_hir_analysis/src/autoderef.rs (L130)

For `builtin_deref` we assert that this is still the case 41f2b6b39e/compiler/rustc_hir_analysis/src/autoderef.rs (L82)

While `overloaded_deref_ty` also resolves at the end 41f2b6b39e/compiler/rustc_hir_analysis/src/autoderef.rs (L173)
2025-08-29 19:33:04 -05:00
Trevor Gross
65a846ad8a
Rollup merge of #145967 - Enselic:big-enum-debuginfo-span, r=wesleywiser
compiler: Include span of too huge enum with `-Cdebuginfo=2`

We have the ui test `tests/ui/limits/huge-enum.rs` to ensure we emit an error if we encounter too big enums. Before this fix, compiling the test with `-Cdebuginfo=2` would not include the span of the instantiation site, because the error is then emitted from a different code path that does not include the span.

Propagate the span to the error also in the debuginfo case, so the test passes regardless of debuginfo level. I'm sure we can propagate spans in more places, but let's start small.

## Test failure without the fix

Here is what the failure looks like if you run the test without the fix:

```
[ui] tests/ui/limits/huge-enum.rs#full-debuginfo ... F
.

failures:

---- [ui] tests/ui/limits/huge-enum.rs#full-debuginfo stdout ----
Saved the actual stderr to `/home/martin/src/rust/build/x86_64-unknown-linux-gnu/test/ui/limits/huge-enum.full-debuginfo/huge-enum.full-debuginfo.stderr`
diff of stderr:

1       error: values of the type `Option<TYPE>` are too big for the target architecture
-         --> $DIR/huge-enum.rs:17:9
-          |
-       LL |     let big: BIG = None;
-          |         ^^^
6
7       error: aborting due to 1 previous error
8

The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args limits/huge-enum.rs`
```

as can be seen, the `span` used to be missing with `debuginfo=2`.

## See also

This is one small step towards resolving rust-lang/rust#61117.

cc https://github.com/rust-lang/rust/pull/144499 which began running UI tests with `rust.debuginfo-level-tests=1`. This PR is part of preparing for increasing that to debuglevel 2.
2025-08-29 19:33:03 -05:00
Trevor Gross
751a9ad2e2
Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcm
str: Stabilize `round_char_boundary` feature

Closes https://github.com/rust-lang/rust/issues/93743
FCP completed https://github.com/rust-lang/rust/issues/93743#issuecomment-3168382171
2025-08-29 19:33:03 -05:00
Trevor Gross
ed9e767c01
Rollup merge of #145467 - Kivooeo:stabilize-strict_provenance_atomic_ptr, r=scottmcm
Stabilize `strict_provenance_atomic_ptr` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/99108) and stabilises `AtomicPtr::{fetch_ptr_add, fetch_ptr_sub, fetch_byte_add, fetch_byte_sub, fetch_or, fetch_and, fetch_xor}`

---

EDIT: FCP completed at https://github.com/rust-lang/rust/issues/99108#issuecomment-3168260347
2025-08-29 19:33:02 -05:00
Trevor Gross
19ae97622f
Rollup merge of #145242 - joboet:tait-split-paths, r=Mark-Simulacrum
std: use a TAIT to define `SplitPaths` on UNIX

Defining `SplitPaths` as a TAIT allows using closures instead of function pointers for `split` and `map`.
2025-08-29 19:33:02 -05:00
actuallylost
8134a10ec7 Add Duration::from_nanos_u128
Tracking issue: RUST-139201

Co-authored-by: omanirudh <omanirudh2014@gmail.com>
2025-08-30 01:38:14 +03:00
bors
fe55364329 Auto merge of #145997 - matthiaskrgr:rollup-tsgylre, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#145675 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [rust-lang/rust#1 of Batch rust-lang/rust#2])
 - rust-lang/rust#145676 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [rust-lang/rust#2 of Batch rust-lang/rust#2])
 - rust-lang/rust#145982 (compiletest: Reduce the number of `println!` calls that don't have access to `TestCx`)
 - rust-lang/rust#145984 (`TokenStream` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-29 16:21:11 +00:00
Guillaume Gomez
638a52c789 Improve librustdoc error when a file creation/modification failed 2025-08-29 16:26:23 +02:00
joboet
85cefabfcd
std: use a TAIT to define SplitPaths on UNIX 2025-08-29 16:10:10 +02:00
bors
db3fd4708c Auto merge of #145902 - Kobzol:dist-docs-build-compiler, r=jieyouxu
Avoid more rustc rebuilds in cross-compilation scenarios

This is a continuation of https://github.com/rust-lang/rust/pull/145874.

It adds a `compiler_for_std` function, which is a slimmed down version of `compiler_for`, which is much simpler, and designed to be used only for the standard library.

The build, dist and doc steps somtimes work with a stage2 std for a given target. That currently requires building a stage2 host compiler. However, if we uplift the stage1 libstd anyway, that is wasteful, in particular when we are cross-compiling.

The last two commits progressively make the stage 2 host rustc build avoidance more and more aggressive. I think that if we decide that it is fine to ship stage1 libstd everywhere, then it makes sense to go all the way.

When we ship stuff, we always build it with the stage 1 compiler (e.g. we ship stage 2 rustc which is built with stage 1 rustc). Libstd is the only component where stage N is built with the stage N compiler. So I think that shipping stage 1 libstd is "enough", and we could thus optimize what gets built on CI.

r? `@jieyouxu`
2025-08-29 13:13:53 +00:00
Matthias Krüger
197cb260e4
Rollup merge of #145984 - nnethercote:TokenStream-cleanups, r=chenyukang
`TokenStream` cleanups

r? `@chenyukang`
2025-08-29 12:37:32 +02:00
Matthias Krüger
25163e8151
Rollup merge of #145982 - Zalathar:logv, r=jieyouxu
compiletest: Reduce the number of `println!` calls that don't have access to `TestCx`

In order to stop using `#![feature(internal_output_capture)]` in compiletest, we need to be able to capture the console output of individual tests run by the executor.

The approach I have planned is to have all test runners print “console” output into a trait object that is passed around as part of `TestCx`, since almost all test-runner code has easy access to that context. So `println!("foo")` will become `writeln!(self.stdout, "foo")`, and so on.

In order to make that viable, we need to avoid unnecessary printing in places that don't have easy access to `TestCx`. To do so, we can either get rid of unnecessary print statements, or rearrange the code to make the context available. This PR uses both approaches.

r? jieyouxu
2025-08-29 12:37:31 +02:00
Matthias Krüger
47f1df5ca3
Rollup merge of #145676 - Oneirical:uncountable-integer-9, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#2 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-29 12:37:30 +02:00
Matthias Krüger
e15744e7a4
Rollup merge of #145675 - Oneirical:uncountable-integer-8, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#1 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
2025-08-29 12:37:30 +02:00
Pavel Grigorenko
e3f1e94be7 std: haiku: fix B_FIND_PATH_IMAGE_PATH 2025-08-29 12:14:17 +03:00
lcnr
6fd0e50ecf autoderef final ty is already resolved 2025-08-29 10:53:39 +02:00
Nicholas Nethercote
364a3be579 Put TokenStream stuff in a sensible order.
I.e. the type definition, then a single inherent `impl` block, then the
trait `impl` blocks.

The lack of sensible ordering here has bugged me for some time.
2025-08-29 14:27:20 +10:00
Nicholas Nethercote
16b5ac111c Remove very outdated comment about token streams.
They're now just an `Arc<Vec<TokenTree>>`. No ropes, no views, nothing
like that.
2025-08-29 14:27:18 +10:00
bors
41f2b6b39e Auto merge of #145978 - Zalathar:rollup-0dzk72g, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143713 (Add a mailmap entry for gnzlbg)
 - rust-lang/rust#144275 (implement Sum and Product for Saturating(u*))
 - rust-lang/rust#144354 (fix(std): Fix undefined reference to __my_thread_exit on QNX 8.0)
 - rust-lang/rust#145387 (Remove TmpLayout in layout_of_enum)
 - rust-lang/rust#145793 (std library: use execinfo library also on NetBSD.)
 - rust-lang/rust#145884 (Test `instrument-mcount` codegen)
 - rust-lang/rust#145947 (Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`)
 - rust-lang/rust#145972 (fix `core::marker::Destruct` doc)
 - rust-lang/rust#145977 (tests: Ignore basic-stepping.rs on riscv64)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-29 03:40:14 +00:00
Zalathar
6340b97768 Don't print captures in TestCx::normalize_platform_differences
This appears to have been leftover debugging code.

If the capture information turns out to have still been useful, we can find a
way to emit it in a way that doesn't interfere with overhauling compiletests's
output capture system.
2025-08-29 13:16:24 +10:00
Zalathar
c80cadee64 Move module compute_diff into compiletest::runtest
The code in this module is always called in the context of running an
individual tests, and sometimes prints output that needs to be captured.

Moving this module into `runtest` will make it easier to find and audit all of
the print statements that need to be updated when overhauling output-capture.
2025-08-29 13:11:27 +10:00