Commit graph

21087 commits

Author SHA1 Message Date
Florian Diebold 82fe1c77b5 Add a (currently failing) test for #11242 2022-03-03 18:32:40 +01:00
bors[bot] a55dd29e88
Merge #11593
11593: Build release binaries on Ubuntu 18.04 r=lnicola a=lnicola

Fixes #11558

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-01 18:27:04 +00:00
Laurențiu Nicola f60d300300 Build release binaries on Ubuntu 18.04 2022-03-01 07:24:27 +02:00
bors[bot] 342c3c42bb
Merge #11433
11433: minor: Add scary warning to `onEnter` r=lnicola a=lnicola

Closes #11432

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-28 10:15:44 +00:00
Laurențiu Nicola 6bf97692ae Add scary warning to onEnter 2022-02-28 12:15:15 +02:00
bors[bot] 415be8bae5
Merge #11579
11579: minor: Future-proof against a next edition by using `>=` and not `==` r=lnicola a=ChayimFriedman2

So that we won't have a strange bug when edition 2024 will land.

rustc [also does that](427cf81206/compiler/rustc_builtin_macros/src/edition_panic.rs (L84)).

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-28 09:18:26 +00:00
Chayim Refael Friedman e6a35c28cb
Future-proof against a next edition by using >= and not ==
So that we won't have a strange bug when edition 2024 will land.

rustc [also does that](427cf81206/compiler/rustc_builtin_macros/src/edition_panic.rs (L84)).
2022-02-28 11:13:55 +02:00
bors[bot] 4e72700e38
Merge #11573
11573: refactorings and FIXME fixes in text edit r=lnicola a=HansAuger

This is mainly me learning some rust, and only anecdotally about addressing some `fixme`s. Feel free to nope :)

There is a follow up PR in the pipeline which tackles the other two `fixme`s but it's a bit more invasive. So I wanted to get this out of the way

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-02-27 12:00:04 +00:00
bors[bot] a53915c10d
Merge #11567
11567: Fix `if` in #11561 r=Veykril a=ChayimFriedman2

Fixes #11561.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-27 11:34:01 +00:00
bors[bot] bc2ce4c655
Merge #11570
11570: minor: Remove misleading comments r=lnicola a=ChayimFriedman2

They're not true anymore after #11375.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-02-27 09:17:46 +00:00
Chayim Refael Friedman 744f0ea2e7
Remove misleading comments
They're not true anymore after #11375.
2022-02-27 09:52:11 +02:00
Moritz Vetter ff59147d53 add two more unit tests for text_edit 2022-02-27 02:27:44 +01:00
Chayim Refael Friedman 54fe3dc0f1 Fix if in #11561 2022-02-27 00:19:45 +00:00
bors[bot] b86baa7092
Merge #11560
11560: internal: Update `url` to make `webrender` build when computing metrics r=jonas-schievink a=lnicola

Closes #9997

This doesn't seem to affect the metrics, but I'm not sure since somehow I get different values than what shows up on CI.

With `stable`:

```
  exprs: 94151, ??ty: 96 (0%), ?ty: 25 (0%), !ty: 6
```

CI shows 16.

Also, https://github.com/rust-analyzer/rust-analyzer/pull/7250 strikes again, I can never tell what those numbers are.

r? `@jonas-schievink`

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-26 17:00:11 +00:00
bors[bot] 5cade9bf33
Merge #11565
11565: fix: Fix body selection in while loops r=Veykril a=lnicola

CC #11561

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-26 16:49:16 +00:00
bors[bot] a153b18d6d
Merge #11566
11566: minor: Make hir::Local::name infallible r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 15:48:11 +00:00
Lukas Wirth 47ce4436e4 Make hir::Local::name infallible 2022-02-26 16:36:44 +01:00
Moritz Vetter 21d497b773 refact: edit text in place in TextEdit::apply 2022-02-26 15:50:09 +01:00
Moritz Vetter c541f3396c test: add unit test for TextEdit::apply() 2022-02-26 15:46:14 +01:00
Laurențiu Nicola 87c4a4104d Fix body selection in while loops 2022-02-26 16:45:06 +02:00
bors[bot] 719babd9f7
Merge #11564
11564: internal: Cleanup highlighting tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 13:53:30 +00:00
Lukas Wirth 36603e0478 Rename test highlighting output files 2022-02-26 14:52:42 +01:00
Lukas Wirth c99fb4b1ac Split up highlighting tests a bit more 2022-02-26 14:45:09 +01:00
Lukas Wirth 48189bc1b4 Re-order and cleanup highlighting tests 2022-02-26 14:29:03 +01:00
bors[bot] ddb5a53fd7
Merge #11562
11562: fix: Don't emit unresolvedReference highlight tags in unlinked files r=Veykril a=Veykril

Emitting these overwrites any syntax based highlighting that is being done in the file, causing a lot of noise if the user gave them a specific color.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-26 12:54:57 +00:00
Lukas Wirth 03d33556c9 fix: Don't emit unresolvedReference highlight tags in unlinked files 2022-02-26 13:53:54 +01:00
Laurențiu Nicola 3bb0635780 Update url to make webrender build 2022-02-26 11:56:57 +02:00
bors[bot] a2cc1d6b7b
Merge #11538
11538: feat: Make private editable completions configurable, disable by default r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10253
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9885

This does disable these completions by default, as it seems that people find this behaviour surprising(due to other IDEs usually not doing this).

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-25 21:17:24 +00:00
Lukas Wirth 2a7793d912 feat: Make private editable completions configurable, disable by default 2022-02-25 22:16:40 +01:00
bors[bot] 7096a0a14e
Merge #11554
11554: fix: fix type mismatches with `unreachable!` macro in Rust 1.59 r=jonas-schievink a=jonas-schievink

should fix https://github.com/rust-analyzer/rust-analyzer/issues/11551

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-02-25 18:14:04 +00:00
Jonas Schievink aec4bcf3f2 Implement the new built-in unreachable! macro 2022-02-25 19:13:04 +01:00
bors[bot] e1541bda94
Merge #11552
11552: fix: properly display `$crate` in hovers r=jonas-schievink a=jonas-schievink

We used to print it as `{extern_crate}`, this PR resolves it to the crate's name, or falls back to `$crate` if the crate has no name.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-02-25 17:41:05 +00:00
Jonas Schievink a247fffdf6 Resolve $crate in HirDisplay of Path 2022-02-25 18:38:51 +01:00
bors[bot] ab896e38e1
Merge #11550
11550: Refactor autoderef/method resolution r=flodiebold a=flodiebold

- don't return the receiver type from method resolution; instead just
 return the autorefs/autoderefs that happened and repeat them. This
 ensures all the effects like trait obligations and whatever we learned
 about type variables from derefing them are actually applied. Also, it
 allows us to get rid of `decanonicalize_ty`, which was just wrong in
 principle.

 - Autoderef itself now directly works with an inference table. Sadly
 this has the effect of making it harder to use as an iterator, often
 requiring manual `while let` loops. (rustc works around this by using
 inner mutability in the inference context, so that things like unifying
 types don't require a unique reference.)

 - We now record the adjustments (autoref/deref) for method receivers
 and index expressions, which we didn't before.

 - Removed the redundant crate parameter from method resolution, since
 the trait_env contains the crate as well.

 - in the HIR API, the methods now take a scope to determine the trait env.
 `Type` carries a trait env, but I think that's probably a bad decision
 because it's easy to create it with the wrong env, e.g. by using
 `Adt::ty`. This mostly didn't matter so far because
 `iterate_method_candidates` took a crate parameter and ignored
 `self.krate`, but the trait env would still have been wrong in those
 cases, which I think would give some wrong results in some edge cases.

Fixes #10058.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-25 16:11:22 +00:00
Florian Diebold 6fc3d3aa4c Avoid autoderef coercions leaking if they don't apply 2022-02-25 15:46:02 +01:00
bors[bot] c8257488c1
Merge #11549
11549: feat: support concat_bytes r=jonas-schievink a=ihciah

Support `concat_bytes`.
Solve #11544.

Co-authored-by: ihciah <ihciah@gmail.com>
2022-02-25 13:34:18 +00:00
Florian Diebold 187e6bacac Fix unreachable pub 2022-02-25 12:09:49 +01:00
bors[bot] 1d5df5ea94
Merge #11548
11548: Add CSV output to analysis-stats r=flodiebold a=flodiebold

For easy diffing, to find changes in unknown types / type mismatches.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-25 10:57:24 +00:00
Florian Diebold 6fb5abbc03 Refactor autoderef and method resolution
- don't return the receiver type from method resolution; instead just
 return the autorefs/autoderefs that happened and repeat them. This
 ensures all the effects like trait obligations and whatever we learned
 about type variables from derefing them are actually applied. Also, it
 allows us to get rid of `decanonicalize_ty`, which was just wrong in
 principle.

 - Autoderef itself now directly works with an inference table. Sadly
 this has the effect of making it harder to use as an iterator, often
 requiring manual `while let` loops. (rustc works around this by using
 inner mutability in the inference context, so that things like unifying
 types don't require a unique reference.)

 - We now record the adjustments (autoref/deref) for method receivers
 and index expressions, which we didn't before.

 - Removed the redundant crate parameter from method resolution, since
 the trait_env contains the crate as well.

 - in the HIR API, the methods now take a scope to determine the trait env.
 `Type` carries a trait env, but I think that's probably a bad decision
 because it's easy to create it with the wrong env, e.g. by using
 `Adt::ty`. This mostly didn't matter so far because
 `iterate_method_candidates` took a crate parameter and ignored
 `self.krate`, but the trait env would still have been wrong in those
 cases, which I think would give some wrong results in some edge cases.

Fixes #10058.
2022-02-25 11:47:14 +01:00
Florian Diebold 6858694001 Add some tests 2022-02-25 11:47:14 +01:00
ihciah 494fab202a
feat: support concat_bytes 2022-02-25 18:46:11 +08:00
Florian Diebold f807ccd6c0 Add CSV output to analysis-stats
For easy diffing.
2022-02-25 11:45:44 +01:00
bors[bot] f6901c952e
Merge #11462
11462: 11422 highlight continue and break r=Veykril a=HansAuger

Closes #11422 

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2022-02-24 20:59:27 +00:00
Moritz Vetter 71d158b6ba refactor(11422): make number unsigned, nest enums into each other 2022-02-24 21:29:45 +01:00
Moritz Vetter 8848186213 fix(11422): have two different funuctions - one for iterating breaks, one for iteraating breaks and continues 2022-02-24 19:00:08 +01:00
Moritz Vetter 3da08071ce add logic to highlight continue and break keywords according to expectations 2022-02-24 18:58:14 +01:00
Moritz Vetter cad0cf6950 refactor helper function to work with function taking expression enum instead of break expression 2022-02-24 18:58:14 +01:00
Moritz Vetter 1c074499f3 add some breaking tests (TDD - style) 2022-02-24 18:58:14 +01:00
bors[bot] 90f7899903
Merge #11531
11531: fix: Make fill_match_arms assist handle doc(hidden) and non_exhaustive r=Veykril a=OleStrohm

Fixes #11499
Fixes #11500
This keeps track of the relevant attributes and adds in a wildcard pat at the end of the match when necessary.

I decided to do them in the same PR since they both needed the ability to add a wildcard arm, and so their changes would overlap if done separately, but I'll split them up if that seems better.

This is my first PR to rust-analyzer, so all feedback is greatly appreciated!

Co-authored-by: Ole Strohm <strohm99@gmail.com>
2022-02-24 12:57:51 +00:00
bors[bot] 6b55d2f10a
Merge #11540
11540: fix: Resolve private fields in type inference r=flodiebold a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10253#issuecomment-920962927
(the same issue probably exists for method calls, but I think fixing that might be trickier)

Visibility checks were introduced in https://github.com/rust-analyzer/rust-analyzer/issues/7841 for autoderef to work properly, so now we just record the first field we find unconditionally, and then overwrite it if autoderef manages to find another field in a later cycle.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-24 11:25:18 +00:00