Declaration names sounds like a name of declaration -- something you
can use for analysis. It empathically isn't, and is just a label
displayed in various UI. It's important not to confuse the two, least
we accidentally mix semantics with UI (I believe, there's already a
case of this in the FamousDefs at least).
The proper fix I think is:
* move rust-lang/rust library crates to a separate workspace
* when packaging rust-src component, vendor sources of external deps
This errro specifically:
Updating crates.io index
error: failed to select a version for the requirement `ra_ap_stdx = "^0.0.0"`
candidate versions found which didn't match: 0.0.20
location searched: /home/runner/work/rust-analyzer/rust-analyzer/crates/stdx
required by package `ra_ap_completion v0.0.20 (/home/runner/work/rust-analyzer/rust-analyzer/crates/completion)`
error: unable to update Cargo.lock
Error: Process completed with exit code 1.
6246: Follow symlinks when walking project trees r=lnicola a=dfoxfranke
Fixes#3691.
~~WIP pending further testing~~:
- [X] Verify that symlinked files get indexed.
- [x] Verify that files in symlinked directories get indexed.
- [x] Verify that inotify events are properly received and handled when the target of a symlink resides outside the project tree.
Co-authored-by: Daniel Fox Franke <dfoxfranke@gmail.com>
6220: implement binary operator overloading type inference r=flodiebold a=ruabmbua
Extend type inference of *binary operator expression*, by adding support for operator overloads.
Before this merge request, the type inference of binary expressions could only resolve operations done on built-in primitive types. This merge requests adds a code path, which is executed in case the built-in inference could not get any results. It resolves the proper operator overload trait in *core::ops* via lang items, and then resolves the associated *Output* type.
```rust
struct V2([f32; 2]);
#[lang = "add"]
pub trait Add<Rhs = Self> {
/// The resulting type after applying the `+` operator.
type Output;
/// Performs the `+` operation.
#[must_use]
fn add(self, rhs: Rhs) -> Self::Output;
}
impl Add<V2> for V2 {
type Output = V2;
fn add(self, rhs: V2) -> V2 {
let x = self.0[0] + rhs.0[0];
let y = self.0[1] + rhs.0[1];
V2([x, y])
}
}
fn test() {
let va = V2([0.0, 1.0]);
let vb = V2([0.0, 1.0]);
let r = va + vb; // This infers to V2 now
}
```
There is a problem with operator overloads, which do not explicitly set the *Rhs* type parameter in the respective impl block.
**Example:**
```rust
impl Add for V2 {
type Output = V2;
fn add(self, rhs: V2) -> V2 {
let x = self.0[0] + rhs.0[0];
let y = self.0[1] + rhs.0[1];
V2([x, y])
}
}
```
In this case, the trait solver does not realize, that the *Rhs* type parameter is actually self in the context of the impl block. This stops type inference in its tracks, and it can not resolve the associated *Output* type.
I guess we can still merge this back, because it increases the amount of resolved types, and does not regress anything (in the tests).
Somewhat blocked by https://github.com/rust-analyzer/rust-analyzer/issues/5685
Resolves https://github.com/rust-analyzer/rust-analyzer/issues/5544
Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
6234: Fix hover over field pattern shorthand r=matklad a=Vlad-Shcherbina
Instead of the information about the field, it now shows the information
about the local.
Fixes#6146
Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
6231: Factor macro_rules and format-string highlighting out into submodules r=Veykril a=Veykril
This moves `format`-like macro string highlighting and macro_rules highlight skipping out of the main module.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
6207: Extract ImportAssets out of auto_import r=matklad a=Veykril
See https://github.com/rust-analyzer/rust-analyzer/pull/6172#issuecomment-707182140
I couldn't fully pull out `AssistContext` as `find_node_at_offset_with_descend`: 81fa00c5b5/crates/assists/src/assist_context.rs (L90-L92) requires the `SourceFile` which is private in it and I don't think making it public just for this is the right call?
6224: ⬆️ salsa r=matklad a=matklad
bors r+
🤖
6226: Add reminder to update lsp-extensions.md r=matklad a=matklad
bors r+
🤖
6227: Reduce bors timeout r=matklad a=matklad
bors r+
🤖
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>