Commit graph

126 commits

Author SHA1 Message Date
bors[bot]
06320015af
Merge #7021
7021: Track labels in the HIR r=matklad a=Veykril

Groundwork for #6966

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 12:04:28 +00:00
Lukas Wirth
262b9c3982 Track labels in the HIR 2020-12-24 12:49:40 +01:00
bors[bot]
a82c2445be
Merge #7020
7020: Implement const pat and expr inference r=flodiebold a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-23 19:50:04 +00:00
Lukas Wirth
a142beaf01 Implement const block inference 2020-12-23 12:24:24 +01:00
Lukas Wirth
0a780c0ab3 Implement const pat inference 2020-12-23 12:15:38 +01:00
Laurențiu Nicola
c04406287a Bump chalk 2020-12-23 12:58:23 +02:00
Lukas Wirth
fa65d6ba85 Higher-ranked trait bounds for where clauses 2020-12-17 22:01:42 +01:00
Jonas Schievink
6615fda695 decl_check: don't pass db around so often 2020-12-17 01:19:56 +01:00
Jonas Schievink
b238ddd21a Make macro def krate mandatory
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00
Jonas Schievink
c1cb595382 Move to upstream macro_rules! model 2020-12-15 15:37:37 +01:00
Edwin Cheng
9da1eee436 Add regression test 2020-12-15 15:24:35 +08:00
Florian Diebold
4788aaa5f0 Add test for #6852 2020-12-13 14:53:04 +01:00
bors[bot]
ca3a54f0a4
Merge #6852
6852: Ignore lifetime params in substitutions r=matklad a=Veykril

[`hir_ty::utils::Generics`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_ty/src/utils.rs#L153) currently only assumes type parameters but not lifetime parameters and therefor creates incorrect index and length calculations, this PR just makes the use sites ignore LifetimeGenerics for now.

This fixes the panic at least locally for me for `analysis-stats`. Funnily enough this panic prevented me from using reference search for the `args` field to fix this problem.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-13 11:34:43 +00:00
Lukas Wirth
ae8a802085 Ignore lifetime params in substitutions 2020-12-13 11:34:44 +01:00
bors[bot]
a15d19619e
Merge #6845
6845: Don't HirDisplay unknown types when displaying for source r=Veykril a=Veykril

Was wondering why the add missing impl assist didn't do anything here:
![Code_JCA1Qo0V9P](https://user-images.githubusercontent.com/3757771/101990300-7af44a80-3ca6-11eb-8431-e5eb4de4e78c.png)
Turns out me forgetting to set the Index::Idx type in the trait causes RA to panic due to it trying to to create an unparsable type in the `make` module.
Now we get this instead which imo is definitely better to have.
![Code_MUFPJUCULY](https://user-images.githubusercontent.com/3757771/101990347-c9094e00-3ca6-11eb-9c6a-146bddf64b7c.png)



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-12 18:06:36 +00:00
Lukas Wirth
69b78edb5e Don't HirDisplay unknown types when displaying for source 2020-12-12 19:05:00 +01:00
bors[bot]
479d1f7eec
Merge #6818
6818: Add Lifetimes to the HIR r=matklad a=Veykril

This doesn't handle resolve yet as I don't know yet how that will be used. I'll get to that once I start moving the lifetime reference PR to the hir.

This also adds a new `hir` name type for lifetimes and labels, `hir::LifetimeName`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-12 14:35:38 +00:00
ivan770
f7f4f366ac
Added remove this semicolon test 2020-12-12 13:50:11 +02:00
Lukas Wirth
11f8664182 Add Lifetimes to the HIR 2020-12-12 00:56:52 +01:00
Lukas Wirth
378ec2841b Infer labeled blocks 2020-12-12 00:06:48 +01:00
bors[bot]
44978acf51
Merge #6769
6769: Add native "remove this semicolon" diagnostics r=matklad a=ivan770

Closes #6739 
![demo2](https://user-images.githubusercontent.com/14003886/101530533-b76c3180-399a-11eb-9d18-5c8457721655.gif)


Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2020-12-10 16:18:49 +00:00
ivan770
bbb0bc7b04
Cast to ExprStmt, style fixes 2020-12-10 18:10:39 +02:00
Jonas Schievink
05d4a5a150 Use mark/hit 2020-12-10 15:56:04 +01:00
Jonas Schievink
d82292e1ce Ignore extern items in incorrect-case check 2020-12-10 15:45:01 +01:00
Jonas Schievink
dedd888570 Implement HirDisplay for FnSig
This could be useful for diagnostics, but isn't used right now
2020-12-09 18:06:56 +01:00
Aleksey Kladov
6e24321e45 Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;`
in a lossless cross-platform & network-transparent way.
2020-12-09 19:07:05 +03:00
ivan770
35006eba79 Apply rustfmt changes 2020-12-09 08:22:13 +00:00
ivan770
86c183716c
Apply suggestions from code review
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-12-09 10:17:28 +02:00
ivan770
7738467e0a Format code 2020-12-08 19:25:21 +00:00
ivan770
581567a4c8
Remove use via super 2020-12-08 20:50:13 +02:00
ivan770
cb66bb8ff9
Remove this semicolon 2020-12-08 20:47:20 +02:00
Florian Diebold
78dd548243 Upgrade Chalk
Also make overflow depth and max type size configurable through env variables.
This can be helpful at least for debugging.

Fixes #6628.
2020-12-07 11:48:58 +01:00
Florian Diebold
e5fd550dfd Use correct, full substs for self type in impl
Without arbitrary self types, the self type could never refer to the method type
parameters, so this wasn't a problem; but with arbitrary self types, it can.

This fixes the crash from #6668; but it doesn't make method resolution work for
these methods.
2020-12-04 18:43:47 +01:00
Lukas Wirth
377fa7db3f Check structs for match exhaustiveness 2020-11-24 18:50:56 +01:00
Lukas Wirth
4d841dc4e7 Add middle ellipsis missing arm text 2020-11-24 16:46:06 +01:00
Lukas Wirth
a4b5275656 Handle ellipsis in tuple patterns in match exhaustiveness checking 2020-11-24 16:43:28 +01:00
Lukas Wirth
a5efefd3d7 Properly infer tuple struct patterns when encountering ellipsis 2020-11-24 16:11:40 +01:00
Lukas Wirth
35dd62e915 Properly infer tuple patterns when encountering ellipsis 2020-11-24 13:56:20 +01:00
Aleksey Kladov
731f7bfc02 Replace RacyFlag with OnceCell 2020-11-11 03:11:40 +01:00
Igor Aleksanov
dd2febf05a Improve decl_check module readability 2020-11-03 10:13:49 +03:00
Igor Aleksanov
9e172ffeb7 Remove numbers from comments in decl_check.rs 2020-11-03 10:11:02 +03:00
Igor Aleksanov
bdfe12df8f Check for allow(..) attributes for case diagnostic 2020-11-03 10:11:02 +03:00
kjeremy
0403e82d91 Bump chalk and lexer 2020-11-02 12:00:58 -05:00
Aleksey Kladov
ba8d6d1e4e Remove more unreachable pubs 2020-11-02 16:58:33 +01:00
Aleksey Kladov
b610118453 Deny unreachable-pub
It's very useful when `pub` is equivalent to "this is crate's public
API", let's enforce this!

Ideally, we should enforce it for local `cargo test`, and only during
CI, but that needs https://github.com/rust-lang/cargo/issues/5034.
2020-11-02 14:07:08 +01:00
Florian Diebold
bca51e3519 Upgrade Chalk to 0.36
Quite a few changes, because Chalk got rid of the `ApplicationTy` nesting.
2020-10-30 18:57:55 +01:00
Benjamin Coenen
7322a69cf6 refactor(hir_ty): do not override DisplayTarget in hir_fmt
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-28 17:58:16 +01:00
Benjamin Coenen
ec3638adb9 do not use associated types placeholder for inlay hint
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-28 15:42:51 +01:00
Benjamin Coenen
0aca7b78de do not use associated types placeholder for inlay hint
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-28 15:23:23 +01:00
Benjamin Coenen
ef2f7bb243 do not use associated types placeholder for inlay hint
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-28 14:07:12 +01:00