[pull] master from rust-lang:master#136
Merged
Merged
Conversation
Fix invalid `pattern_matching_variant` lowering due to recovery
It's possible to make rust-analyzer panic because of `expr_from_text`
not roundtripping. Prefer `quote!`, which is better anyway (less work,
more robust).
This crash only seems to occur in rare circumstances, so I haven't
written a regression test. For reference, you can replicate it with
the following code:
mod serde {
pub struct Serializer;
pub trait Serialize {
fn serialize(&self, s: Serializer);
}
}
struct Duration;
impl serde::Serialize for Duration {
fn serialize(&self, s: serde::Serializer) {}
}
struct S {
map: <Duration
}
When the cursor was on `map`, the `generate_delegate_trait` would try
to build the call `<<Duration as Serialize>::serialize(&self.map, s)`.
Due to the extra leading `<`, we'd parse it as `<<`, which isn't valid
in an expression (left shift is an infix operator).
Since we were passing invalid Rust through the syntax builder, which
only allows valid Rust code, we then panicked.
18: 0x104007fdc - <core[eea836d19939cdd9]::option::Option<syntax[8d95e7771a925714]::ast::generated::nodes::Expr>>::unwrap
at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/option.rs:1013:21
19: 0x104007fdc - <syntax[8d95e7771a925714]::Parse<syntax[8d95e7771a925714]::ast::generated::nodes::Expr>>::tree
at /Users/wilfred/src/rust-analyzer/crates/syntax/src/lib.rs:120:37
20: 0x104006014 - syntax[8d95e7771a925714]::ast::make::expr_from_text_with_edition::<syntax[8d95e7771a925714]::ast::generated::nodes::CallExpr>
at /Users/wilfred/src/rust-analyzer/crates/syntax/src/ast/make.rs:1360:28
21: 0x103ff9d80 - syntax[8d95e7771a925714]::ast::make::expr_from_text::<syntax[8d95e7771a925714]::ast::generated::nodes::CallExpr>
at /Users/wilfred/src/rust-analyzer/crates/syntax/src/ast/make.rs:1354:5
22: 0x103f8e298 - syntax[8d95e7771a925714]::ast::make::expr_call
at /Users/wilfred/src/rust-analyzer/crates/syntax/src/ast/make.rs:689:5
23: 0x103fed920 - <syntax[8d95e7771a925714]::ast::syntax_factory::SyntaxFactory>::expr_call
at /Users/wilfred/src/rust-analyzer/crates/syntax/src/ast/syntax_factory/constructors.rs:1157:19
24: 0x1027feb9c - ide_assists[84949edff2a7fc81]::handlers::generate_delegate_trait::func_assoc_item
at /Users/wilfred/src/rust-analyzer/crates/ide-assists/src/handlers/generate_delegate_trait.rs:796:22
25: 0x102800120 - ide_assists[84949edff2a7fc81]::handlers::generate_delegate_trait::process_assoc_item
AI disclosure: Written with help by GPT-5.5.
…ll-panic fix: Use quote! inside ast::make::expr_call()
Signed-off-by: cuishuang <imcusg@gmail.com>
Signed-off-by: cuishuang <imcusg@gmail.com>
Signed-off-by: cuishuang <imcusg@gmail.com>
Fix extract variable preserving whitespace from macro input
Reuse lowercase storage across fuzzy ordering comparisons while preserving the existing linear substring search. Add completion coverage for case-insensitive ranking and path tie-breaking. AI usage: GitHub Copilot CLI assisted with implementation and validation.
…ase-buffer tidy - flyimport lowercase buffer (last-ditch attempt)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )