Lukas Wirth
4aee911ce4
Slim down GenericArgs by one usize once more
2023-02-14 17:41:16 +01:00
Lukas Wirth
853ae1927d
Slim down GenericArgs by one usize
2023-02-14 17:40:24 +01:00
Lukas Wirth
4c2aef650a
Slim down AssociatedTypeBinding by one usize
2023-02-14 17:40:24 +01:00
Lukas Wirth
3c0f20a7bd
internal: Enable smallvec's union
feature
2023-02-14 17:01:01 +01:00
Lukas Wirth
7677f41f41
Preallocate some vecs
2023-02-10 16:42:09 +01:00
Lukas Wirth
79492cb8ae
internal: Revert castable expectation and simplify
2023-02-10 16:08:47 +01:00
Lukas Wirth
8f5deb4ff2
Remove a few allocations in hir-ty::utils
2023-02-10 14:57:03 +01:00
Lukas Wirth
f8f1cb93e0
fix: Implement Expactation::Castable and add a test case for it
2023-02-08 13:07:59 +01:00
bors
b7836e44d3
Auto merge of #14099 - Veykril:inlay-hint-loc, r=Veykril
...
Properly use location links for type hints of impl Future and its assoc type
2023-02-08 08:43:10 +00:00
Lukas Wirth
2b4a5374ee
Properly use location links for type hints of impl Future and its assoc type
2023-02-07 22:42:03 +01:00
hkalbasi
40cf8b45ac
reuse fetching target data layout from rustc function
2023-02-06 23:48:20 +03:30
hkalbasi
443bc7f193
Support layout of RPIT
2023-02-06 20:50:25 +03:30
Ryo Yoshida
98c8077495
fix: support non-ascii characters in case conversion
2023-02-03 18:11:11 +09:00
bors
eeceba7480
Auto merge of #14065 - lowr:patch/generate-generic-function, r=Veykril
...
Support generic function in `generate_function` assist
Part of #3639
This PR adds support for generic function generation in `generate_function` assist. Now the assist looks for generic parameters and trait bounds in scope, filters out irrelevant ones, and generates new function with them.
See `fn_generic_params()` for the outline of the procedure, and see comments on `filter_unnecessary_bounds()` for criteria for filtering. I think it's good criteria for most cases, but I'm open to opinions and suggestions.
The diff is pretty big, but it should run in linear time w.r.t. the number of nodes we operate on and should be fast enough.
Some notes:
- When we generate function in an existing impl, generic parameters may cause name conflict. While we can detect the conflict and rename conflicting params, I didn't find it worthwhile mainly because it's really easy to resolve on IDE: use Rename functionality.
- I've implemented graph structure myself, because we don't have graph library as a dependency and we only need the simplest one.
- Although `petgraph` is in our dependency graph and I was initially looking to use it, we don't actually depend on it AFAICT since it's only used in chalk's specialization graph handling, which we don't use. I'd be happy to replace my implementation with `petgraph` if it's okay to use it though.
- There are some caveats that I consider out of scope of this PR. See FIXME notes on added tests.
2023-02-02 09:06:22 +00:00
bors
bfe82cda48
Auto merge of #14036 - Veykril:write-method-resolution, r=Veykril
...
Record method resolution for remaining operator expressions
This allows goto def and future substituted hover to work for the concrete impls.
2023-02-01 10:23:33 +00:00
hkalbasi
0bf0d937b8
unsize cast array only on pointer type
2023-01-31 20:23:38 +03:30
Ryo Yoshida
32955c30cd
Add method to get generic parameters in a type
2023-01-31 21:05:23 +09:00
Maybe Waffle
249ea9502d
Set "current" edition to 2021
2023-01-31 10:51:43 +00:00
Lukas Wirth
4b4eabad3c
Record method resolution for try expressions
2023-01-27 11:25:34 +01:00
Lukas Wirth
a7f81e3cdc
Record method resolution for index expressions
2023-01-27 11:15:05 +01:00
Lukas Wirth
54da0bfbf0
Record method resolution for call expressions
2023-01-27 11:06:41 +01:00
Ryo Yoshida
e9f14c505f
Remove TypeWalk
and use TypeFlags
instead
2023-01-24 19:44:58 +09:00
Lukas Wirth
f8ed4d7ae4
Use lang item resolution instead of known paths
2023-01-21 19:03:36 +01:00
Lukas Wirth
1535881836
Replace SmolStr usage with lang item enum for lang items
2023-01-21 17:55:45 +01:00
Laurențiu Nicola
392a6ee422
Bump once_cell
2023-01-21 08:48:46 +02:00
Lukas Wirth
384fa4b84a
fix: Fix target-data-layout fetching incorrectly passing 'rustc' to rustc
2023-01-19 21:31:08 +01:00
Ryo Yoshida
c53064fb58
Enforce builtin binop expectations even without lang items
2023-01-17 20:17:15 +09:00
Ryo Yoshida
461435adab
Enforce builtin binop expectations on single references
...
Also don't enforce them on non-builtin types
2023-01-17 20:17:09 +09:00
bors
fa874627f0
Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
...
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
bors
62907858d5
Auto merge of #13964 - Veykril:workspace.package, r=Veykril
...
Specify authors, edition, license and rust-versian via workspace.package
2023-01-17 10:13:24 +00:00
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
hkalbasi
77efa0267d
Don't compute layout if TargetDataLayout
is not available
2023-01-16 22:43:27 +03:30
Lukas Wirth
e4858fe480
Specify authors, edition and license via workspace.package
2023-01-16 16:44:00 +01:00
Lukas Wirth
679df2adf1
Specify rust-version via workspace.package
2023-01-16 16:33:01 +01:00
bors
8800ea6461
Auto merge of #13950 - WaffleLapkin:iterate_over_arrays_directly, r=Veykril
...
minor: Iterate over arrays dirrectly, instead of going through a slice
Minor code improvement.
2023-01-14 13:08:36 +00:00
Maybe Waffle
bd04416aaa
Iterate over arrays dirrectly, instead of going through a slice
2023-01-14 13:02:28 +00:00
Lukas Wirth
27ba598dfe
Make inlay hint location links work for more types
2023-01-14 13:30:56 +01:00
Lukas Wirth
bb4e272d8a
Refine search for const and function assoc items
2023-01-11 17:10:04 +01:00
bors
f32f64bffc
Auto merge of #13929 - danieleades:simplify, r=lnicola
...
internal: a number of code simplifications
2023-01-11 09:38:34 +00:00
bors
75877d78d9
Auto merge of #13897 - bvanjoi:nearest-block-search, r=Veykril
...
fix(ty): should query impls in nearest block
fix https://github.com/rust-lang/rust-analyzer/issues/13895
2023-01-10 22:44:29 +00:00
Daniel Eades
d218b237fd
collapse some nested blocks
2023-01-10 20:40:08 +00:00
Daniel Eades
95d14c393c
avoid 'cloning' types that implement 'Copy'
2023-01-10 18:20:12 +00:00
bvanjoi
9a15cc81b4
fix(ty): should query impls in nearest block
2023-01-10 10:28:17 +08:00
Lukas Wirth
68723043db
Split out hir-def attribute handling parts into hir-expand
2023-01-09 19:29:28 +01:00
bors
f77b68a3cb
Auto merge of #13860 - danieleades:clippy, r=lnicola
...
fix a bunch of clippy lints
fixes a bunch of clippy lints for fun and profit
i'm aware of this repo's position on clippy. The changes are split into separate commits so they can be reviewed separately
2023-01-08 17:29:57 +00:00
Ryo Yoshida
d01630c8f3
Apply fallback to scalar type variables before final obligation resolution
2023-01-06 06:07:08 +09:00
Ryo Yoshida
b183612610
Add INTEGER
and FLOAT
flags for type variables
2023-01-05 23:10:06 +09:00
Ryo Yoshida
1bfc732b78
Store diverging flag for type variables as bitflags
2023-01-05 23:10:00 +09:00
Lukas Wirth
b996a54cd8
Skip lifetime elision on fn pointers and fn trait types
2023-01-03 11:58:31 +01:00
Lukas Wirth
f51111aacb
Write down adjustments introduced by binary operators
2023-01-02 23:16:09 +01:00