David Barsky
184fbf24f0
update to tracing-tree 0.1.10, which does not pull in syn.
2021-09-06 10:33:08 -04:00
Jonas Schievink
d6a12b491f
Don't dump DefMap
s to build the panic context
2021-09-05 20:42:22 +02:00
Jonas Schievink
7d67c71c34
Add panic info for impl_trait
/trait_data
2021-09-05 19:19:34 +02:00
Lukas Wirth
36a5ce9790
minor: fix some clippy lints
2021-09-03 16:00:50 +02:00
bors[bot]
25368d2430
Merge #9954
...
9954: feat: Show try operator propogated types on ranged hover r=matklad a=Veykril
Basically this just shows the type of the inner expression of the `?` expression as well as the type of the expression that the `?` returns from:
![Code_wIrCxMqLH9](https://user-images.githubusercontent.com/3757771/130111025-f7ee0742-214a-493b-947a-b4a671e4be92.png )
Unless both of these types are `core::result::Result` in which case we show the error types only.
![Code_Xruw5FCBNI](https://user-images.githubusercontent.com/3757771/130111024-f9caef82-92e4-4070-b3dd-f2ff9e5d87a9.png )
If both types are `core::option::Option` with different type params we do not show this special hover either as it would be pointless(instead fallback to default type hover)
Very much open to changes to the hover text here(I suppose we also want to show the actual type of the `?` expression, that is its output type?).
Fixes #9931
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-01 09:26:10 +00:00
Jonas Schievink
418b163a4b
Allow inherent impl for arrays
2021-08-31 14:15:39 +02:00
Dezhi Wu
ba0947dded
switch log
crate to tracing
2021-08-30 15:11:42 +08:00
Aleksey Kladov
cfa3f679e9
internal: don't expose impl details out of hir
2021-08-29 18:55:25 +03:00
Aleksey Kladov
76b60efbfb
internal: improve compile times a bit
...
before after for cargo llvm-lines -q --lib --release -p ide_ssr | head -n 24
Lines Copies Function name
----- ------ -------------
297146 (100%) 12748 (100%) (TOTAL)
5970 (2.0%) 47 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.6%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
4080 (1.4%) 30 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3933 (1.3%) 69 (0.5%) alloc::raw_vec::RawVec<T,A>::current_memory
3668 (1.2%) 89 (0.7%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
3500 (1.2%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3436 (1.2%) 33 (0.3%) hashbrown::raw::RawTable<T,A>::find
3415 (1.1%) 17 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
3400 (1.1%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
2840 (1.0%) 20 (0.2%) alloc::raw_vec::RawVec<T,A>::allocate_in
2700 (0.9%) 30 (0.2%) core::alloc::layout::Layout::array
2666 (0.9%) 86 (0.7%) core::ptr::metadata::from_raw_parts_mut
2495 (0.8%) 50 (0.4%) core::option::Option<T>::map
2354 (0.8%) 38 (0.3%) alloc::alloc::box_free
2302 (0.8%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2146 (0.7%) 45 (0.4%) core::mem::replace
2070 (0.7%) 69 (0.5%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1979 (0.7%) 16 (0.1%) hashbrown::map::HashMap<K,V,S,A>::insert
1926 (0.6%) 18 (0.1%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1922 (0.6%) 62 (0.5%) core::fmt::ArgumentV1::new
1885 (0.6%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
Lines Copies Function name
----- ------ -------------
261717 (100%) 11666 (100%) (TOTAL)
5239 (2.0%) 42 (0.4%) core::iter::traits::iterator::Iterator::try_fold
4750 (1.8%) 27 (0.2%) hashbrown::raw::RawTable<T,A>::resize
3933 (1.5%) 69 (0.6%) alloc::raw_vec::RawVec<T,A>::current_memory
3536 (1.4%) 26 (0.2%) alloc::raw_vec::RawVec<T,A>::grow_amortized
3500 (1.3%) 50 (0.4%) hashbrown::raw::RawTable<T,A>::drop_elements
3400 (1.3%) 50 (0.4%) <hashbrown::raw::RawIterRange<T> as core::iter::traits::iterator::Iterator>::next
3124 (1.2%) 30 (0.3%) hashbrown::raw::RawTable<T,A>::find
2812 (1.1%) 14 (0.1%) hashbrown::raw::RawTable<T,A>::rehash_in_place
2604 (1.0%) 84 (0.7%) core::ptr::metadata::from_raw_parts_mut
2340 (0.9%) 26 (0.2%) core::alloc::layout::Layout::array
2302 (0.9%) 7 (0.1%) ide_ssr::parsing::RuleBuilder::try_add
2272 (0.9%) 16 (0.1%) alloc::raw_vec::RawVec<T,A>::allocate_in
2201 (0.8%) 35 (0.3%) alloc::alloc::box_free
2104 (0.8%) 44 (0.4%) core::mem::replace
2079 (0.8%) 42 (0.4%) <core::result::Result<T,E> as core::ops::try_trait::Try>::branch
2070 (0.8%) 69 (0.6%) <alloc::raw_vec::RawVec<T,A> as core::ops::drop::Drop>::drop
1926 (0.7%) 18 (0.2%) <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
1885 (0.7%) 13 (0.1%) alloc::raw_vec::RawVec<T,A>::shrink
1833 (0.7%) 13 (0.1%) hashbrown::raw::RawTable<T,A>::shrink_to
1771 (0.7%) 91 (0.8%) core::ptr::read
1701 (0.6%) 35 (0.3%) core::option::Option<T>::map
2021-08-29 18:49:16 +03:00
Florian Diebold
424dda8113
Refactor & improve handling of overloaded binary operators
...
Fixes #9971 . Also records them as method resolutions, which we could use
later.
2021-08-22 17:35:50 +02:00
Frank Steffahn
35a7fdd2c1
Fix two more “a”/“an” typos
2021-08-22 17:24:48 +02:00
Frank Steffahn
3a5a93595f
Fix typos “a”→“an”
2021-08-22 14:31:37 +02:00
bors[bot]
9e3517f8f3
Merge #9975
...
9975: minor: Fix panic caused by #9966 r=flodiebold a=flodiebold
Chalk can introduce new type variables when doing lazy normalization, so we have to do the proper 'fudging' after all.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-08-21 18:07:36 +00:00
Florian Diebold
df77e2448c
Fix panic caused by #9966
...
Chalk can introduce new type variables when doing lazy normalization, so
we have to do the proper 'fudging' after all.
2021-08-21 20:07:07 +02:00
Laurențiu Nicola
104d6124d7
Handle coercion on binary operator RHS
2021-08-21 17:54:45 +03:00
Florian Diebold
1791a35f9f
Determine expected parameters from expected return in calls
...
Fixes #9560
2021-08-21 14:33:31 +02:00
Florian Diebold
cd64353288
Adapt tests for correct behavior
2021-08-21 13:35:36 +02:00
Florian Diebold
5cff355059
Add another test
2021-08-21 13:35:34 +02:00
Lukas Wirth
95923c7b29
Fix imports
2021-08-19 17:33:58 +02:00
Jonas Schievink
4757679b9a
feat: type inference for if-let guards
2021-08-14 00:09:30 +02:00
Jonas Schievink
d568e7686a
Support if let
match guards
2021-08-13 00:25:14 +02:00
bors[bot]
baf1494374
Merge #9807
...
9807: Implicit `Sized` bounds r=iDawer a=iDawer
This should close #8984
`hir_ty`:
- Type parameters, associated types and `impl Trait` are `Sized` by deafault except `Self` in a trait.
- Implicit `Sized` bound is added to end of predicate list. It does not check if such bound is present already. Also it does not track the bound is implicit.
- Allowed ambiguous unsize coercion if Chalk returns definite guidance.
- Allowed ambiguous autoderef if Chalk returns definite guidance.
`hir_def`:
- `ItemTree` pretty printing shows `?Sized` bounds.
`HirDisplay`:
- `impl Trait` with weird bounds rendered correctly.
- `Sized`/`?Sized` bounds are not shown if they are default.
### Perf
`./target/rust-analyzer-baseline_8a843113 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.80s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 174
Inference: 50.28s, 116ginstr, 516mb
Total: 77.08s, 189ginstr, 855mb
```
`./target/rust-analyzer-sized-fixed_ambig_coercion-de074fe6 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.95s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 166
Inference: 96.39s, 234ginstr, 543mb
Total: 123.33s, 307ginstr, 881mb
```
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-08-12 17:55:29 +00:00
Dawer
6c366ade00
Clean up
2021-08-12 21:20:28 +05:00
Dawer
de074fe636
Accept ambiguous unsize coercion only if it has definite guidance.
2021-08-11 22:09:32 +05:00
Dawer
e89ad9f345
Allow ambiguous autoderef with defininte guidance.
...
This enables autoderefing types with inference variables inside.
2021-08-09 14:30:05 +05:00
Laurențiu Nicola
ab10ac7d92
Increase chalk overflow depth
2021-08-08 18:40:28 +03:00
ivan770
be3e70c604
Add reference here diagnostic
2021-08-08 10:12:40 +02:00
Dawer
14898729f4
Account sized bounds in parentheses printing inside of ptr/ref of rpit.
2021-08-08 00:54:38 +05:00
Florian Diebold
16ab75a83a
Upgrade Chalk
2021-08-07 13:12:35 +02:00
Florian Diebold
ac4f3e61f8
Fix binders with bare dyn trait
...
Fixes #9639 .
2021-08-05 22:44:38 +02:00
Dawer
98ae530f2a
Fix missing ?Sized bounds in tests.
2021-08-04 20:24:52 +05:00
Dawer
0f6621fbfa
Fix tests.
2021-08-04 20:20:14 +05:00
Dawer
5f2486e9a8
Handle impl ?Sized
. Fix tests.
2021-08-04 20:20:10 +05:00
Dawer
421979bc68
HirDisplay prints ?Sized
bounds now; impl Trait: Sized
by default.
2021-08-04 20:05:46 +05:00
Dawer
d9e6377b91
adjust hir_def::TypeBound::as_path
2021-08-04 19:49:19 +05:00
Dawer
b217e9cc50
add implicit Sized bound to associated types
2021-08-04 19:41:05 +05:00
Dawer
8f2a040d10
add implicit sized to impl Trait
parameters
2021-08-04 19:40:57 +05:00
Dawer
72002b401d
internal: allow ambiguous unsize coercion.
2021-08-04 19:15:23 +05:00
Dawer
3981373b93
internal: add implicit Sized
bounds to type parameters.
2021-08-04 19:04:21 +05:00
Jade
e3a67ccec6
tree-wide: fix rustdoc warnings, add some links
2021-08-03 21:34:20 -07:00
Aleksey Kladov
12d7f5b56e
internal: explain that we don't ref
in style.md
2021-08-02 15:59:28 +03:00
Lukas Wirth
1edbaa29f9
Wrap inner tail expressions in MissingOkOrSomeInTailExpr
2021-07-31 20:00:09 +02:00
bors[bot]
8232804d3e
Merge #9706
...
9706: minor: perf and grammar fixes r=lnicola a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-29 16:14:10 +00:00
Alexander Gonzalez
e57ad5456c
fix: Typos
2021-07-27 18:31:21 -04:00
Laurențiu Nicola
ea0014c500
Remove some redundant clones
2021-07-27 21:32:55 +03:00
Jonas Schievink
b596c32a41
Resolve tuple variants in value namespace
2021-07-22 13:40:18 +02:00
bors[bot]
0bee7cb716
Merge #9453
...
9453: Add first-class limits. r=matklad,lnicola a=rbartlensky
Partially fixes #9286 .
This introduces a new `Limits` structure which is passed as an input
to `SourceDatabase`. This makes limits accessible almost everywhere in
the code, since most places have a database in scope.
One downside of this approach is that whenever you query limits, you
essentially do an `Arc::clone` which is less than ideal.
Let me know if I missed anything, or would like me to take a different approach!
Co-authored-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2021-07-22 10:33:05 +00:00
Jonas Schievink
837eec8dab
filter visiblities when resolving in extern crate
2021-07-21 17:51:56 +02:00
Florian Diebold
7c00ca2f51
Revert "Merge #9655 "
...
This reverts commit 8c8c6fb73d
, reversing
changes made to ec7b4cbf8f
.
2021-07-20 22:53:39 +02:00
Robert Bartlensky
0b3d0cde8b
Add Limit
struct.
...
Fixes #9286 .
2021-07-19 13:26:11 +01:00
Florian Diebold
ae22050a42
Determine expected parameters from expected return in calls
...
Fixes #9560
2021-07-18 20:56:44 +02:00
Florian Diebold
eb2cc1036a
Adapt tests for correct behavior
2021-07-15 20:02:48 +02:00
Florian Diebold
44d3c32922
Add test for #9560
2021-07-11 16:14:39 +02:00
bors[bot]
f83f069f94
Merge #9552
...
9552: internal: `add_explicit_type` respects coercions r=Veykril a=Veykril
or so I'd like to say but there is one odd case here where it doesn't work(see [review](https://github.com/rust-analyzer/rust-analyzer/pull/9552#discussion_r667351856 ))
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6107
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 16:25:58 +00:00
Lukas Wirth
576e3a4e12
add_explicit_type
respects coercions
2021-07-10 18:19:46 +02:00
Lukas Wirth
d5a43d1f85
Resolve type adjustments
2021-07-10 18:19:23 +02:00
Laurențiu Nicola
df729eda69
Bump chalk
2021-07-10 18:58:14 +03:00
bors[bot]
10273a7d63
Merge #9545
...
9545: Record autoderef adjustments r=flodiebold a=Veykril
cc #9475
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10 10:27:16 +00:00
Lukas Wirth
69e6511820
Record autoderef adjustments
2021-07-10 12:26:18 +02:00
bors[bot]
eab5d985ec
Merge #9512
...
9512: Record coercion adjustments r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/issues/9475
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-09 14:07:23 +00:00
Lukas Wirth
9272942b92
Use CoerceMany
in BreakableContext
2021-07-09 15:51:07 +02:00
Florian Diebold
d674d7185d
Represent opaque types with TyKind::OpaqueType
...
... instead of using `AliasTy`. Chalk turns the alias type into the
placeholder during unification anyway, which confuses our method
resolution logic.
Fixes #9530 .
2021-07-08 21:40:35 +02:00
Lukas Wirth
e968d834ca
Add some more adjustment test annotations
2021-07-08 15:03:57 +02:00
Lukas Wirth
349f2535fb
Copy some comments from rustc
2021-07-08 14:31:16 +02:00
Lukas Wirth
f73d0ee439
Minor cleanup
2021-07-08 14:27:54 +02:00
Lukas Wirth
64a1b26b8d
Implement CoerceMany
2021-07-08 14:16:23 +02:00
Lukas Wirth
9779526d8f
Record coercion adjustments
2021-07-08 13:07:24 +02:00
Laurențiu Nicola
3b2602cbb2
Don't unify array elements with their arrays
2021-07-08 12:55:00 +03:00
Jonas Schievink
cb63b021ff
Implement LUB coercion of array elements
2021-07-07 22:50:20 +02:00
Aleksey Kladov
86720f2953
minor: drop dummy authors field
2021-07-05 14:19:41 +03:00
bors[bot]
16871f6f93
Merge #9428
...
9428: fix: Fix deduction of `dyn Fn` closure parameter types r=flodiebold a=jonas-schievink
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-02 12:49:34 +00:00
Jonas Schievink
835d1cec59
Substitute self type instead of fusing binders
2021-07-02 00:16:36 +02:00
Jonas Schievink
cee9a7e26a
Bind the right number of variables in the FnPointer
2021-07-01 20:54:25 +02:00
Jonas Schievink
e6fdb38d38
Use as_tuple()
2021-07-01 20:45:47 +02:00
Jonas Schievink
b5a2289676
Remove unneeded shifted_in
2021-06-30 15:45:00 +02:00
Jonas Schievink
b502a10b1e
update comment
2021-06-30 15:13:59 +02:00
Jonas Schievink
88a86d4ff9
Fix deduction of dyn Fn
closure parameter types
2021-06-30 15:04:04 +02:00
Lukas Wirth
af739731db
Implement TypeRef::ForLifetime
2021-06-30 01:34:54 +02:00
Florian Diebold
a1120b6879
Fix benchmark_include_macro
2021-06-20 19:37:45 +02:00
Florian Diebold
78419779f1
More cleanups, use check
for display_source_code
tests
2021-06-20 19:12:06 +02:00
Florian Diebold
0219b145ea
Clean up coercion tests
2021-06-20 19:12:06 +02:00
Florian Diebold
04fbdce426
Unify check_mismatches and check_types
2021-06-20 19:12:06 +02:00
Florian Diebold
679bb21633
Add coverage mark for block local impls
2021-06-20 19:12:06 +02:00
Aleksey Kladov
89a0e58393
internal: use minicore deref more
2021-06-18 22:47:02 +03:00
Aleksey Kladov
991919e71f
internal: add index to minicore
2021-06-18 22:37:34 +03:00
Aleksey Kladov
73b3ee664e
minor: use minicore
2021-06-18 22:25:35 +03:00
Laurențiu Nicola
e3ce88f6f2
Minor clippy perf fixes
2021-06-18 14:40:51 +03:00
Lukas Wirth
95c8c65139
Nest all the or-patterns!
2021-06-17 17:37:14 +02:00
Aleksey Kladov
ee7b649d44
internal: switch some tests to minicore
2021-06-16 22:54:57 +03:00
Aleksey Kladov
604267088c
internal: add iterator to minicore
2021-06-16 22:48:48 +03:00
Aleksey Kladov
8a4d9bb80a
internal: add fn to minicore
2021-06-16 12:15:45 +03:00
Aleksey Kladov
0798cce9e5
internal: add result to minicore
2021-06-15 23:07:25 +03:00
Aleksey Kladov
2870d2bade
internal: add option to minicore
2021-06-15 22:59:51 +03:00
Aleksey Kladov
3efe5c3426
internal: add future to minicore
2021-06-15 22:49:00 +03:00
Aleksey Kladov
09c4013ec0
internal: switch some tests to minicore
2021-06-15 22:02:29 +03:00
Aleksey Kladov
ee13e895e3
internal: switch some tests to minicore
2021-06-15 21:57:56 +03:00
Aleksey Kladov
0bb1f1bc90
internal: add ranges to minicore
2021-06-15 21:45:25 +03:00
Aleksey Kladov
f4b52682da
internal: unindent some tests
2021-06-15 21:39:44 +03:00
Aleksey Kladov
b737b894cb
internal: switch some tests to minicore
2021-06-15 21:36:50 +03:00
Aleksey Kladov
7ebac5e54c
internal: switch some tests to minicore
2021-06-15 21:34:26 +03:00