Skip to content

rust-analyzer subtree update #144887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Aug 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
34ddd59
Improve settings tree title and descriptions
joshka Jul 3, 2025
3540446
Fix gen panics doc template for debug_assert
A4-Tacks Jul 25, 2025
1d5a582
refactor: conpare text of name_ref instead of syntax name_ref
Hmikihiro Jul 27, 2025
b3ea82f
Migrate `inline_type_alias` assist to use `SyntaxEditor`
Hmikihiro Jul 27, 2025
b1b7077
remove ted from convert_tuple_struct_to_named_struct
Hmikihiro Jul 26, 2025
85486a7
migrate `fn edit_struct_def` in `convert_tuple_struct_to_named_struct…
Hmikihiro Jul 26, 2025
8f89872
Migrate `convert_tuple_struct_to_named_struct' assist to use `SyntaxE…
Hmikihiro Jul 27, 2025
b4b9f3e
Merge pull request #20300 from A4-Tacks/fix-debug_assert-doc-gen
ChayimFriedman2 Jul 29, 2025
8b214fb
fix: Do not require all rename definitions to be renameable
Veykril Jul 29, 2025
e45400a
Merge pull request #20333 from Veykril/push-xmulpqkxrytn
Veykril Jul 29, 2025
1532b37
Use GH app for authenticating sync PRs
Kobzol Jul 29, 2025
f7c3a89
Merge pull request #20335 from Kobzol/ci-gh-app
lnicola Jul 29, 2025
bad05ff
In generate_mut_trait_impl, don't add a tabstop if the client does no…
ChayimFriedman2 Jul 29, 2025
f5ecbb5
Merge pull request #20336 from ChayimFriedman2/mut-trait-impl-snippet
Veykril Jul 29, 2025
5043dc9
Merge pull request #20154 from joshka/jm/improve-setting-titles
Veykril Jul 29, 2025
ea1e24a
When displaying a projection into a type parameter that has bounds as…
ChayimFriedman2 Jul 29, 2025
b2d9f17
Merge pull request #20337 from ChayimFriedman2/double-inlay-hints
Veykril Jul 29, 2025
cca89bc
add `SyntaxFactory::record_expr` to hide clone_for_update
Hmikihiro Jul 29, 2025
08c6768
replace `make::` to `SyntaxFactory::` in `inline_type_alias`
Hmikihiro Jul 29, 2025
a9c4316
Merge pull request #20311 from Hmikihiro/migrate_convert_tuple_struct…
ShoyuVanilla Jul 30, 2025
cd0f643
Merge pull request #20314 from Hmikihiro/Migrate_inline_type_alias_to…
ShoyuVanilla Jul 30, 2025
2918a2b
Abtract away json protocol for proc-macro-srv
Veykril Jul 30, 2025
d71e972
add `SyntaxEditor::delete_all` to migrate utils.rs `add_trait_assoc_i…
Hmikihiro Jul 29, 2025
8971681
Properly clean proc-macro-srv proc-macro temp dir
Veykril Jul 31, 2025
1975c98
Reorganize proc-macro-srv
Veykril Jul 31, 2025
7543395
Add version command to proc-macro-srv
Veykril Jul 31, 2025
6bf9700
Merge pull request #20342 from Veykril/push-zysqtqskuxvr
Veykril Jul 31, 2025
a7b01aa
`cargo clippy --fix`
Veykril Jul 31, 2025
ddc1b9f
Merge pull request #20349 from Veykril/push-orvqsnqtttzv
Veykril Jul 31, 2025
7c60865
Merge pull request #20345 from Hmikihiro/Migrate_add_trait_assoc_item…
ShoyuVanilla Jul 31, 2025
053f681
Update documentation for overrideCommand config options
iorizu Aug 1, 2025
7d16726
Fix more docs
iorizu Aug 1, 2025
81c4086
Migrate `convert_from_to_tryfrom` assist to use `SyntaxEditor`
Hmikihiro Aug 2, 2025
e314bfa
Migrate `generate_delegate_methods` assist to use `SyntaxEditor`
Hmikihiro Aug 2, 2025
4c6e804
Merge pull request #20358 from iorizu/issue-20346
ChayimFriedman2 Aug 2, 2025
ac34f3d
When renaming a parameter to `self`, change callers to use method cal…
ChayimFriedman2 Jul 31, 2025
f360d6c
Merge pull request #20351 from ChayimFriedman2/rename-self1
Veykril Aug 2, 2025
279b464
Merge pull request #20364 from Hmikihiro/migrate_convert_from_to_tryfrom
Veykril Aug 3, 2025
e47f791
Merge pull request #20368 from Hmikihiro/migrate_delegate_methods
Veykril Aug 3, 2025
b373cb1
Migrate `generate_trait_from_impl` assist to use `SyntaxEditor`
Hmikihiro Aug 3, 2025
0d2a7e6
Merge pull request #20371 from Hmikihiro/migrate_generate_trait_from_…
Veykril Aug 3, 2025
277cf46
Remove unused functions from edit_in_place
Hmikihiro Aug 3, 2025
efbe625
Merge pull request #20372 from Hmikihiro/remove_unused_fn_from_edit_i…
Veykril Aug 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/.github/workflows/rustc-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ jobs:
if: github.repository == 'rust-lang/rust-analyzer'
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
with:
github-app-id: ${{ vars.APP_CLIENT_ID }}
zulip-stream-id: 185405
zulip-bot-email: "[email protected]"
pr-base-branch: master
branch-name: rustc-pull
secrets:
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
github-app-secret: ${{ secrets.APP_PRIVATE_KEY }}
116 changes: 116 additions & 0 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"

[[package]]
name = "anstyle"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"

[[package]]
name = "anyhow"
version = "1.0.98"
Expand All @@ -44,6 +50,15 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"

[[package]]
name = "atomic-polyfill"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
dependencies = [
"critical-section",
]

[[package]]
name = "autocfg"
version = "1.4.0"
Expand Down Expand Up @@ -119,6 +134,12 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26c4925bc979b677330a8c7fe7a8c94af2dbb4a2d37b4a20a80d884400f46baa"

[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"

[[package]]
name = "camino"
version = "1.1.10"
Expand Down Expand Up @@ -287,6 +308,40 @@ dependencies = [
"tracing",
]

[[package]]
name = "clap"
version = "4.5.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882"
dependencies = [
"clap_builder",
]

[[package]]
name = "clap_builder"
version = "4.5.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966"
dependencies = [
"anstyle",
"clap_lex",
]

[[package]]
name = "clap_lex"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"

[[package]]
name = "cobs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
dependencies = [
"thiserror 2.0.12",
]

[[package]]
name = "countme"
version = "3.0.1"
Expand All @@ -308,6 +363,12 @@ dependencies = [
"cfg-if",
]

[[package]]
name = "critical-section"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"

[[package]]
name = "crossbeam-channel"
version = "0.5.15"
Expand Down Expand Up @@ -565,6 +626,15 @@ version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"

[[package]]
name = "hash32"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
dependencies = [
"byteorder",
]

[[package]]
name = "hashbrown"
version = "0.14.5"
Expand All @@ -591,6 +661,20 @@ dependencies = [
"hashbrown 0.15.4",
]

[[package]]
name = "heapless"
version = "0.7.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
dependencies = [
"atomic-polyfill",
"hash32",
"rustc_version",
"serde",
"spin",
"stable_deref_trait",
]

[[package]]
name = "hermit-abi"
version = "0.5.2"
Expand Down Expand Up @@ -1561,6 +1645,17 @@ version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"

[[package]]
name = "postcard"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24"
dependencies = [
"cobs",
"heapless",
"serde",
]

[[package]]
name = "potential_utf"
version = "0.1.2"
Expand Down Expand Up @@ -1608,13 +1703,16 @@ dependencies = [
"ra-ap-rustc_lexer 0.123.0",
"span",
"syntax-bridge",
"temp-dir",
"tt",
]

[[package]]
name = "proc-macro-srv-cli"
version = "0.0.0"
dependencies = [
"clap",
"postcard",
"proc-macro-api",
"proc-macro-srv",
"tt",
Expand Down Expand Up @@ -1991,6 +2089,15 @@ dependencies = [
"smallvec",
]

[[package]]
name = "rustc_version"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
dependencies = [
"semver",
]

[[package]]
name = "ryu"
version = "1.0.20"
Expand Down Expand Up @@ -2208,6 +2315,15 @@ dependencies = [
"vfs",
]

[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]

[[package]]
name = "stable_deref_trait"
version = "1.2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl EditionedFileId {

#[salsa_macros::input(debug)]
pub struct FileText {
#[returns(ref)]
pub text: Arc<str>,
pub file_id: vfs::FileId,
}
Expand Down Expand Up @@ -357,7 +358,7 @@ fn parse(db: &dyn RootQueryDb, file_id: EditionedFileId) -> Parse<ast::SourceFil
let _p = tracing::info_span!("parse", ?file_id).entered();
let (file_id, edition) = file_id.unpack(db.as_dyn_database());
let text = db.file_text(file_id).text(db);
ast::SourceFile::parse(&text, edition)
ast::SourceFile::parse(text, edition)
}

fn parse_errors(db: &dyn RootQueryDb, file_id: EditionedFileId) -> Option<&[SyntaxError]> {
Expand Down
8 changes: 4 additions & 4 deletions src/tools/rust-analyzer/crates/cfg/src/cfg_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ fn next_cfg_expr<S: Copy>(it: &mut tt::iter::TtIter<'_, S>) -> Option<CfgExpr> {
};

// Eat comma separator
if let Some(TtElement::Leaf(tt::Leaf::Punct(punct))) = it.peek() {
if punct.char == ',' {
it.next();
}
if let Some(TtElement::Leaf(tt::Leaf::Punct(punct))) = it.peek()
&& punct.char == ','
{
it.next();
}
Some(ret)
}
Expand Down
8 changes: 4 additions & 4 deletions src/tools/rust-analyzer/crates/hir-def/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ fn parse_repr_tt(tt: &crate::tt::TopSubtree) -> Option<ReprOptions> {
let mut align = None;
if let Some(TtElement::Subtree(_, mut tt_iter)) = tts.peek() {
tts.next();
if let Some(TtElement::Leaf(tt::Leaf::Literal(lit))) = tt_iter.next() {
if let Ok(a) = lit.symbol.as_str().parse() {
align = Align::from_bytes(a).ok();
}
if let Some(TtElement::Leaf(tt::Leaf::Literal(lit))) = tt_iter.next()
&& let Ok(a) = lit.symbol.as_str().parse()
{
align = Align::from_bytes(a).ok();
}
}
ReprOptions { align, ..Default::default() }
Expand Down
39 changes: 19 additions & 20 deletions src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1487,13 +1487,13 @@ impl ExprCollector<'_> {
ast::Expr::UnderscoreExpr(_) => self.alloc_pat_from_expr(Pat::Wild, syntax_ptr),
ast::Expr::ParenExpr(e) => {
// We special-case `(..)` for consistency with patterns.
if let Some(ast::Expr::RangeExpr(range)) = e.expr() {
if range.is_range_full() {
return Some(self.alloc_pat_from_expr(
Pat::Tuple { args: Box::default(), ellipsis: Some(0) },
syntax_ptr,
));
}
if let Some(ast::Expr::RangeExpr(range)) = e.expr()
&& range.is_range_full()
{
return Some(self.alloc_pat_from_expr(
Pat::Tuple { args: Box::default(), ellipsis: Some(0) },
syntax_ptr,
));
}
return e.expr().and_then(|expr| self.maybe_collect_expr_as_pat(&expr));
}
Expand Down Expand Up @@ -2569,19 +2569,18 @@ impl ExprCollector<'_> {
}
}
RibKind::MacroDef(macro_id) => {
if let Some((parent_ctx, label_macro_id)) = hygiene_info {
if label_macro_id == **macro_id {
// A macro is allowed to refer to labels from before its declaration.
// Therefore, if we got to the rib of its declaration, give up its hygiene
// and use its parent expansion.

hygiene_id =
HygieneId::new(parent_ctx.opaque_and_semitransparent(self.db));
hygiene_info = parent_ctx.outer_expn(self.db).map(|expansion| {
let expansion = self.db.lookup_intern_macro_call(expansion.into());
(parent_ctx.parent(self.db), expansion.def)
});
}
if let Some((parent_ctx, label_macro_id)) = hygiene_info
&& label_macro_id == **macro_id
{
// A macro is allowed to refer to labels from before its declaration.
// Therefore, if we got to the rib of its declaration, give up its hygiene
// and use its parent expansion.

hygiene_id = HygieneId::new(parent_ctx.opaque_and_semitransparent(self.db));
hygiene_info = parent_ctx.outer_expn(self.db).map(|expansion| {
let expansion = self.db.lookup_intern_macro_call(expansion.into());
(parent_ctx.parent(self.db), expansion.def)
});
}
}
_ => {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ impl ExprCollector<'_> {
}
};

if let Some(operand_idx) = operand_idx {
if let Some(position_span) = to_span(arg.position_span) {
mappings.push((position_span, operand_idx));
}
if let Some(operand_idx) = operand_idx
&& let Some(position_span) = to_span(arg.position_span)
{
mappings.push((position_span, operand_idx));
}
}
}
Expand Down
21 changes: 11 additions & 10 deletions src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,17 @@ pub(super) fn lower_path(
// Basically, even in rustc it is quite hacky:
// https://github.com/rust-lang/rust/blob/614f273e9388ddd7804d5cbc80b8865068a3744e/src/librustc_resolve/macros.rs#L456
// We follow what it did anyway :)
if segments.len() == 1 && kind == PathKind::Plain {
if let Some(_macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) {
let syn_ctxt = collector.expander.ctx_for_range(path.segment()?.syntax().text_range());
if let Some(macro_call_id) = syn_ctxt.outer_expn(collector.db) {
if collector.db.lookup_intern_macro_call(macro_call_id.into()).def.local_inner {
kind = match resolve_crate_root(collector.db, syn_ctxt) {
Some(crate_root) => PathKind::DollarCrate(crate_root),
None => PathKind::Crate,
}
}
if segments.len() == 1
&& kind == PathKind::Plain
&& let Some(_macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast)
{
let syn_ctxt = collector.expander.ctx_for_range(path.segment()?.syntax().text_range());
if let Some(macro_call_id) = syn_ctxt.outer_expn(collector.db)
&& collector.db.lookup_intern_macro_call(macro_call_id.into()).def.local_inner
{
kind = match resolve_crate_root(collector.db, syn_ctxt) {
Some(crate_root) => PathKind::DollarCrate(crate_root),
None => PathKind::Crate,
}
}
}
Expand Down
12 changes: 5 additions & 7 deletions src/tools/rust-analyzer/crates/hir-def/src/expr_store/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,14 +900,12 @@ impl Printer<'_> {
let field_name = arg.name.display(self.db, edition).to_string();

let mut same_name = false;
if let Pat::Bind { id, subpat: None } = &self.store[arg.pat] {
if let Binding { name, mode: BindingAnnotation::Unannotated, .. } =
if let Pat::Bind { id, subpat: None } = &self.store[arg.pat]
&& let Binding { name, mode: BindingAnnotation::Unannotated, .. } =
&self.store.assert_expr_only().bindings[*id]
{
if name.as_str() == field_name {
same_name = true;
}
}
&& name.as_str() == field_name
{
same_name = true;
}

w!(p, "{}", field_name);
Expand Down
Loading
Loading