Rollup of 13 pull requests#154253
Conversation
Example
---
```rust
fn foo() {
{
let closure = |$0| match () {
() => {},
};
closure();
}
}
```
**Before this PR**:
```rust
fn foo() {
{
fn closure() {
match () {
() => {},
}
}
closure();
}
}
```
**After this PR**:
```rust
fn foo() {
{
fn closure() {
match () {
() => {},
}
}
closure();
}
}
```
Example
---
```rust
fn main() {
if $0let (foo, bar) = ("Foo", "Bar") {
code();
}
}
```
->
```rust
fn main() {
if let foo = "Foo"
&& let bar = "Bar" {
code();
}
}
```
Example
---
```rust
fn main() {
Foo { bar$0: false };
}
struct Foo {}
```
->
```rust
fn main() {
Foo { bar: false };
}
struct Foo {
bar: bool,
}
```
Example
---
```rust
pub struct Test {
$0#[foo]
#[bar]$0
test: u32,
}
```
->
```rust
pub struct Test {
#[cfg_attr($0, foo, bar)]
test: u32,
}
```
Changes:
- Add nested lifetime support
- Add explicit infer lifetime support
- Change assist type to `quickfix`
Example
---
```rust
struct Foo {
a: &$0i32,
b: &'_ i32,
c: (&i32, Bar<'_>),
}
```
**Before this PR**:
```rust
struct Foo<'a> {
a: &'a i32,
b: &'_ i32,
c: (&i32, Bar<'_>),
}
```
**After this PR**:
```rust
struct Foo<'a> {
a: &'a i32,
b: &'a i32,
c: (&'a i32, Bar<'a>),
}
```
Example
---
```rust
fn foo() {
let None$0 = Some(5);
}
```
->
```rust
fn foo() {
let None = Some(5) else { return };
}
```
Example
---
```rust
fn main() {
for$0 _ in 0..5 {
break;
continue;
}
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn main() {
'l: for _ in 0..5 {
break 'l;
continue 'l;
}
}
```
Editor adds the current indentation to the content of the code snippet
This PR dedentation is used to offset the editor snippet indentation
Example
---
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
x
.and(y)
.map(|it| it+2)
.$0
};
}
```
**Before this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
**After this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
Example
---
```rust
struct Foo(Option<i32>);
fn foo(x: Foo) -> Foo {
match x { Foo($0) => () }
}
```
**Before this PR**
```rust
ty: Foo, name: ?
```
**After this PR**
```rust
ty: Option<i32>, name: ?
```
fix replacing target on lib target kind
These are not used outside of the project-model crate, ie. instantly converted to other structures.
Makes clear to future editors of this code that they should add #[serde(default)] to new fields.
I'm about to complete the match statement here with more of the same. Once you write the exact same code 5 times, it's time for a helper function.
Was deleted when this code was moved in PR 18043.
Allows project JSON users to run a whole module of tests, benchmarks, doctests.
Example
---
**Input**:
```rust
use std::fmt::Error;
$0use std::fmt::Display;
use std::fmt::Debug;
use std::fmt::Write;
use$0 std::fmt::Result;
```
**Before this PR**:
```rust
use std::fmt::Error;
use std::fmt::{Debug, Display, Write};
use std::fmt::Result;
```
**After this PR**:
```rust
use std::fmt::Error;
use std::fmt::{Debug, Display, Result, Write};
```
Example
---
```rust
fn main() {
let Some(2) = None else {$0
return;
};
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn main() {
return;
}
```
Example
---
```rust
fn main() {
let bar = 2;
let f = || bar.$0;
}
```
**Before this PR**
Cannot complete `.let`
**After this PR**
```rust
fn main() {
let bar = 2;
let f = || {
let $1 = bar;
$0
};
}
```
- Do not show commas on label
Example
---
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), mut ba$0)
```
**Before this PR**
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), bar: u32)
```
**After this PR**
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), mut bar: u32)
```
Example
---
```rust
fn f() {
if true
&& let xyz = 0
{
xyz$0;
}
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn f() {
if true
{
0;
}
}
```
seven IrPrint::print_debug implementations in the next-solver were placeholder stubs that returned "TODO: <typename>" instead of meaningful output. these are called via the Display impl (and Debug for PatternKind) of these types, so any solver trace log containing them was unreadable. implemented proper formatting for each: - TraitPredicate -> "T: Trait" / "!T: Trait" - HostEffectPredicate -> "const T: Trait" / "[const] T: Trait" - NormalizesTo -> "AliasTerm(...) -> Term" - SubtypePredicate -> "A <: B" - CoercePredicate -> "A -> B" - FnSig -> "fn([inputs]) -> output" - PatternKind -> "start..=end" / "or([...])" / "!null" also removed the now-unused type_name_of_val import.
- Fix parentheses for replace_is_method_with_if_let_method
Example
---
```rust
fn main() {
let x = Some(1);
if x.is_som$0e_and(predicate) {}
}
```
**Before this PR**
```rust
fn main() {
let x = Some(1);
if let Some(x1) = x {}
}
```
**After this PR**
```rust
fn main() {
let x = Some(1);
if let Some(x1) = x && predicate(x1) {}
}
```
…esent
load_workspace_at() looks at parent directories. If rust-analyzer is
in a directory (e.g. a monorepo) where a parent directory contains a
rust-project.json, that configuration wins over the Cargo.toml and the
test fails.
One easy way of testing this is deliberately writing an invalid JSON
file to the parent directory.
```
$ echo '{' > ../rust-project.json
$ cargo t -p load-cargo
---- tests::test_loading_rust_analyzer stdout ----
thread 'tests::test_loading_rust_analyzer' (38576150) panicked at crates/load-cargo/src/lib.rs:756:81:
called `Result::unwrap()` on an `Err` value: Failed to load the project at /Users/wilfred/src/rust-project.json
Caused by:
0: Failed to deserialize json file /Users/wilfred/src/rust-project.json
1: EOF while parsing an object at line 2 column 0
```
Instead, explicitly load the cargo workspace so the presence of a
rust-project.json never changes the result of the test.
AI disclosure: Written with help from Claude.
|
@bors r+ rollup=never p=3 |
|
Trying commonly failed jobs |
This comment has been minimized.
This comment has been minimized.
Rollup of 13 pull requests try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 13e2aba (parent) -> eb9d3ca (this PR) Test differencesShow 102 test diffsStage 0
Stage 1
Stage 2
Additionally, 18 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard eb9d3caf0511a5fa9fa70251e2ac9fa33a9a4652 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (eb9d3ca): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 2.2%, secondary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 482.731s -> 484.336s (0.33%) |
Successful merges:
rust-analyzersubtree update #154241 (rust-analyzersubtree update)std: includedlmallocfor all non-wasi Wasm targets #153686 (std: includedlmallocfor all non-wasi Wasm targets)--features=rustcto rustc_transmute #154105 (bootstrap: Pass--features=rustcto rustc_transmute)r? @ghost
Create a similar rollup