Commit graph

288169 commits

Author SHA1 Message Date
Laurențiu Nicola
36ed4aaa2e Add foldhash license exception 2025-04-28 12:12:08 +03:00
Laurențiu Nicola
5008c6a6c0
Merge pull request #19702 from lnicola/sync-from-rust
internal: Sync from downstream
2025-04-28 08:31:31 +00:00
Laurențiu Nicola
f89fcbeda2 Add bootstrap cfg 2025-04-28 11:16:21 +03:00
Laurențiu Nicola
1923f90dd3 Format code 2025-04-28 11:11:47 +03:00
Laurențiu Nicola
4d28d530f7 Merge from rust-lang/rust 2025-04-28 11:06:53 +03:00
Laurențiu Nicola
fdb5edefd0 Preparing for merge from rust-lang/rust 2025-04-28 09:52:59 +03:00
bors
21079f53a3 Auto merge of #140378 - ChrisDenton:rollup-3mj0wp9, r=ChrisDenton
Rollup of 8 pull requests

Successful merges:

 - #138395 (Download GCC from CI on test builders)
 - #138737 (uefi: Update r-efi)
 - #138939 (Add `Arc::is_unique`)
 - #139224 (fix(test): Expose '--no-capture' in favor of `--nocapture`)
 - #139546 (std(docs): clarify how std::fs::set_permisions works with symlinks)
 - #140345 (Avoid re-interning in `LateContext::get_def_path`)
 - #140351 (docs: fix incorrect stability markers on `std::{todo, matches}`)
 - #140359 (specify explicit safety guidance for from_utf8_unchecked)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-28 02:01:15 +00:00
Chris Denton
0ae362bc19
Rollup merge of #140359 - DiuDiu777:str-fix, r=Noratrieb
specify explicit safety guidance for from_utf8_unchecked

The PR addresses missing safety guidelines in two APIs by adding explicit text to the cross-linked reference.
2025-04-28 01:58:51 +00:00
Chris Denton
bd36f25678
Rollup merge of #140351 - rust-lang:notriddle/stability-use, r=thomcc
docs: fix incorrect stability markers on `std::{todo, matches}`

This regression appeared in 916cfbcd3e. The change is behaving as expected (a non-glob re-export uses the stability marker on the `use` item, not the original one), but this part of the standard library didn't follow it.

Fixes https://github.com/rust-lang/rust/issues/140344
2025-04-28 01:58:50 +00:00
Chris Denton
5633102807
Rollup merge of #140345 - DaniPopes:get-def-path, r=Urgau
Avoid re-interning in `LateContext::get_def_path`

The def path printer in `get_def_path` essentially calls `Symbol::intern(&symbol.to_string())` for simple symbols in a path. This accounts for ~30% of the runtime of get_def_path.

We can avoid this by simply appending the symbol directly when available.
2025-04-28 01:58:50 +00:00
Chris Denton
c439543ae8
Rollup merge of #139546 - lolbinarycat:std-set_permissions-75942, r=thomcc
std(docs): clarify how std::fs::set_permisions works with symlinks

fixes https://github.com/rust-lang/rust/issues/75942
fixes https://github.com/rust-lang/rust/issues/124201
2025-04-28 01:58:49 +00:00
Chris Denton
8ee9029f67
Rollup merge of #139224 - epage:nocapture, r=thomcc
fix(test): Expose '--no-capture' in favor of `--nocapture`

This improves consistency with commonly expected CLI conventions,
avoiding a common stutter people make when running tests (trying what
they expect and then having to check the docs to then user whats
accepted).

An alternative could have been to take a value, like `--capture <value>` (e.g. `pytest` does this).
Overall, we're shifting focus for features to custom test harnesses (see #134283).
Most of `pytest`s modes will likely be irrelevant in that situation.
As for the rest, its too early to tell which, if any, may be relevant,
so we're sticking with this small, quality of life improvement.

I expect we'll warn about `--nocapture` being deprecated in the future after a sufficient transition period has been allowed.
By deprecating `--nocapture`, we intend that custom test harnesses do
not need to support it for reasons outside of their own compatibility
requirements, much like the deprecation in #134283

I'm punting for now on the naming of `RUST_TEST_NOCAPTURE`.
I feel like T-testing-devex should do a wider look at environment
variables role in lib`test` before evaluating whether to
- Deprecate it in favor of the user passing CLI flags or the test runner
  providing its own config
- Deprecate in favor of `RUST_TEST_NO_CAPTURE`
- Deprecate in favor of `RUST_TEST_CAPTURE`

Other CLI flags were evaluated for casing consistency:
- `--logfile` has the same problem but was deprecated in #134283

Regarding the implementation, I moved `--nocapture` out of `optgroups()`, into `parse_opts()`, out of an abundance of caution in passing the options without a deprecated value to the usage generation.  However, the usage does not actually show optional flags, so this could potentially be dropped, simplifying the PR.

Note: `compiletest` added `--no-capture` instead of `--nocapture` in #134809

T-testing-devex FCP: https://github.com/rust-lang/rust/issues/133073#issuecomment-2486921104

Fixes #133073
2025-04-28 01:58:49 +00:00
Chris Denton
55f93265f0
Rollup merge of #138939 - SabrinaJewson:arc-is-unique, r=tgross35
Add `Arc::is_unique`

Adds

```rs
impl<T> Arc<T> {
    pub fn is_unique(this: &Self) -> bool;
}
```

Tracking issue: #138938
ACP: https://github.com/rust-lang/libs-team/issues/560
2025-04-28 01:58:48 +00:00
Chris Denton
52b846dca3
Rollup merge of #138737 - Ayush1325:r-efi-update, r=tgross35
uefi: Update r-efi

- Bump up the version to 5.2.0

try-job: x86_64-gnu-distcheck
try-job: x86_64-gnu
try-job: test-various
2025-04-28 01:58:47 +00:00
Chris Denton
009a84fbe1
Rollup merge of #138395 - Kobzol:ci-download-gcc, r=Mark-Simulacrum
Download GCC from CI on test builders

This should reduce the duration of the `x86_64-gnu-llvm-18` job, which runs on PR CI, which is currently the only one that builds GCC (outside of the x64 dist builder).

Since we handle the GCC download in the GCC step, and not eagerly in config, we can set this flag globally across all test builders, as it won't do anything unless they actually try to build GCC.

Opening as a draft to test if it works on CI, because I still need to implement logic to avoid the download if there are any local modifications to GCC (essentially the "if-unchanged" mode, although I want to try something a bit different).

r? ```@ghost```
2025-04-28 01:58:47 +00:00
bors
deb947971c Auto merge of #140362 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in d811228b14ae2707323f37346aee3f4147e247e6..7918c7eb59614c39f1c4e27e99d557720976bdd7
2025-04-15 15:18:42 +0000 to 2025-04-27 09:44:23 +0000
- overriding-dependencies.md: better readability (rust-lang/cargo#15459)
- source-replacement.md: fix typo (rust-lang/cargo#15458)
- Stabilize automatic garbage collection. (rust-lang/cargo#14287)
- Update doctest xcompile flags (rust-lang/cargo#15455)
- fix: Suggest similar looking feature names when feature is missing (rust-lang/cargo#15454)
- fix(unit-graph): switch to Package ID Spec (rust-lang/cargo#15447)
- chore(deps): update cargo-semver-checks to v0.41.0 (rust-lang/cargo#15446)
- Implement RFC3695: Allow boolean literals as cfg predicates (rust-lang/cargo#14649)
- chore: remove duplicate word in comment (rust-lang/cargo#15437)
- Fix formatting of CliUnstable parsing (rust-lang/cargo#15434)

r? ghost
2025-04-27 22:21:34 +00:00
bors
cb31a009e3 Auto merge of #140366 - matthiaskrgr:rollup-zd3q1oy, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #140246 (Fix never pattern printing)
 - #140280 (Improve if/else pretty printing)
 - #140348 (Update lint-docs to default to Rust 2024)
 - #140358 (Use `search_for_cycle_permutation` to look for `variances_of`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-27 16:39:04 +00:00
Matthias Krüger
fdfc7c0044
Rollup merge of #140358 - Zoxc:variance-cycle, r=oli-obk
Use `search_for_cycle_permutation` to look for `variances_of`

This uses `search_for_cycle_permutation` to look for `variances_of` in case `variances_of` is not the first query in the cycle.

This may fix https://github.com/rust-lang/rust/issues/124423 and https://github.com/rust-lang/rust/issues/127971.

r? `@oli-obk`
2025-04-27 16:09:00 +02:00
Matthias Krüger
c006eb7010
Rollup merge of #140348 - ehuss:lint-docs-edition, r=compiler-errors
Update lint-docs to default to Rust 2024

This updates the lint-docs tool to default to the 2024 edition. The lint docs are supposed to illustrate the code with the latest edition, and I just forgot to update this in https://github.com/rust-lang/rust/pull/133349.

Some docs needed to add the `edition` attribute since they were assuming a particular edition, but were missing the explicit annotation.

This also includes a commit to simplify the edition handling in lint-docs.
2025-04-27 16:09:00 +02:00
Matthias Krüger
405c8afce3
Rollup merge of #140280 - nnethercote:improve-if-else-printing, r=Urgau
Improve if/else pretty printing

AST/HIR pretty printing of if/else is currently pretty bad. This PR improves it a lot.

r? `@Nadrieril`
2025-04-27 16:08:59 +02:00
Matthias Krüger
4f7aed6791
Rollup merge of #140246 - nnethercote:fix-never-pattern-printing, r=Nadrieril
Fix never pattern printing

It's currently broken, but there's an easy fix.

r? `@Nadrieril`
2025-04-27 16:08:58 +02:00
SabrinaJewson
2ab403441f
Add Arc::is_unique 2025-04-27 14:55:46 +01:00
Weihang Lo
2985eb85c1
Update cargo 2025-04-27 07:44:01 -04:00
bors
267cae5bdb Auto merge of #140360 - matthiaskrgr:rollup-savbr84, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #137439 (Stabilise `std::ffi::c_str`)
 - #137714 (Update safety documentation for `CString::from_ptr` and `str::from_boxed_utf8_unchecked`)
 - #139031 (Use char::is_whitespace directly in str::trim*)
 - #139090 (fix docs for `Peekable::next_if{_eq}`)
 - #140297 (Update example to use CStr::to_string_lossy)
 - #140330 (Clarified bootstrap optimization "true" argument)
 - #140339 (session: Cleanup `CanonicalizedPath::new`)
 - #140346 (rustc_span: Some hygiene cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-27 10:52:46 +00:00
Matthias Krüger
aa5c6d44cf
Rollup merge of #140346 - petrochenkov:cleanhyg, r=compiler-errors
rustc_span: Some hygiene cleanups

Mostly enabled by #139241 and #139281.
2025-04-27 11:55:00 +02:00
Matthias Krüger
1e677438f8
Rollup merge of #140339 - petrochenkov:capanew, r=lqd
session: Cleanup `CanonicalizedPath::new`

It wants an owned path, so pass an owned path.
2025-04-27 11:54:59 +02:00
Matthias Krüger
2575c7d2dc
Rollup merge of #140330 - Kivooeo:new-fix-five, r=clubby789
Clarified bootstrap optimization "true" argument

fixes #140328
2025-04-27 11:54:59 +02:00
Matthias Krüger
3af00f0889
Rollup merge of #140297 - shepmaster:cstr-lossy, r=joboet
Update example to use CStr::to_string_lossy
2025-04-27 11:54:58 +02:00
Matthias Krüger
766340b26e
Rollup merge of #139090 - yotamofek:pr/peekable-next-if-docs, r=tgross35
fix docs for `Peekable::next_if{_eq}`

These seem like copy-paste errors

(except `saves the value of` 👉 `retains` which just sounds better to me)
2025-04-27 11:54:58 +02:00
Matthias Krüger
2b0ce2cf92
Rollup merge of #139031 - DaniPopes:str-trim-closure, r=tgross35
Use char::is_whitespace directly in str::trim*

Use the method directly instead of wrapping it in a closure.
2025-04-27 11:54:57 +02:00
Matthias Krüger
bd3af53489
Rollup merge of #137714 - DiuDiu777:doc-fix, r=tgross35
Update safety documentation for `CString::from_ptr` and `str::from_boxed_utf8_unchecked`

## PR Description​
This PR addresses missing safety documentation for two APIs:

​**1. alloc::ffi::CStr::from_raw**​

- ​`Alias`: The pointer ​must not be aliased​ (accessed via other pointers) during the reconstructed CString's lifetime.
- `Owning`: Calling this function twice on the same pointer and creating two objects with overlapping lifetimes, introduces two alive owners of the same memory. This may result in a double-free.
- `Dangling`: The prior documentation required the pointer to originate from CString::into_raw, but this constraint is incomplete. A validly sourced pointer can also cause undefined behavior (UB) if it becomes dangling. A simple Poc for this situation:
```
use std::ffi::CString;
use std::os::raw::c_char;

fn create_dangling() -> *mut c_char {
    let local_ptr: *mut c_char = {
        let valid_data = CString::new("valid").unwrap();
        valid_data.into_raw()
    };

    unsafe {
        let _x = CString::from_raw(local_ptr);
    }
    local_ptr
}

fn main() {
    let dangling = create_dangling();
    unsafe {let _y = CString::from_raw(dangling);} // Cause UB!
}
```

​**2. alloc::str::from_boxed_utf8_unchecked**​

- `ValidStr`: Bytes must contain a ​valid UTF-8 sequence.
2025-04-27 11:54:57 +02:00
Matthias Krüger
9630242e5e
Rollup merge of #137439 - clarfonthey:c-str-module, r=tgross35
Stabilise `std::ffi::c_str`

This finished FCP in #112134 but never actually got a stabilisation PR. Since the FCP in #120048 recently passed to add the `os_str` module, it would be nice to also merge this too, to ensure that both get added in the next version.

Note: The added stability attributes which *somehow* were able to be omitted before (rustc bug?) were added based on the fact that they were added in 302551388b, which ended up in 1.85.0.

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

r? libs-api
2025-04-27 11:54:56 +02:00
LemonJ
0795b2d646 specify explicit safety guidance for from_utf8_unchecked 2025-04-27 16:56:31 +08:00
Ayush Singh
d40d424d43
CI: docker: host-x86_64: test-various: uefi_qemu_test: Update r-efi
- Update r-efi to 5.2.0

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-04-27 14:07:33 +05:30
bors
8947e167e5 Auto merge of #140291 - GuillaumeGomez:doctest-2024-stdout, r=notriddle
Correctly display stdout and stderr in case a doctest is failing

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

Since the doctest is actually running itself, we need to handle the output directly inside it.

cc `@fmease`
r? `@notriddle`
2025-04-27 07:43:46 +00:00
John Kåre Alsaker
c33b4f870e Use search_for_cycle_permutation to look for variances_of 2025-04-27 09:38:18 +02:00
LemonJ
bfdd947bbd fix missing doc in CString::from_raw and str::from_boxed_utf8_unchecked 2025-04-27 12:49:37 +08:00
bors
496145b9cc Auto merge of #139646 - lcnr:default-is-fully-concrete, r=BoxyUwU
check types of const param defaults

fixes #139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? `@BoxyUwU`
2025-04-27 01:59:43 +00:00
bors
43e62a789c Auto merge of #140288 - Zalathar:new-executor, r=jieyouxu
compiletest: Re-land using the new non-libtest executor by default

This PR re-lands #139998, which had the misfortune of triggering download-rustc in its CI jobs, so we didn't get proper test metrics for comparison with the old implementation. So that was PR was reverted in #140233, with the intention of re-landing it alongside a dummy compiler change to inhibit download-rustc.

---

Original PR description for #139998:
>The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong.
>
>Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong.
>
>As before, there *should* be no user-visible difference between the old executor and the new executor.

---
r? jieyouxu
2025-04-26 22:33:56 +00:00
Michael Howell
9fed91fde0 docs: fix incorrect stability markers on std::{todo, matches}
This regression appeared in 916cfbcd3e.
The change is behaving as expected (a non-glob re-export uses the
stability marker on the `use` item, not the original one), but
this part of the standard library didn't follow it.
2025-04-26 14:56:17 -07:00
Eric Huss
1f108fe08a Update lint-docs to default to Rust 2024
This updates the lint-docs tool to default to the 2024 edition. The lint
docs are supposed to illustrate the code with the latest edition, and I
just forgot to update this in
https://github.com/rust-lang/rust/pull/133349.

Some docs needed to add the `edition` attribute since they were assuming
a particular edition, but were missing the explicit annotation.
2025-04-26 14:08:58 -07:00
Eric Huss
8608a3f637 lint-docs: Don't hard-code the valid editions
This removes the hard-coded list of edition support in the lint-docs
tool, and instead just assumes the edition attribute is something valid.
There isn't a real reason to have this, as rustc will error if given a
wrong number. This should be easier to maintain going forward.
2025-04-26 14:08:36 -07:00
Vadim Petrochenkov
7148908ace hygiene: Use IndexVec for syntax context decode cache 2025-04-26 23:32:49 +03:00
DaniPopes
6f5698c368
Avoid re-interning in LateContext::get_def_path
The def path printer in `get_def_path` essentially calls
`Symbol::intern(&symbol.to_string())` for simple symbols in a path.
This accounts for ~30% of the runtime of get_def_path.

We can avoid this by simply appending the symbol directly when available.
2025-04-26 22:06:44 +02:00
Vadim Petrochenkov
c7ad140473 hygiene: Misc cleanups
Inline some functions used once.
Use `impl Trait` more.
Tweak some comments.
2025-04-26 23:00:51 +03:00
Vadim Petrochenkov
2e8c53cf07 hygiene: Remove decode placeholders
They are no longer necessary after #139281
2025-04-26 23:00:51 +03:00
Chayim Refael Friedman
4ed9b12dd3
Merge pull request #19692 from vishruth-thimmaiah/remove_underscore_for_used_var
feat: adds an assist to remove underscores from used variables
2025-04-26 19:00:49 +00:00
Vishruth-Thimmaiah
9a00c99ba2
feat: adds an assist to remove underscores from used variables
adds an assist that suggests removing any underscore prefixes from used
variables.
2025-04-27 00:13:42 +05:30
Jake Goulding
9112c86f42 Update example to use CStr::to_string_lossy 2025-04-26 12:38:23 -04:00
bors
10fa3c449f Auto merge of #140336 - matthiaskrgr:rollup-kxo6ljw, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #140215 (transmutability: Support char, NonZeroXxx)
 - #140226 (Update wasm-component-ld to 0.5.13)
 - #140317 (Remove redundant check)
 - #140318 (Simply try to unpeel AsyncFnKindHelper goal in `emit_specialized_closure_kind_error`)
 - #140320 (replace `GenericArg` with `Term` where applicable)
 - #140325 (Grammar fixes for BufRead::has_data_left docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-26 15:59:32 +00:00