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
Daniel Eades
bb083b8202
remove useless casts
2023-01-02 15:02:54 +00:00
Daniel Eades
4f8ffd0ba4
remove unnecessary lifetimes that can be elided
2023-01-02 15:02:54 +00:00
Daniel Eades
efd2c20e96
remove useless conversions
2023-01-02 15:02:54 +00:00
Daniel Eades
cc80c5bd07
remove unnecessary lazy evaluations
2023-01-02 15:02:54 +00:00
Daniel Eades
ed128872eb
remove needless borrows
2023-01-02 14:52:32 +00:00
Daniel Eades
77051679d7
use inline format args
2023-01-02 14:52:32 +00:00
Lukas Wirth
eee7de0225
Diagnose private assoc item accesses
2023-01-01 13:24:48 +01:00
Lukas Wirth
e3d144d17f
Diagnose private field accesses
2022-12-31 14:20:59 +01:00
Lukas Wirth
1d782a9095
Add test for private method inference fallback
2022-12-31 11:42:44 +01: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
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
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
Maybe Waffle
346bf5fb5b
Implement do yeet
expression
2022-12-28 23:17:13 +00:00
Maybe Waffle
aaa682c534
Implement try{}
block type inference
2022-12-28 21:25:47 +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
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
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
Yuri Astrakhan
1d59c7b667
Remove non-needed clones
...
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.
This was done with clippy, and manually reviewed:
```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
bors
271f7b44d3
Auto merge of #13699 - HKalbasi:inlaylink, r=Veykril
...
Implement location link for type inlay hints
fix #11701
This actually doesn't work due a problem in vscode: https://github.com/microsoft/vscode/issues/167564
2022-12-21 21:43:38 +00:00
Lukas Wirth
8f8200eb14
Simplify
2022-12-21 21:34:01 +01:00
Lukas Wirth
a694c342fa
Fix tests not using appropriate target data
2022-12-21 20:23:43 +01:00
Lukas Wirth
33591cd3f4
Calculate the TargetDataLayout correctly for the selected target
2022-12-21 15:11:24 +01:00
hkalbasi
801a2231bf
Implement location link for type inlay hints
2022-12-21 02:18:02 +03:30
Ryo Yoshida
bb99d2a6fb
fix: resolve all inference vars in InferenceResult::assoc_resolutions
2022-12-14 23:07:43 +09:00
Florian Diebold
d3cb032f7e
Make assoc_resolutions always have a Substitution
2022-12-10 17:05:33 +01:00
bors
a3ea20a142
Auto merge of #13725 - bvanjoi:resolve-const-triat-impls, r=flodiebold
...
feat: resolve const for trait impls
Fixed #13694
2022-12-10 13:58:28 +00:00
bvanjoi
7012b50db5
feat: resolve const for trait impls( close #13694 )
2022-12-10 20:06:25 +08:00
bors
632f804797
Auto merge of #13750 - lowr:fix/rpit-in-projection, r=flodiebold
...
fix: normalize projection after discarding free `BoundVar`s in RPIT
Fixes #13307
When we lower the return type of a function, it may contain free `BoundVar`s in `OpaqueType`'s substitution, which would cause panic during canonicalization as part of projection normalization. Those `BoundVar`s are irrelevant in this context and will be discarded, and we should defer projection normalization until then.
2022-12-10 11:30:14 +00:00
bors
518e39bfe6
Auto merge of #13742 - lowr:fix/assoc-type-shorthand-with-gats, r=flodiebold
...
fix: only shift `BoundVar`s that come from outside lowering context
Fixes #13734
There are some free functions `TyLoweringContext` methods call, which do not know anything about current binders in scope. We need to shift in the `BoundVar`s in substitutions that we get from them (#4952 ), but not those we get from `TyLoweringContext` methods.
2022-12-10 11:17:18 +00:00
Ryo Yoshida
34b11d9981
fix: normalize projection after discarding free BoundVar
s in RPIT
2022-12-10 04:23:23 +09:00
Lukas Wirth
e80674e6b3
Show type info on hover of enum variant fields
2022-12-09 10:09:55 +01:00
Ryo Yoshida
19e3085481
Only shift BoundVar
s that come from outside TyLoweringContext
2022-12-08 21:17:13 +09:00
Ryo Yoshida
46e1486a90
Disallow access to free BoundVar
s outside TyLoweringContext
2022-12-08 20:52:03 +09:00
bors
6e8a54d0f6
Auto merge of #13490 - HKalbasi:layout, r=jonas-schievink
...
Compute data layout of types
cc #4091
Things that aren't working:
* Closures
* Generators (so no support for `Future` I think)
* Opaque types
* Type alias and associated types which may need normalization
Things that show wrong result:
* ~Enums with explicit discriminant~
* SIMD types
* ~`NonZero*` and similar standard library items which control layout with special attributes~
At the user level, I didn't put much work, since I wasn't confident about what is the best way to present this information. Currently it shows size and align for ADTs, and size, align, offset for struct fields, in the hover, similar to clangd. I used it some days and I feel I liked it, but we may consider it too noisy and move it to an assist or command.
2022-12-07 15:22:03 +00:00
hkalbasi
948a8f030b
Add a fixme comment in current_target_data_layout
2022-12-07 02:29:50 +03:30
hkalbasi
05906da0ec
use rustc crates instead of copy paste
2022-12-07 01:59:38 +03:30
Wilco Kusee
a75bffc729
Increase Chalk fuel from 100 to 1000
...
The old value was for the old chalk-engine solver, nowadays the newer chalk-recursive solver is used.
The new solver currently uses fuel a bit more quickly, so a higher value is needed.
Running analysis-stats showed that a value of 100 increases the amount of unknown types,
while for a value of 1000 it's staying mostly the same.
2022-12-05 18:13:11 +01:00
Wilco Kusee
fc627e637b
Update to Chalk 88
2022-12-05 17:29:23 +01:00
Lukas Wirth
ca1389ef9f
Support rustc_has_incoherent_inherent_impls
2022-12-04 20:37:17 +01:00
hkalbasi
f2c9502185
support nonzero* niche optimizations
2022-12-04 00:29:34 +03:30
hkalbasi
86b5b609f1
Compute data layout of types
2022-12-04 00:29:34 +03:30
Wilco Kusee
16bf32fcdd
Update Chalk to version 87
2022-11-29 15:25:09 +01:00
Crauzer
b3bd5a471e
implement vararg type collection from function params
2022-11-29 00:32:13 +01:00
Laurențiu Nicola
a2a1d99545
⬆️ rust-analyzer
2022-11-23 17:24:03 +02:00
Laurențiu Nicola
79923c382a
⬆️ rust-analyzer
2022-11-09 21:49:10 +02:00
Laurențiu Nicola
c60b1f6414
⬆️ rust-analyzer
2022-11-01 11:31:31 +02:00
Laurențiu Nicola
8807fc4cc3
⬆️ rust-analyzer
2022-10-26 17:40:41 +03:00
Laurențiu Nicola
a99a48e786
⬆️ rust-analyzer
2022-10-18 09:12:49 +03:00
Laurențiu Nicola
4f55ebbd4f
⬆️ rust-analyzer
2022-10-11 10:37:35 +03:00
lcnr
6f13f12301
rustc_typeck to rustc_hir_analysis
2022-09-27 10:37:23 +02:00
Laurențiu Nicola
f5fde4df43
⬆️ rust-analyzer
2022-09-20 17:39:17 +03:00
Laurențiu Nicola
459bbb4222
⬆️ rust-analyzer
2022-09-13 15:38:11 +03:00
Laurențiu Nicola
65e1dc4d9c
⬆️ rust-analyzer
2022-09-06 21:20:49 +03:00
Laurențiu Nicola
3e358a6827
⬆️ rust-analyzer
2022-08-30 14:51:24 +03:00
Laurențiu Nicola
31519bb394
⬆️ rust-analyzer
2022-08-23 10:05:52 +03:00
Laurențiu Nicola
8231fee466
⬆️ rust-analyzer
2022-08-16 11:24:50 +03:00
Laurențiu Nicola
22c8c9c401
⬆️ rust-analyzer
2022-08-09 07:23:57 +03:00
Laurențiu Nicola
9d2cb42a41
⬆️ rust-analyzer
2022-08-02 09:05:16 +03:00
Amos Wenger
a1f1b95d00
Merge commit 'e36a20c24f35a4cee82bbdc600289104c9237c22' into ra-sync-and-pms-component
2022-07-26 11:53:50 +02:00
bors
84a6fac37a
Auto merge of #12841 - Veykril:query-fix, r=Veykril
...
fix: Fix `trait_impls_in_deps_query` being called directly instead of as a query
Fixes the inlay hint performance regression introdcuced by https://github.com/rust-analyzer/rust-analyzer/issues/12549
2022-07-21 08:23:19 +00:00
Lukas Wirth
cfad882745
fix: Fix trait_impls_in_deps_query
being called directly instead of as a query
2022-07-21 10:23:07 +02:00
Amos Wenger
ade31ad757
Rename proc macro server from 'Rustc' to 'RustAnalyzer'
2022-07-20 15:40:23 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Amos Wenger
1b416473a3
Upgrade to expect-test@1.4.0
...
cf. https://github.com/rust-analyzer/expect-test/issues/33
cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19 13:00:45 +02:00
bors
22e53f1d33
Auto merge of #12549 - bitgaoshu:goto_where_trait_m_impl, r=Veykril
...
feat: Go to implementation of trait methods
try goto where the trait method implies, #4558
2022-07-18 16:29:23 +00:00
bors
db6a85d358
Auto merge of #12778 - Logarithmus:feature/fix-negative-const-generics, r=flodiebold
...
Support negative, `char` & `bool` const generics
Before:
![Before](https://user-images.githubusercontent.com/29541480/179379832-0c3b2a74-fef6-427e-b89f-7e31d9c37b3d.png )
After:
![After](https://user-images.githubusercontent.com/29541480/179379863-b62475dd-e7bf-41f2-b437-08dfe55951af.png )
I tried to implement stuff like `Const<{NUM1 + 3 + NUM2}>` by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before
2022-07-17 17:17:39 +00:00
Artur Sinila
83177a7cfe
fix: address suggestions
2022-07-17 18:22:11 +03:00
iDawer
a0fd58bbbe
Check for local IDs belong to same definition
2022-07-17 11:43:08 +05:00
Artur Sinila
a96f0aa7cd
feat: support negative const generic parameters
...
* feat: support `bool` & `char` const generics
2022-07-17 04:18:53 +03:00
Jonas Schievink
6c6ae965ba
Update remaining GitHub URLs
2022-07-08 15:44:49 +02:00
Laurențiu Nicola
78beb4c444
Bump chalk
2022-07-03 10:22:10 +03:00
Laurențiu Nicola
5381811368
Bump tracing-subscriber
2022-07-03 10:12:58 +03:00