11274: internal: Unexport `MacroDefId` from `hir` r=jonas-schievink a=jonas-schievink
It's not used outside of it
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11266: internal: Mostly restore `hir` API boundary r=jonas-schievink a=jonas-schievink
The boundary was broken in https://github.com/rust-analyzer/rust-analyzer/pull/10872 by reexporting a bunch of `hir_def`-internal types.
This PR moves symbol collection to `hir` and removes those reexports again.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11261: fix: Don't complete attributes with existing expressions r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11254 due to the comment being lowered to an attribute
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11258: Kate uses rust-analyzer by default now r=jonas-schievink a=milliams
Since Kate 21.12 rust-analyzer is the default. See this Kate MR: https://invent.kde.org/utilities/kate/-/merge_requests/495
Co-authored-by: Matt Williams <matt@milliams.com>
11257: feat: Report `DefDiagnostic`s from inside item bodies r=jonas-schievink a=jonas-schievink
Reports diagnostics from all block-level `DefMap`s, and adds some code to avoid adding duplicate diagnostics to the body's `SourceMap`.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11247: Print a single ellipsis for any number of omitted types r=jonas-schievink a=jonas-schievink
Helps a little bit with https://github.com/rust-analyzer/rust-analyzer/issues/11240
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11238: fix: shrink the span of errors from attribute macros and derives r=jonas-schievink a=jonas-schievink
Some procedural macros tend to get very large invocations, for example RTIC's, leading to issues like https://github.com/rtic-rs/cortex-m-rtic/issues/582, where almost the entire screen is underlined while editing incomplete code in the macro.
This PR shrinks the spans of errors from attribute macros and derives to point only at the attribute, which also matches rustc more closely.
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
11236: internal: Remove `InFile` wrapping from `DynMap` keys r=Veykril a=Veykril
We already store a `DynMap` per `(Container, HirFileId)` pair, so the `InFile` keys are already guruanteed to always be of the same file id
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11107: Fix generic type substitution in impl trait with assoc type r=pnevyk a=pnevyk
Fixes#11045
The path transform now detects if a type parameter that is being substituted has an associated type. In that case it is necessary (or safe in general case) to fully qualify the substitution with a trait which the associated type belongs to.
This PR also fixes the previous wrong behavior of the substitution that could create an invalid tree `PATH_TYPE -> PATH_TYPE -> ...`.
Co-authored-by: Petr Nevyhoštěný <petr.nevyhosteny@gmail.com>
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj
Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields
before:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {<|>};
}
```
after:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {
text: String::new(),
num: 0,
other: todo!(),
};
}
```
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
11220: Turbo fish assist: don't include lifetime parameters r=Veykril a=Vannevelj
Fixes#11219
The issue talks about three different types of params: type, const & lifetime. I wasn't entirely sure which ones are intended to be included here so I've gone for the type & const params (i.e. exclude lifetime).
I've added a test case for both a lifetime param and a const param. I'm still making my way through the rust book (chapter 7, yay) so I'm not too sure yet what these are but my testing shows that this approach generates code that compiles.
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>