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>
6236: Code: Insert a ZWNJ before `after` type hints r=matklad a=lnicola
to prevent the editor from displaying a ligature there.
Fixes#6235
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
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>
I've noticed that a significant fraction of issues are inert.
They are valid, acknowledged and useful, but effectively can't be
fixed for variety of reasons (no reproduction, dependencies on some
other issues, no review capacity, etc).
Marking issues that can be fixed by just applying some elbow grease
seems useful!
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>
6222: Fix stackoverflow in insert_use::recursive_merge r=matklad a=Veykril
Fixes#6221.
#6108 shouldn't be related to this as autocompletion doesn't depend on this code.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>