Commit graph

288188 commits

Author SHA1 Message Date
Lukas Wirth
97f0f68769 Cleanup cfg check handling in expression store lowering 2025-04-29 11:44:11 +02:00
Lukas Wirth
d93d553a0c refactor: Clean up cache priming cancellation handling 2025-04-29 10:40:31 +02:00
David Barsky
0b02aed854
Merge pull request #19699 from ChayimFriedman2/escape-label
fix: Escape raw names in labels properly
2025-04-28 21:12:21 +00:00
Chayim Refael Friedman
b602274c3f
Merge pull request #19710 from rust-lang/davidbarsky/add-additional-details-to-panic
base-db: add more details to panic
2025-04-28 20:46:49 +00:00
David Barsky
833f526196 base-db: add more details to panic 2025-04-28 13:30:33 -07:00
Lukas Wirth
746c6899e9
Merge pull request #19708 from Veykril/push-wrmyowrzkxzz
refactor: De-arc lang item queries
2025-04-28 15:28:51 +00:00
Lukas Wirth
a839a6655a
Merge pull request #19542 from snprajwal/let-else-to-match
refactor: migrate `let_else_to_match` to editor
2025-04-28 15:27:28 +00:00
Lukas Wirth
d2ec47ed09
Merge pull request #19469 from snprajwal/merge-imports
refactor: `merge_imports` and `unmerge_imports` to editor
2025-04-28 15:25:57 +00:00
Lukas Wirth
f479012d0e refactor: De-arc lang item queries 2025-04-28 17:17:39 +02:00
Prajwal S N
32bf2ac529
refactor: migrate merge_imports to syntax editor
Co-authored-by: Tarek <tareknaser360@gmail.com>
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-28 17:32:36 +05:30
Prajwal S N
30eeab0381
chore: rename unmerge_use to unmerge_imports
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-28 17:32:05 +05:30
Prajwal S N
1b3374fb82
fix: migrate unmerge_use to syntax editor
Also ensures that attributes on the use item are applied to the new use
item when unmerging.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-28 17:31:23 +05:30
Prajwal S N
2231efa27d
refactor: migrate let_else_to_match to editor
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2025-04-28 17:19:17 +05:30
Lukas Wirth
62a48c5fed
Merge pull request #19706 from Veykril/push-nkpmknlvzyom
fix: Address minor FIXME
2025-04-28 10:12:20 +00:00
Lukas Wirth
99f00927cc fix: Address minor FIXME 2025-04-28 11:55:26 +02:00
Lukas Wirth
bb906cc06f
Merge pull request #19704 from Veykril/push-wrvznvvpvtvp
Add expression fill mode variant for filling with underscore expressions
2025-04-28 09:45:04 +00:00
Laurențiu Nicola
36ed4aaa2e Add foldhash license exception 2025-04-28 12:12:08 +03:00
Lukas Wirth
7e064c3072 Add expression fill mode variant for filling with underscore expressions 2025-04-28 10:39:36 +02: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