aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge #6220bors[bot]2020-10-153-5/+126
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * | binary operator overload type inference: add test markRoland Ruckerbauer2020-10-142-0/+6
| | |
| * | Implement binary operator overloading type inferenceRoland Ruckerbauer2020-10-133-5/+120
| | |
* | | Merge #6244bors[bot]2020-10-151-0/+12
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6244: Document awkward names r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Document awkward namesAleksey Kladov2020-10-151-0/+12
|/ / /
* | | Merge #6243bors[bot]2020-10-1511-215/+228
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6243: Clarify classification API r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Clarify the names one more timeAleksey Kladov2020-10-157-17/+26
| | | |
| * | | More idiomatic classification APIAleksey Kladov2020-10-1511-196/+196
| | | |
| * | | More clarificationsAleksey Kladov2020-10-156-17/+17
| | | |
| * | | Unconfuse expression and pattern field init shorthandsAleksey Kladov2020-10-153-8/+12
| | | |
| * | | Clarify NameClass names a bitAleksey Kladov2020-10-156-7/+7
|/ / /
* | | Merge #6242bors[bot]2020-10-152-91/+210
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6242: Diagnost shorthand in patterns r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Move field_shorthand to a separate moduleAleksey Kladov2020-10-152-196/+211
| | | |
| * | | Diagnose shorthand in patterns as wellAleksey Kladov2020-10-151-5/+94
| | | |
| * | | flattenAleksey Kladov2020-10-151-26/+33
| | | |
| * | | Prepare for pat_field_shorthandAleksey Kladov2020-10-151-5/+13
| | | |
* | | | Merge #6234bors[bot]2020-10-151-1/+24
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * | | Fix hover over field pattern shorthandVlad Shcherbina2020-10-141-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of the information about the field, it now shows the information about the local. Fixes #6146
* | | | Merge #6240bors[bot]2020-10-151-0/+55
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6240: Document auto_import as a feature r=Veykril a=Veykril Closes #6225 Co-authored-by: Lukas Wirth <[email protected]>
| * | | | Document auto_import as a featureLukas Wirth2020-10-151-0/+55
| | | | |
* | | | | Merge #6236bors[bot]2020-10-151-2/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * | | | | Insert a ZWNJ before type hintsLaurențiu Nicola2020-10-151-2/+4
| | | | | |
* | | | | | Merge #6239bors[bot]2020-10-151-0/+7
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6239: Cleanup alloc advice r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | | | Cleanup alloc adviceAleksey Kladov2020-10-151-0/+7
|/ / / / /
* | | | | Merge #6231bors[bot]2020-10-143-190/+231
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * | | | | Default::default the highlightersLukas Wirth2020-10-143-18/+7
| | | | | |
| * | | | | Factor macro_rules! highlighting outLukas Wirth2020-10-142-117/+154
| | | | | |
| * | | | | Factor format string highlighting outLukas Wirth2020-10-142-75/+90
| | |_|/ / | |/| | |
* | | | | Merge #6233bors[bot]2020-10-141-0/+25
|\ \ \ \ \ | |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6233: Style: default over new r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | | Style: default over newAleksey Kladov2020-10-141-0/+25
|/ / / /
* | | | Merge #6230bors[bot]2020-10-141-0/+4
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | 6230: Log around sysroot discovery r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | Log around sysroot discoveryAleksey Kladov2020-10-141-0/+4
|/ / /
* | | Merge #6229bors[bot]2020-10-141-0/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6229: Add docs for dbgr and call r=matklad a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
| * | | Add docs for dbgr and callLaurențiu Nicola2020-10-141-0/+2
| | |/ | |/|
* | | Merge #6228bors[bot]2020-10-141-1/+6
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | 6228: Introduce S-actionable and S-unactionable labels r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Introduce S-actionable and S-unactionable labelsAleksey Kladov2020-10-141-1/+6
|/ / | | | | | | | | | | | | | | | | | | 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!
| |
| \
| \
| \
| \
| \
*-----. \ Merge #6207 #6224 #6226 #6227bors[bot]2020-10-148-247/+359
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`: https://github.com/rust-analyzer/rust-analyzer/blob/81fa00c5b5d5ffb559a39c7ff5190a2519a8ea61/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: :arrow_up: 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 <[email protected]> Co-authored-by: Aleksey Kladov <[email protected]>
| | | | * | Reduce bors timeoutAleksey Kladov2020-10-141-0/+1
| |_|_|/ / |/| | | |
| | | * | Add reminder to update lsp-extensions.mdAleksey Kladov2020-10-142-0/+55
| |_|/ / |/| | |
* | | | Merge #6217bors[bot]2020-10-143-17/+20
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6217: Bump pulldown-cmark r=matklad a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
| * | | | Bump pulldown-cmarkLaurențiu Nicola2020-10-133-17/+20
| | |_|/ | |/| |
* | | | Merge #6222bors[bot]2020-10-143-2/+53
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * | | Fix stackoverflow in insert_use::recursive_mergeLukas Wirth2020-10-143-2/+53
|/ / /
| | * :arrow_up: salsaAleksey Kladov2020-10-142-6/+6
| |/ |/|
* | Merge #6216bors[bot]2020-10-136-31/+58
|\ \ | | | | | | | | | | | | | | | | | | | | | 6216: Bump deps r=matklad a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
| * | Bump regexLaurențiu Nicola2020-10-131-4/+4
| | |
| * | Bump rustc_lexerLaurențiu Nicola2020-10-132-3/+3
| | |
| * | Bump crossbeam-channel and lsp-server in rust-analyzerLaurențiu Nicola2020-10-132-6/+6
| | |
| * | Bump crossbeam-channel in cratesLaurențiu Nicola2020-10-134-15/+43
| | |
| * | Bump some depsLaurențiu Nicola2020-10-131-8/+8
| | |