Commit Graph

23864 Commits

Author SHA1 Message Date
bors
e986de0b28 Auto merge of #13877 - lowr:fix/find-path-prefix-shadowed-prelude, r=Veykril
fix: prefix prelude items whose name collides in current scope

Fixes #13873

When we assemble path for prelude items whose name collides with other item in scope, we should always prefix it with module paths.
2023-01-02 12:11:30 +00:00
Ryo Yoshida
cf2fa14db5
fix: prefix prelude items whose name collides in current scope 2023-01-02 20:50:45 +09:00
Laurențiu Nicola
34bc240e94 Package release artifacts as ZIP 2023-01-01 20:45:08 +02:00
bors
643bc02ded Auto merge of #13875 - Veykril:private-field-diag, r=Veykril
Diagnose private assoc item accesses
2023-01-01 12:25:27 +00:00
Lukas Wirth
eee7de0225 Diagnose private assoc item accesses 2023-01-01 13:24:48 +01:00
bors
f31733b1d6 Auto merge of #13871 - lowr:fix/extract-module-merge-multiple-ranges, r=lnicola
fix: merge multiple intersecting ranges

Fixes #13791

In `check_intersection_and_push()`, there may exist two ranges we should merge with the new one. We've been assuming there should be only one range that intersects, which lead to [this assertion](da15d92a32/crates/text-edit/src/lib.rs (L192)) to fail under specific circumstances.
2022-12-31 14:51:27 +00:00
bors
da15d92a32 Auto merge of #13870 - Veykril:private-field-diag, r=Veykril
Diagnose private field accesses
2022-12-31 13:21:53 +00:00
Lukas Wirth
e3d144d17f Diagnose private field accesses 2022-12-31 14:20:59 +01:00
Ryo Yoshida
332dd6ad6e
fix: merge multiple intersecting ranges 2022-12-31 22:08:53 +09:00
bors
f5e7bf2ea5 Auto merge of #13869 - Veykril:exit-points, r=Veykril
Improve exit point highlighting for non-loop loops in tail position
2022-12-31 11:08:54 +00:00
Lukas Wirth
ec125fe46a Improve exit point highlighting for non-loop loops in tail position 2022-12-31 12:08:25 +01:00
bors
dbeee3445d Auto merge of #13867 - Veykril:meth-res-fallback, r=Veykril
Fallback to invisible associated functions and constants if no visible resolutions are found

Still lacking tests, will add those later
Fixes https://github.com/rust-lang/rust-analyzer/issues/13126
2022-12-31 10:53:30 +00:00
Lukas Wirth
1d782a9095 Add test for private method inference fallback 2022-12-31 11:42:44 +01:00
bors
f1c4150c93 Auto merge of #13868 - lowr:patch/unused-known-names-bye, r=Veykril
minor: remove unused known `Name`s

After #13866, known `Name`s for safe intrinsics are no longer used and thus should be removed.
2022-12-31 08:23:22 +00:00
Ryo Yoshida
0430b68398
Remove unused known Names 2022-12-31 16:17:38 +09:00
Lukas Wirth
5d54c550e7 Fallback to invisible associated functions and constants if no visible resolutions are found 2022-12-30 23:56:08 +01:00
bors
0d76b94c90 Auto merge of #13866 - Nilstrieb:rustc_safe_intrinsic, r=Veykril
Use `rustc_safe_intrinsic` attribute to check for intrinsic safety

Instead of maintaining a list that is poorly kept in sync we can just use the attribute.

This will make new RA versions unusable with old toolchains that don't have the attribute yet. Should we keep maintaining the list as a fallback or just don't care?
2022-12-30 22:14:31 +00:00
bors
09bc37c849 Auto merge of #13861 - danieleades:derive-hash, r=Veykril
derive 'Hash'

clippy doesn't like that `PartialEq` is derived, and `Hash` is manually implemented. This PR resolves that by deriving the `Hash` implementation.
2022-12-30 22:01:20 +00:00
bors
20b0ae4afe Auto merge of #13857 - WaffleLapkin:yeet, r=Veykril
feat: Implement yeeting

See tracking issue: https://github.com/rust-lang/rust/issues/96373

Before:
![2022-12-29_03-19](https://user-images.githubusercontent.com/38225716/209884634-e34e98fb-615d-4954-9614-7f9ce6291678.png)
After:
![2022-12-29_03-21](https://user-images.githubusercontent.com/38225716/209884633-4bba5eba-6dcc-4714-86cb-5c0d1f358364.png)
2022-12-30 21:48:23 +00:00
bors
ea8897c9be Auto merge of #13856 - WaffleLapkin:typeck_try{}, r=Veykril
fix: Type check unstable `try{}` blocks

![Peek 2022-12-29 01-40](https://user-images.githubusercontent.com/38225716/209875594-8bf9c9e2-9998-40b0-8820-28c7f2d9bae4.gif)

Fixes https://github.com/rust-lang/rust-analyzer/issues/11843
2022-12-30 21:35:46 +00:00
bors
6892b16336 Auto merge of #13865 - lnicola:nits2, r=Veykril
minor: Tweak Clippy policy wording and drop a useless `format!`
2022-12-30 21:20:43 +00:00
Nilstrieb
72afcf2cad Use rustc_safe_intrinsic attribute to check for intrinsic safety
Instead of maintaining a list that is poorly kept in sync we can just
use the attribute.
2022-12-30 20:29:37 +01:00
Laurențiu Nicola
d96c489120 Rephrase clippy policy 2022-12-30 16:10:17 +02:00
Laurențiu Nicola
3aae785693 Avoid useless format 2022-12-30 16:10:07 +02:00
Daniel Eades
da7ce6f810 derive 'Hash' 2022-12-30 11:14:15 +00:00
Maybe Waffle
346bf5fb5b Implement do yeet expression 2022-12-28 23:17:13 +00:00
Maybe Waffle
4a16afa264 Parse do yeet expressions 2022-12-28 22:42:26 +00:00
Maybe Waffle
aaa682c534 Implement try{} block type inference 2022-12-28 21:25:47 +00:00
Maybe Waffle
ef303f224f Actually test closures in closures_are_borders 2022-12-28 20:56:58 +00:00
Maybe Waffle
797da9e8da Actually test async{} blocks in async_blocks_are_borders 2022-12-28 20:56:58 +00:00
Maybe Waffle
eecab99dec Allow break and co to go through try{} blocks 2022-12-28 20:56:58 +00:00
Maybe Waffle
16264a3a53 fixup a doc comment 2022-12-28 20:43:12 +00:00
bors
3033c3ddbf Auto merge of #13841 - nyurik:lints2, r=lnicola
Moar linting: needless_borrow, let_unit_value, ...

* There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See [here](https://stackoverflow.com/questions/74910196/advantages-of-pass-by-ref-val-with-impl-intoiteratoritem-impl-asrefstr)
* removed several `let _ = ...` when they don't look necessary (even a few ones that were not suggested by clippy (?))
* some unneeded assignment+return - keep the code a bit leaner
* a few `writeln!` instead of `write!`, or even consolidate write!
* a nice optimization to use `ch.is_ascii_digit` instead of `ch.is_digit(10)`
2022-12-27 19:46:03 +00:00
Ryo Yoshida
a7d411425c
mbe: handle multi-character separator 2022-12-28 00:59:56 +09:00
Ryo Yoshida
767351fb87
mbe: treat <- as one punct 2022-12-27 18:34:46 +09:00
Ryo Yoshida
ec7148b091
mbe: split Op::Leaf and handle multi-character puncts 2022-12-27 18:23:01 +09:00
Ryo Yoshida
47c6c8e2f3
Extract multi-character punct handling into a method 2022-12-27 18:21:01 +09:00
bors
74ae2dd303 Auto merge of #13840 - lowr:fix/hir-callable-sig-escaping-boundvars, r=lowr
fix: handle lifetime variables in `CallableSig` query

Fixes #13838

The problem is similar to #13223: we've been skipping non-empty binders, letting lifetime bound variables escape.

I ended up refactoring `hir_ty::callable_sig_from_fnonce()`. Like #13223, I chose to make use of `InferenceTable` which is capable of handling variables (I feel we should always use it when we solve trait-related stuff instead of manually building obligations/queries).

I couldn't make up a test that crashes without this patch (since the function I'm fixing is only used *outside* `hir-ty`, simple `hir-ty` test wouldn't cause crash), but at least I tested with my local build and made sure it doesn't crash with the code in the original issue. I'd appreciate any help to find a regression test.
2022-12-25 14:53:16 +00:00
Ryo Yoshida
a1a408367e
Add regression test 2022-12-25 23:29:33 +09:00
Yuri Astrakhan
d3dbf9c194 Moar linting: needless_borrow, let_unit_value, ...
* There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See [here](https://stackoverflow.com/questions/74910196/advantages-of-pass-by-ref-val-with-impl-intoiteratoritem-impl-asrefstr)
* removed several `let _ = ...` when they don't look necessary (even a few ones that were not suggested by clippy (?))
* there were a few `then(|| ctor{})` that clippy suggested to replace with `then_some(ctor{})` -- seems reasonable?
* some unneeded assignment+return - keep the code a bit leaner
* a few `writeln!` instead of `write!`, or even consolidate write!
* a nice optimization to use `ch.is_ascii_digit` instead of `ch.is_digit(10)`
2022-12-25 05:07:47 -05:00
bors
2872e05589 Auto merge of #13835 - nyurik:inline_format_args, r=lnicola
Inline all format arguments where possible

This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)` into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-25 08:10:59 +00:00
Ryo Yoshida
a639917b66
fix: handle lifetime variables in CallableSig query 2022-12-25 05:07:44 +09:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
bors
1927c2e1d8 Auto merge of #13830 - nyurik:lints, r=lnicola
Minor manual cleanup

* use default derive
* use `strip_prefix` where possible to avoid dup work
2022-12-24 17:58:32 +00:00
bors
fb0db2a420 Auto merge of #13831 - bvanjoi:fix_bound_type_in_trait_insert, r=Veykril
fix(completion): remove bound insert of type in trait

Fixed https://github.com/rust-lang/rust-analyzer/issues/13819
2022-12-23 12:27:44 +00:00
bvanjoi
67cbd8f7c1 fix(completion): remove bound insert of type in trait 2022-12-23 18:45:25 +08:00
Lukas Wirth
df8fc78ece Enum variant discriminants hints 2022-12-23 11:37:42 +01:00
Yuri Astrakhan
ec55dd1d7b Minor manual cleanu
* use default derive
* use `strip_prefix` where possible to avoid dup work
2022-12-23 03:11:53 -05:00
bors
19e5adc38b Auto merge of #13829 - nyurik:explicit-auto-deref, r=lnicola
Clippy-fix explicit auto-deref

Seems like these can be safely fixed. With one, I was particularly surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 08:04:38 +00:00
Yuri Astrakhan
e341e996f7 Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00