Commit Graph

25685 Commits

Author SHA1 Message Date
Lukas Wirth
0f4ffaa5af Fix duplicate eager expansion errors 2023-04-16 19:20:35 +02:00
Amanieu d'Antras
35fc5780a7 Remove #[alloc_error_handler] from the compiler and library 2023-04-16 08:35:50 -07:00
Lukas Wirth
d1632c2727 Report syntax errors from item level macro expansions 2023-04-16 17:22:06 +02:00
Lukas Wirth
71b50f9f09 Record eager expansion errors in EagerCallInfo 2023-04-16 16:11:59 +02:00
Lukas Wirth
6ae8d49e15 Simplify eager macro error handling 2023-04-16 15:46:12 +02:00
bors
f0a40c3a0e Auto merge of #14583 - Veykril:macro-def-err, r=Veykril
internal: Report macro definition errors on the definition

We still report them on the call site as well for the time being, and the diagnostic doesn't know where the error in the definition comes from, but that can be done later on
2023-04-16 12:17:24 +00:00
Lukas Wirth
a5558cdfe5 internal: Report macro definition errors on the definition 2023-04-16 14:15:59 +02:00
bors
a3888fd601 Auto merge of #14579 - KatKlo:initialization-bug, r=Veykril
Fix bug with notifications during initialization
2023-04-16 10:36:51 +00:00
bors
c0889589d1 Auto merge of #14581 - Veykril:layout-ty, r=Veykril
internal: Move layout logic from hir-def to hir-ty
2023-04-16 10:22:24 +00:00
Lukas Wirth
0bb9a17312 internal: Move layout logic from hir-def to hir-ty 2023-04-16 12:21:12 +02:00
bors
c28f538568 Auto merge of #14580 - lowr:patch/parse-more-unstable-pat, r=Veykril
Parse more exclusive range patterns and inline const patterns

Closes #13955

This PR
- implements exclusive range pattern without start bound (tracking issue: rust-lang/rust#37854)
  - additionally moves rest pattern handling into the same place since they only differ in whether another pattern follows; this actually solves some FIXMEs
- updates `PATTERN_FIRST` token set to include `const` token so we can parse inline const pattern in nested patterns
2023-04-15 20:11:30 +00:00
Ryo Yoshida
83a93f4bd3
Parse inline const pattern in nested patterns 2023-04-16 04:28:37 +09:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern 2023-04-16 04:28:29 +09:00
KatKlo
1db2a2536c Fix bug with notifications during initialization 2023-04-15 19:31:02 +02:00
bors
b218009f46 Auto merge of #14576 - HKalbasi:dev2, r=HKalbasi
Fix explicit deref problems in closure capture

fix the `need-mut` part of #14562

Perhaps surprisingly, it wasn't unique immutable borrow. The code still doesn't emit any of them, and I think those won't happen in edition 2021 (which is currently the only thing implemented), since we always capture `&mut *x` instead of `&mut x`. But I'm not very sure about it.
2023-04-14 13:23:49 +00:00
bors
57c4ee27ca Auto merge of #14578 - lnicola:simplify-method-res, r=lnicola
minor: Make inherent_impls_in_block and trait_impls_in_block infallible

Fixes https://github.com/rust-lang/rust-analyzer/pull/14574#discussion_r1166763764
2023-04-14 13:04:50 +00:00
Laurențiu Nicola
febd5065ad Make inherent_impls_in_block and trait_impls_in_block infallible 2023-04-14 16:03:45 +03:00
hkalbasi
7cb4318331 Fix explicit deref problems in closure capture 2023-04-14 15:32:40 +03:30
bors
96407424de Auto merge of #14574 - Veykril:blocks, r=Veykril
internal: Make block_def_map infallible
2023-04-14 11:48:33 +00:00
Lukas Wirth
c32d51979d internal: Make block_def_map infallible 2023-04-14 13:17:38 +02:00
bors
4667379f7e Auto merge of #14575 - Veykril:attrs, r=Veykril
internal: Put Attrs behind a query instead of AttsWithOwner

We call this for pretty much every item, so this is unnecessary wasted memory
2023-04-14 11:17:18 +00:00
Lukas Wirth
ed3a5eac3c internal: Put Attrs behind a query instead of AttsWithOwner 2023-04-14 12:47:33 +02:00
bors
1a331689d1 Auto merge of #14573 - Veykril:expr-scopes, r=Veykril
internal: Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 10:22:33 +00:00
bors
c479804d79 Auto merge of #14572 - Veykril:proc-macro-close-span, r=Veykril
Encode closing delimiter span in FlatTrees

Mainly serves as a test for the api versioning, as I don't think we make use of the closing span yet.
2023-04-14 10:08:35 +00:00
Lukas Wirth
ce0896b78c Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData 2023-04-14 12:05:11 +02:00
Lukas Wirth
9fb1b04826 Encode closing delimiter span in FlatTrees 2023-04-14 10:34:41 +02:00
bors
10e0aaf284 Auto merge of #14570 - Veykril:code-lens-fix, r=Veykril
fix: Fix inverted code lens resolve file version check

Fixes https://github.com/rust-lang/rust-analyzer/issues/14568
2023-04-14 06:42:45 +00:00
Lukas Wirth
3c7b6716d1 fix: Fix inverted code lens resolve file version check 2023-04-14 08:41:53 +02:00
bors
2c251a7e2b Auto merge of #14565 - Veykril:view-crate-graph, r=Veykril
minor: Allow copying the graphviz source from the view crategraph webview
2023-04-13 20:03:44 +00:00
Lukas Wirth
34177d8552 minor: Allow copying the graphviz source from the view crategraph webview 2023-04-13 22:01:57 +02:00
bors
08ce44e7d5 Auto merge of #14561 - jonas-schievink:goto-included-file, r=Veykril
feat: Map tokens from `include!` expansion to the included file

Fixes https://github.com/rust-lang/rust-analyzer/issues/3767
2023-04-13 16:04:00 +00:00
bors
16059112c4 Auto merge of #14560 - Veykril:view-crate-graph, r=Veykril
fix: Fix view crate graph being broken due to webworker usage

Fixes https://github.com/rust-lang/rust-analyzer/issues/14457
2023-04-13 15:50:01 +00:00
Jonas Schievink
901c8a4259 Map tokens from include! expansion to the included file 2023-04-13 17:41:24 +02:00
Lukas Wirth
7a6d5c680c fix: Fix view crate graph being broken due to webworker usage 2023-04-13 17:38:12 +02:00
bors
05a6286fb2 Auto merge of #14446 - Veykril:ci, r=Veykril
internal: Only run typescript CI when VSCode files change
2023-04-13 09:11:50 +00:00
bors
41ee5ca79d Auto merge of #14559 - Veykril:version-code-lens, r=Veykril
internal: Skip code lens resolution for mismatched document versions

Closes https://github.com/rust-lang/rust-analyzer/issues/12718
2023-04-13 08:55:40 +00:00
Lukas Wirth
0286e46e5f internal: Skip code lens resolution for mismatched document versions 2023-04-13 10:55:28 +02:00
Lukas Wirth
40adedcb96 internal: Only run typescript CI when VSCode files change 2023-04-13 10:52:40 +02:00
bors
2b62016448 Auto merge of #14558 - lnicola:bump-crossbeam, r=lnicola
minor: Bump crossbeam-channel

0.5.7 is yanked because of https://github.com/crossbeam-rs/crossbeam/issues/971, let's upgrade to 0.5.8.
2023-04-13 08:08:53 +00:00
Laurențiu Nicola
ec8f47b44f Bump crossbeam-channel 2023-04-13 11:07:18 +03:00
bors
b093423d12 Auto merge of #14556 - Veykril:sysroot-no-core-warn, r=Veykril
internal: Warn when loading sysroot fails to find the core library

Should help a bit more with user experience, before we only logged this now we show it in the status
Closes https://github.com/rust-lang/rust-analyzer/issues/11606
2023-04-13 06:41:06 +00:00
Lukas Wirth
dd5c3c30b6 internal: Warn when loading sysroot fails to find the core library 2023-04-13 08:40:14 +02:00
bors
1ee88db412 Auto merge of #14533 - lowr:feat/text-edits-for-inlay-hints, r=Veykril
feat: make inlay hints insertable

Part of #13812

This PR implements text edit for inlay hints. When an inlay hint contain text edit, user can "accept" it (e.g. by double-clicking in VS Code) to make the hint actual code (effectively deprecating the hint itself).

This PR does not implement auto import despite the original request; text edits only insert qualified types along with necessary punctuation. I feel there are some missing pieces to implement efficient auto import (in particular, type traversal function with early exit) so left it for future work. Even without it, user can use `replace_qualified_name_with_use` assist after accepting the edit to achieve the same result.

I implemented for the following inlay hints:
- top-level identifier pattern in let statements
- top-level identifier pattern in closure parameters
- closure return type when its has block body

One somewhat strange interaction can be observed when top-level identifier pattern has subpattern: text edit inserts type annotation in different place than the inlay hint. Do we want to allow it or should we not provide text edits for these cases at all?

```rust
let a /* inlay hint shown here */ @ (b, c) = foo();
let a @ (b, c) /* text edit inserts types here */ = foo();
```
2023-04-12 14:11:20 +00:00
Ryo Yoshida
c978d4bf0c
Implement text edits for inlay hints 2023-04-12 19:03:57 +09:00
Ryo Yoshida
fcbc250723
Add field for text edits to InlayHint 2023-04-12 19:03:55 +09:00
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
hecatia-elegua
398af0259f
Merge branch 'master' into alias-based-completion2 2023-04-11 21:14:52 +02:00
bors
7501d3b721 Auto merge of #14551 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
Fix faulty variable extraction

Followup to #14549

Fixes https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163128814 and https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163132104
2023-04-11 17:43:15 +00:00
Ryo Yoshida
0a638676d1
Fix faulty variable extraction 2023-04-12 02:35:43 +09:00
bors
a1af8bb141 Auto merge of #14548 - Veykril:smol-str, r=Veykril
minor: Bump smol-str
2023-04-11 15:03:24 +00:00