Lukas Wirth
14cc41f2ba
Merge pull request #20438 from A4-Tacks/fix-guess-renamed-macro-braces
...
Fix guess renamed macro braces
2025-12-21 14:18:55 +00:00
Chayim Refael Friedman
8f28e82a4f
Merge pull request #21212 from A4-Tacks/comp-try-let-default-varname
...
Add default varname for TryEnum postfix completion
2025-12-21 06:13:23 +00:00
A4-Tacks
847317ccba
Add default varname for TryEnum postfix completion
...
Example
---
```rust
fn main() {
let bar = Some(true);
bar.i$0
}
```
**Before this PR**
```rust
fn main() {
let bar = Some(true);
if let Some($1) = bar {
$0
}
}
```
**After this PR**
```rust
fn main() {
let bar = Some(true);
if let Some(${1:bar}) = bar {
$0
}
}
```
2025-12-21 13:55:21 +08:00
Chayim Refael Friedman
961fd33e8e
Merge pull request #21310 from ChayimFriedman2/remove-attach-db
...
minor: Remove some redundant `attach_db()`s
2025-12-21 05:53:58 +00:00
Chayim Refael Friedman
b5fbcc6917
Merge pull request #21166 from A4-Tacks/fly-closure-this-param
...
Support undotted-self for `this` param closure
2025-12-21 05:37:24 +00:00
Chayim Refael Friedman
65c14db957
Remove some redundant attach_db()s
2025-12-21 07:10:19 +02:00
Chayim Refael Friedman
cbc18ae50c
Merge pull request #21289 from A4-Tacks/add-ref-matched-type
...
Complete reference `&T` -> `&&T`
2025-12-21 05:08:04 +00:00
A4-Tacks
f8f69b2a61
Complete reference &T -> &&T
...
Example
---
```rust
struct S;
fn foo(s: &&S) {}
fn main() {
let mut ssss = &S;
foo($0);
}
```
**Before this PR**
```rust
st S S []
lc ssss &S [local]
st S S []
fn foo(…) fn(&&S) []
fn main() fn() []
```
**After this PR**
```rust
st S S []
lc ssss &S [local]
lc &ssss [type+local]
st S S []
fn foo(…) fn(&&S) []
fn main() fn() []
```
2025-12-21 12:58:12 +08:00
A4-Tacks
f0055f6557
Add parent_match method to node_ext
2025-12-21 12:54:47 +08:00
A4-Tacks
e1747f9ddf
Fix match arm nested body invalid expected type
...
Example
---
```rust
struct Foo;
enum E { X }
fn foo() -> Foo {
match E::X { Foo::X => { $0 } }
}
```
**Before this PR**
```text
ty: E, name: ?
```
**After this PR**
```text
ty: Foo, name: ?
```
2025-12-17 17:35:33 +08:00
Chayim Refael Friedman
92630ee98a
Merge pull request #21278 from A4-Tacks/mut-ref-type-match
...
Fix complete reference for `&mut ty` -> `&ty`
2025-12-16 08:52:33 +00:00
Chayim Refael Friedman
0023f193e6
Merge pull request #21277 from A4-Tacks/strip-deref
...
Fix expected type no strip deref
2025-12-16 03:30:06 +00:00
A4-Tacks
d13d63c0a7
Fix add reference for &mut ty -> &ty
...
Example
---
```rust
fn foo(r: &mut i32) -> &i32 { $0 }
```
**Before this PR**
`lc &r [type+local]`
This is a compilation error
```rust
fn foo(r: &mut i32) -> &i32 { &r }
```
**After this PR**
`lc r &mut i32 [type+local]`
```rust
fn foo(r: &mut i32) -> &i32 { r }
```
2025-12-16 11:00:10 +08:00
A4-Tacks
d359992184
Fix expected type no strip deref
...
Example
---
```rust
fn main() {
let r = &2;
let _: fn() -> i32 = || *$0;
}
```
**Before this PR**
`ty: &'_ u32, name: x`
```rust
fn main() {
let r = &2;
let _: fn() -> i32 = || **r;
}
```
**After this PR**
`ty: &'_ &'_ u32, name: x`
```rust
fn main() {
let r = &2;
let _: fn() -> i32 = || *r;
}
```
2025-12-16 10:20:40 +08:00
Chayim Refael Friedman
87cfc881f1
Merge pull request #21032 from A4-Tacks/no-semicolon-in-arg-list
...
Fix complete unit return semicolon in arg-list
2025-12-16 01:10:02 +00:00
The rustc-josh-sync Cronjob Bot
f6c67ed0a4
Format code
2025-12-15 04:30:49 +00:00
The rustc-josh-sync Cronjob Bot
2d06e40dd0
Merge ref '0208ee09be46' from rust-lang/rust
...
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: 0208ee09be465f69005a7a12c28d5eccac7d5f34
Filtered ref: 69b2702db74151cd410a028fb347c6e4e3f779dc
Upstream diff: dfe1b8c97b...0208ee09be
This merge was created using https://github.com/rust-lang/josh-sync .
2025-12-15 04:30:45 +00:00
Jieyou Xu
acb575c6ab
rust-analyzer: prep crates for testing against in-tree rustc_private
2025-12-11 20:22:49 +08:00
Shoyu Vanilla (Flint)
5375f11482
Merge pull request #21210 from A4-Tacks/comp-unescaped-brace-fmt-str
...
Fix not complete `format!("{{{$0")` and underscore
2025-12-09 04:26:01 +00:00
Lukas Wirth
5e3e9c4e61
Merge pull request #21222 from A4-Tacks/no-comp-resugar-unit-ret-ty
...
No complete unit RetType in resugar async assoc item
2025-12-07 15:06:49 +00:00
A4-Tacks
5955a29f6a
No complete unit RetType in resugar async assoc item
...
Example
---
```rust
use core::future::Future;
trait DesugaredAsyncTrait {
fn foo(&self) -> impl Future<Output = ()> + Send;
}
impl DesugaredAsyncTrait for () {
$0
}
```
**Before this PR**
```rust
use core::future::Future;
trait DesugaredAsyncTrait {
fn foo(&self) -> impl Future<Output = ()> + Send;
}
impl DesugaredAsyncTrait for () {
async fn foo(&self) -> () {
$0
}
}
```
**After this PR**
```rust
use core::future::Future;
trait DesugaredAsyncTrait {
fn foo(&self) -> impl Future<Output = ()> + Send;
}
impl DesugaredAsyncTrait for () {
async fn foo(&self) {
$0
}
}
```
2025-12-07 21:18:40 +08:00
Lukas Wirth
30550d917b
Make ModuleId a tracked struct
...
optimize some stuff
Optimize `pub(crate)` visibility resolution
Optimize private visibility resolution
2025-12-07 09:31:19 +01:00
A4-Tacks
26790f02e3
Fix not complete format!("{{{$0") and underscore
...
Example
---
```rust
fn main() {
let foobar = 1;
format_args!("{{{f$0");
}
```
**Before this PR**
No complete
**After this PR**
```rust
fn main() {
let foobar = 1;
format_args!("{{{foobar");
}
```
---
```rust
fn main() {
let foo_bar = 1;
format_args!("{foo_$0}");
}
```
**Before this PR**
No complete
**After this PR**
```rust
fn main() {
let foo_bar = 1;
format_args!("{foo_bar}");
}
```
2025-12-05 23:15:58 +08:00
Lukas Wirth
86779be51d
Merge pull request #21183 from ChayimFriedman2/define-opaque
...
fix: Register `define_opaque` builtin attribute macro
2025-12-04 07:57:54 +00:00
Chayim Refael Friedman
0b6dc8648b
Merge pull request #21198 from A4-Tacks/nested-incomplete-let-semi
...
Fix nested expr missing semicolon in incomplete-let
2025-12-03 11:16:26 +00:00
A4-Tacks
109251d3f5
Fix nested expr missing semicolon in incomplete-let
...
Example
---
```rust
fn main() {
let x = &$0
}
```
**Before this PR**
```rust
fn main() {
let x = &loop {
$0
}
}
```
**After this PR**
```rust
fn main() {
let x = &loop {
$0
};
}
```
2025-12-03 19:06:03 +08:00
Lukas Wirth
686320cc52
Merge pull request #21188 from Wilfred/fix_rustdoc_and_add_ci
...
Fix rustdoc warnings and add CI
2025-12-03 08:51:04 +00:00
Wilfred Hughes
86bc07e91a
Fix rustdoc warnings and add CI
...
rustdoc has a separate environment variable for banning warnings, so
set that in the GitHub action configuration.
https://github.com/rust-lang/cargo/issues/8424#issuecomment-1070988443
Fix all the rustdoc warnings on unknown types or functions. I've
updated references wherever it's obvious, otherwise I've replaced the
rustdoc link with plain backticks.
There were also some cases where rustdoc links referred to private
APIs. I've disabled the rustdoc private API warning in those crates.
2025-12-01 13:06:15 +00:00
The rustc-josh-sync Cronjob Bot
4f45c093e1
Merge ref 'dfe1b8c97bcd' from rust-lang/rust
...
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: dfe1b8c97bcde283102f706d5dcdc3649e5e12e3
Filtered ref: d3d1f3831e6b7fa73889d90bc8dd56d22cb80834
Upstream diff: 1be6b13be7...dfe1b8c97b
This merge was created using https://github.com/rust-lang/josh-sync .
2025-12-01 04:34:35 +00:00
Chayim Refael Friedman
a4612ce527
Register define_opaque builtin attribute macro
...
So that we'll correctly treat it as an attribute.
I don't like that we have to register every builtin macro even if we don't need it, but that's what we got.
2025-12-01 02:31:30 +02:00
Chayim Refael Friedman
b92767700a
Make Semantics::attach_first_edition() not return Option
...
And instead call `EditionedFileId::current_edition_guess_origin`, as most callers do it anyway.
2025-11-29 18:52:18 +02:00
Chayim Refael Friedman
f0e372c3b6
Rewrite attribute handling
...
Basically, we switch to expanding cfg_attr in AST form, filter irrelevant attributes from the item tree, and move hir-def attributes (non-item-tree) to be flag-based.
The main motivation is memory usage, although this also simplifies the code, and fixes some bugs around handling of `cfg_attr`s.
2025-11-29 18:52:18 +02:00
Chayim Refael Friedman
e326797e60
Merge pull request #21149 from ChayimFriedman2/lang-items
...
perf: Use one query per crate for lang items, not one per lang item
2025-11-29 16:19:38 +00:00
A4-Tacks
2f8f6e7bf1
Support undotted-self for this param closure
...
Using `this` instead of `self` in a closure is a common pattern
Example
---
```rust
struct Foo { field: i32 }
impl Foo {
fn foo(&mut self) {
let f: fn(&mut Self) = |this| { $0 };
f(self)
}
}
```
**Before this PR**
```text
fd self.field i32
me self.foo() fn(&mut self)
lc self &mut Foo
lc this &mut Foo
md core
sp Self Foo
st Foo Foo
tt Fn
tt FnMut
tt FnOnce
bt u32 u32
```
**After this PR**
```text
fd this.field i32
me this.foo() fn(&mut self)
lc self &mut Foo
lc this &mut Foo
md core
sp Self Foo
st Foo Foo
tt Fn
tt FnMut
tt FnOnce
bt u32 u32
```
2025-11-29 17:01:48 +08:00
Chayim Refael Friedman
19284866f9
Merge pull request #21144 from A4-Tacks/abi-qualifier-extern-crate-comp
...
Fix complete after `extern`, add `crate` completion
2025-11-28 03:07:40 +00:00
Chayim Refael Friedman
d9bee82688
Use one query per crate for lang items, not one per lang item
...
Lang items rarely change, so putting a query for each doesn't give us anything. On the other hand, putting them behind only one query not only saves memory, it also has a giant benefit: we can store the struct with all lang items in the interner, making access to them very cheap. That basically means that anything in the hot path can avoid a *very common* query, and exchange it for a simple field access.
2025-11-28 03:28:44 +02:00
Matthias Krüger
c6eb342017
Rollup merge of #149390 - lnicola:sync-from-ra, r=lnicola
...
`rust-analyzer` subtree update
Subtree update of `rust-analyzer` to a2a4a9525a .
Created using https://github.com/rust-lang/josh-sync .
r? `@ghost`
2025-11-27 20:07:16 +01:00
Lukas Wirth
619ebf8552
Merge pull request #21095 from A4-Tacks/autoderef-skipiter
...
Fix skipiter not applicable in autoderef
2025-11-27 08:31:19 +00:00
Shoyu Vanilla (Flint)
ffa9cfab3c
Merge pull request #20976 from A4-Tacks/comp-after-top-inner-attr
...
Fix not complete after inner-attr in source-file
2025-11-27 06:36:13 +00:00
Shoyu Vanilla (Flint)
f5a46ef424
Merge pull request #21028 from A4-Tacks/comp-pattern-alias
...
Fix not complete type alias in pattern
2025-11-27 06:06:53 +00:00
A4-Tacks
8e58663c79
Fix complete after extern, add crate completion
...
Example
---
```rust
extern "C" $0
```
**Before this PR**
Can't be completion
**After this PR**
```text
kw async
kw const
kw enum
kw fn
kw impl
kw impl for
kw mod
kw pub
kw pub(crate)
kw pub(super)
kw static
kw struct
kw trait
kw type
kw union
kw unsafe
kw use
```
---
```rust
extern $0
```
**Before this PR**
Can't be completion
**After this PR**
```rust
extern crate $0;
```
2025-11-27 13:40:42 +08:00
Stuart Cook
276212c676
Rollup merge of #149270 - jdonszelmann:exact-length-collection, r=Mark-Simulacrum
...
implement `Iterator::{exactly_one, collect_array}`
As per https://github.com/rust-lang/rust/issues/149266
2025-11-27 15:47:08 +11:00
Lukas Wirth
5d617f940b
completions: Fix completions disregarding snippet capabilities
2025-11-26 08:01:52 +01:00
Laurențiu Nicola
45ae0abfed
Merge pull request #21126 from A4-Tacks/arglist-nr-error-comma
...
fix: fix parameter info with missing arguments
2025-11-25 12:50:22 +00:00
A4-Tacks
1d40867fc8
Fix invalid completion arg nr
...
Example
---
```rust
fn foo() { bar(, $0); }
fn bar(x: u32, y: i32) {}
```
**Before this PR**
```text
ty: u32, name: x
```
**After this PR**
```text
ty: i32, name: y
```
2025-11-25 16:13:59 +08:00
Jana Dönszelmann
116993d9bb
fixup warnings around the compiler
2025-11-24 17:14:26 +01:00
A4-Tacks
6c75b7e828
Fix duplicate const complete after raw
...
Example
---
```rust
fn main() { let _ = &raw $0 }
```
**Before this PR**
```text
fn main() fn()
bt u32 u32
kw const
kw const
kw crate::
...
```
**After this PR**
```text
fn main() fn()
bt u32 u32
kw const
kw crate::
...
```
2025-11-24 10:18:01 +08:00
Lukas Wirth
d597ef1a4c
Merge pull request #21065 from A4-Tacks/refutable-in-pat-field
...
Fix always irrefutable in RecordPatField
2025-11-23 12:37:03 +00:00
A4-Tacks
28751286a8
Fix skipiter not applicable in autoderef
...
Example
---
**std example**:
```rust
fn foo(nums: std::rc::Rc<[i32]>) {
nums.$0
}
```
---
**minicore example**:
```rust
struct Foo;
impl Foo { fn iter(&self) -> Iter { Iter } }
impl IntoIterator for &Foo {
type Item = ();
type IntoIter = Iter;
fn into_iter(self) -> Self::IntoIter { Iter }
}
struct Ref;
impl core::ops::Deref for Ref {
type Target = Foo;
fn deref(&self) -> &Self::Target { &Foo }
}
struct Iter;
impl Iterator for Iter {
type Item = ();
fn next(&mut self) -> Option<Self::Item> { None }
}
fn foo() {
Ref.$0
}
```
**Before this PR**
```text
me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter() fn(&self) -> Iter
```
**After this PR**
```text
me deref() (use core::ops::Deref) fn(&self) -> &<Self as Deref>::Target
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter() fn(&self) -> Iter
me iter().by_ref() (as Iterator) fn(&mut self) -> &mut Self
me iter().into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
me iter().next() (as Iterator) fn(&mut self) -> Option<<Self as Iterator>::Item>
me iter().nth(…) (as Iterator) fn(&mut self, usize) -> Option<<Self as Iterator>::Item>
```
2025-11-22 16:41:01 +08:00
A4-Tacks
992e6c092e
Completion = $0 after keyval cfg predicate
...
Example
---
```rust
//- /main.rs cfg:test,dbg=false,opt_level=2
#[cfg($0)]
```
**Before this PR**
```rust
#[cfg(opt_level)]
```
**After this PR**
```rust
#[cfg(opt_level = $0)]
```
2025-11-21 18:31:40 +08:00