Lukas Wirth
002e611d09
fix: Deduplicate annotations
2023-12-19 08:49:00 +01:00
Lukas Wirth
f49a2fed3f
internal: Move out WithFixture
into dev-dep only crate
2023-12-18 15:24:08 +01:00
Lukas Wirth
ec6162308e
Move the SpanMap definition into the span crate
2023-12-18 14:50:48 +01:00
Lukas Wirth
66e29be1bd
internal: Split out a span crate
2023-12-18 14:08:33 +01:00
Lukas Wirth
35620306a6
internal: Move proc-macro knowledge out of base-db
2023-12-18 12:37:18 +01:00
bors
a7764198b1
Auto merge of #16123 - Veykril:simplify, r=Veykril
...
internal: Remove `ModuleId` from `TypeOwnerId`
It only exists due to the IDE layer, but we can encode this temporary hack more cleanly
2023-12-15 13:10:17 +00:00
Lukas Wirth
4c45d23948
fix: Syntax fixup now removes subtrees with fake spans
2023-12-15 13:52:49 +01:00
Lukas Wirth
9083017c9d
Remove ModuleId
from TypeOwnerId
2023-12-14 14:11:57 +01:00
Lukas Wirth
c209b5f97c
fix: Fix syntax bridge assigning invalid span to lifetime tokens
2023-12-12 22:05:21 +01:00
Laurențiu Nicola
13d4609f50
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2023-12-12 12:26:15 +02:00
hkalbasi
801c0ea478
Replace doc_comments_and_attrs
with collect_attrs
, 2nd round
2023-12-11 22:56:50 +03:30
Laurențiu Nicola
71d98c53bd
Fix typo in cfg
2023-12-11 11:55:43 +02:00
Laurențiu Nicola
f532576ac5
Merge commit '457b966b171b09a7e57acb710fbca29a4b3526f0' into sync-from-ra
2023-12-11 11:16:01 +02:00
Lukas Wirth
b1a8f83a0c
fix: Smaller spans for unresolved field and method diagnostics
2023-12-08 18:46:36 +01:00
bors
9c3de09f6d
Auto merge of #16054 - Veykril:fix-downmapping, r=Veykril
...
fix: Fix token downmapping being quadratic
Fixes https://github.com/rust-lang/rust-analyzer/issues/16050
2023-12-08 14:28:18 +00:00
Lukas Wirth
5d951a6a46
fix: Fix token downmapping being quadratic
2023-12-08 15:26:38 +01:00
Lukas Wirth
71337f6682
fix: Fix concat_bytes!
expansion
2023-12-08 11:34:03 +01:00
David Barsky
c17dcc8d90
internal: switch to Arc::from_iter
2023-12-06 13:08:45 -05:00
Lukas Wirth
80dc20f7d8
fix: Don't print proc-macro panic backtraces in the logs
2023-12-06 17:49:48 +01:00
Lukas Wirth
634d588fd7
Simplify
2023-12-06 14:36:39 +01:00
Lukas Wirth
9cb13b6efb
Allow navigation targets to be duplicated when the focus range lies in the macro definition site
2023-12-06 12:38:19 +01:00
Lukas Wirth
5b8e386bae
Improve macro descension API
2023-12-05 17:06:57 +01:00
Igor Matuszewski
a7224c998d
Don't explicitly warn against semicolon_in_expressions_from_macros
...
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
Lukas Wirth
18f1a3c3c6
Some final touches
2023-12-03 20:20:59 +01:00
Lukas Wirth
81410ab500
Cleanup FileId stuff
2023-12-02 19:32:53 +01:00
Lukas Wirth
02a3a9438a
Some more minor cleanups
2023-12-02 17:04:13 +01:00
Lukas Wirth
5edf7bddc6
Fix mod item in included file resolving incorrectly
2023-12-02 13:49:09 +01:00
Lukas Wirth
d2a31acda1
Fix macro expansion expression parenthesis wrapping
2023-12-02 13:03:46 +01:00
Lukas Wirth
efa67294ed
Fix eager macro input spans being discarded
2023-12-01 16:29:58 +01:00
Lukas Wirth
c11737cd63
Simplify include handling
2023-12-01 14:58:57 +01:00
Lukas Wirth
0003e568ca
Pass calling span through to builtin macro expansions
2023-12-01 14:11:57 +01:00
Lukas Wirth
f48fa0c6cb
Re-implement syntax fixups
2023-11-29 16:00:39 +01:00
Lukas Wirth
7a8c4c001b
Turn macro_expand from query to normal function
2023-11-28 17:23:51 +01:00
Lukas Wirth
b98597f06d
Re-enable proc-macros
2023-11-28 16:28:56 +01:00
Lukas Wirth
98cfdde8ba
Thinner TokenMap
2023-11-28 10:56:25 +01:00
Lukas Wirth
92d447f976
🧹
2023-11-28 10:55:40 +01:00
Lukas Wirth
ab8f12e169
Rename hygiene vars and fields to span_map
2023-11-28 10:55:40 +01:00
Lukas Wirth
c43078f99d
Re-implement InFile wrappers as type aliases over generic InFileWrapper
2023-11-28 10:55:40 +01:00
Lukas Wirth
30093a6d81
spans always come from real file
2023-11-28 10:55:39 +01:00
Lukas Wirth
394d11b0fa
Fix float-split hack not setting up spans correctly
2023-11-28 10:55:39 +01:00
Lukas Wirth
05f375eae2
hygiene 2.0
2023-11-28 10:55:39 +01:00
Lukas Wirth
e36b3f7b8c
Proper span representation with syntax context
2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
Laurențiu Nicola
59f5d51852
Merge commit '141fc695dca1df7cfc3c9803972ec19bb178dcbc' into sync-from-ra
2023-11-16 22:27:35 +02:00
bors
58de0b130a
Auto merge of #15902 - lnicola:bump-deps, r=Veykril
...
internal: Bump deps pt. 1
2023-11-15 19:37:06 +00:00
Lukas Wirth
e8c4007cfc
Fix builtin line! expansion
2023-11-15 14:06:10 +01:00
Laurențiu Nicola
cb8434e594
Bump either
2023-11-15 13:07:36 +02:00
Laurențiu Nicola
f53368dd3f
Bump tracing
2023-11-15 13:00:32 +02:00
Laurențiu Nicola
f66df10f87
Bump itertools
2023-11-15 12:53:56 +02:00
Laurențiu Nicola
9826717550
Improve check for include macro
2023-11-10 16:53:08 +02:00
Laurențiu Nicola
d1d111d09e
Merge commit '3b7c7f97e4a7bb253a8d398ee4f8346f6cf2817b' into sync-from-ra
2023-11-08 08:15:03 +02:00
luoyangze.ptrl
b76f2c8ee0
fix: using name(include) instead of str
2023-11-02 10:14:54 +08:00
luoyangze.ptrl
740a864b7c
feat: skip checking tt count for include macro call
2023-11-02 00:27:11 +08:00
Lukas Wirth
2b9dde14ab
Allocate ast ids for parameters
2023-09-28 13:16:11 +02:00
Laurențiu Nicola
bcfc997eac
Merge commit '258b15c506a2d3ad862fd17ae24eaf272443f477' into sync-from-ra
2023-09-18 12:33:49 +03:00
Lukas Wirth
c0e402637e
Emit builtin#format_args in builtin format_args expander
2023-09-06 18:08:20 +02:00
Lukas Wirth
e243a03da1
Desugar builtin#format_args
2023-09-06 15:21:41 +02:00
Lukas Wirth
abe8f1ece4
Implement builtin#format_args, using rustc's format_args parser
2023-09-05 19:19:46 +02:00
Lukas Wirth
15048304e3
Implement offset_of in hir-def and hir-ty
2023-09-05 12:27:52 +02:00
Lukas Wirth
9b8eb807a3
Parse builtin# syntax
2023-09-05 10:36:35 +02:00
hkalbasi
fa76f60cc1
Run cargo fmt on 1.72
2023-08-25 22:24:41 +03:30
Laurențiu Nicola
30d8aa1bec
Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra
2023-08-21 12:44:09 +03:00
Lukas Wirth
53b292478d
internal: Add offset param to token descending API
2023-08-16 10:07:18 +02:00
Lukas Wirth
9adff006e8
Simplify
2023-08-10 20:10:19 +02:00
Lukas Wirth
e5b23e3bc1
Derive block attributes from block item tree
2023-08-10 18:52:27 +02:00
Laurențiu Nicola
aa55ce9567
Merge commit 'baee6b338b0ea076cd7a9f18d47f175dd2ba0e5d' into sync-from-ra
2023-08-07 12:03:15 +03:00
Lukas Wirth
75607fc34c
Simplify
2023-08-01 17:47:52 +02:00
Lukas Wirth
d999d34e39
Don't bail eager expansion when inner macros fail to resolve
2023-08-01 11:26:30 +02:00
Lukas Wirth
c7b34e4873
fix: Strip unused token ids from eager macro input token maps
2023-07-31 17:12:17 +02:00
Lukas Wirth
bf5624664d
fix: Remove another faulty unwrap (expect)
2023-07-31 16:47:45 +02:00
Lukas Wirth
7c765d9f9e
fix: Expand eager macros to delimited comma separated expression list
2023-07-30 17:31:26 +02:00
Lukas Wirth
df725d6b6d
fix: Do not create fn macro calls with non-fn expanders
2023-07-30 12:18:19 +02:00
Lukas Wirth
3db437cbd6
fix: Fix bad unwrap in eager_macro_recur
2023-07-30 11:41:21 +02:00
Laurențiu Nicola
4704881b64
Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-ra
2023-07-17 16:49:15 +03:00
bors
8e5f944317
Auto merge of #15282 - HKalbasi:mir, r=HKalbasi
...
Give real discriminant_type to chalk
2023-07-14 16:46:35 +00:00
hkalbasi
50559118fb
Give real discriminant_type to chalk
2023-07-14 20:15:18 +03:30
Lukas Wirth
6a7b905c86
Fix the eager token maps by re-mapping the textranges between the input and input expansion
2023-07-13 09:22:38 +02:00
Lukas Wirth
2366c16bf9
Fix eager token mapping panics
2023-07-11 13:54:28 +02:00
Lukas Wirth
f6c09099da
Don't unnecessarily clone the input tt for decl macros
2023-07-10 16:28:23 +02:00
Lukas Wirth
d5f64f875a
Infallibe ExpandDatabase::macro_def
2023-07-10 16:23:29 +02:00
Lukas Wirth
4ff93398fd
Skip buildin subtrees for builtin derives
2023-07-10 15:19:00 +02:00
hkalbasi
3a1054fc1c
Replace x
with it
2023-07-06 17:33:17 +03:30
bors
4125fea0a7
Auto merge of #15222 - HKalbasi:mir, r=HKalbasi
...
Fix size_of_val and support min_align_of_val
2023-07-06 12:40:21 +00:00
hkalbasi
171ae2ee5d
Fix size_of_val and support min_align_of_val
2023-07-06 15:41:52 +03:30
Ryo Yoshida
827a0530bc
Don't show unresolved-field
diagnostic for missing names
2023-07-06 20:39:48 +09:00
Lukas Wirth
8886d707b8
Stronger typing for AstId and AstIdMap
2023-07-04 09:16:15 +02:00
Lukas Wirth
69cd3c30ac
Format let-else
2023-07-03 20:34:09 +02:00
Lukas Wirth
bdc3d0f551
Shuffle some proc_macro_expand query things around
2023-07-03 15:05:25 +02:00
Lukas Wirth
321e570d92
Don't diagnose builtin derives
2023-07-03 14:23:36 +02:00
bors
76bcd9946a
Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
...
Use anonymous lifetime where possible
Because anonymous lifetimes are *super* cool.
More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
2023-06-30 16:57:20 +00:00
hkalbasi
f53f9230f0
Support #[derive_const(Trait)]
2023-06-29 20:58:35 +03:30
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible
2023-06-29 23:27:28 +09:00
Lukas Wirth
8823db6c78
Bump more deps
2023-06-22 11:44:10 +02:00
David Lattimore
bea3a33d84
Change in-tree libs to workspace dependencies
2023-06-20 13:53:39 +10:00
hkalbasi
3c87825074
Use ArgumentV1
instead of Argument
2023-06-19 22:48:49 +03:30
Laurențiu Nicola
9326cf7f0c
Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-ra
2023-06-19 09:14:04 +03:00
bors
9c967d3809
Auto merge of #15053 - Veykril:crate-root-module-id, r=Veykril
...
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 14:41:06 +00:00
Lukas Wirth
cf178cba8f
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 15:41:06 +02:00
bors
07bc6cbcad
Auto merge of #15040 - lnicola:hash-state-name, r=Veykril
...
fix: Use a more obscure hasher name in derive expansion
Closes #15039
2023-06-13 06:13:35 +00:00
Laurențiu Nicola
0b441ca6a5
Use a more obscure hasher name in derive expansion
2023-06-13 08:50:27 +03:00
hkalbasi
f8594f78bb
Use ConstArg
instead of Expr
for AstId
of InTypeConstId
2023-06-11 00:39:28 +03:30
hkalbasi
a481e004b0
Lower const params with a bad id
2023-06-11 00:39:28 +03:30
Lukas Wirth
b6fb35f20c
Shrink hir_expand::attr::AttrInput by boxing a variant
2023-06-10 01:21:52 +02:00
Lukas Wirth
a02b9b279e
internal: Lazy eager macros
2023-06-09 13:02:13 +02:00
hkalbasi
30e16e20d0
Fix unwrap on None in expanding format args
2023-06-08 00:17:22 +03:30
Ryo Yoshida
4f0c6fac17
fix: only generate trait bound for associated types in field types
2023-06-07 20:52:49 +09:00
Laurențiu Nicola
c48062fe2a
Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra
2023-06-05 12:04:23 +03:00
Laurențiu Nicola
c3dbe7c717
Merge remote-tracking branch 'upstream/master' into sync-from-rust
2023-06-05 11:07:47 +03:00
Lukas Wirth
bbd9e41606
Don't add --all-targets to runnables for no-std crates
2023-05-28 14:18:44 +02:00
hkalbasi
b0f17668f7
use ::core
instead of $crate
in option_env!
2023-05-25 18:46:34 +03:30
Lukas Wirth
c7ef6c25b7
internal: Replace Display impl for Name
2023-05-24 20:55:12 +02:00
bors
2f840c2236
Auto merge of #14874 - Veykril:crate-cfg, r=Veykril
...
expand: Change how `#![cfg(FALSE)]` behaves on crate root
Closes https://github.com/rust-lang/rust-analyzer/issues/14769
2023-05-24 16:06:09 +00:00
Lukas Wirth
74d6826858
expand: Change how #![cfg(FALSE)]
behaves on crate root
2023-05-24 13:02:38 +02:00
Lukas Wirth
14dc1ac3bf
internal: Shrink ProcMacroExpander from 8 to 4 bytes
2023-05-20 11:31:28 +02:00
hkalbasi
4adfbbfbad
partially support panic message in MirEvalError
2023-05-18 18:30:49 +03:30
bors
034d7c8537
Auto merge of #14787 - HKalbasi:mir2, r=HKalbasi
...
MIR episode 5
This PR inits drop support (it is very broken at this stage, some things are dropped multiple time, drop scopes are wrong, ...) and adds stdout support (`println!` doesn't work since its expansion is dummy, but `stdout().write(b"hello world\n")` works if you use `RA_SYSROOT_HACK`) for interpreting. There is no useful unit test that it can interpret yet, but it is a good sign that it didn't hit a major road block yet.
In MIR lowering, it adds support for slice pattern and anonymous const blocks, and some fixes so that we can evaluate `SmolStr::new_inline` in const eval. With these changes, 57 failed mir body remains.
2023-05-18 09:44:26 +00:00
bors
f9be79603a
Auto merge of #14820 - HKalbasi:format-args, r=HKalbasi
...
Expand `format_args!` with more details
2023-05-18 09:09:06 +00:00
hkalbasi
5c83e222a3
fix format_args
expansion error with raw strings
2023-05-18 12:32:41 +03:30
Lukas Wirth
d6dcfa5744
internal: Less file parsing for symbol index generation
2023-05-18 08:25:06 +02:00
hkalbasi
a6e5a912f9
Expand format_args!
with more details
2023-05-16 19:12:40 +03:30
hkalbasi
cbcafd3539
MIR episode 5
2023-05-12 18:17:15 +03:30
hkalbasi
7da80d4f67
Use double reference in debug derive
2023-05-12 12:36:57 +03:30
Ryo Yoshida
34a9129333
fix: column!()
and line!()
built-in macros return u32
2023-05-11 21:13:05 +09:00
hkalbasi
d9f4cbbe8f
Emit function bodies in expanding builtin derives
2023-05-03 14:14:47 +03:30
Laurențiu Nicola
7197a27028
Use triomphe Arc
2023-05-02 20:02:43 +03:00
bors
e46d7a030f
Auto merge of #14651 - Veykril:workspace-vscode-fix, r=Veykril
...
fix: Fix vscode workspaces not working properly
Fixes https://github.com/rust-lang/rust-analyzer/issues/14571
2023-04-25 09:09:31 +00:00
Lukas Wirth
49fcd4edda
fix: Fix vscode workspaces not working properly
2023-04-25 10:47:33 +02:00
bors
707382c21d
Auto merge of #14652 - Veykril:pat2021, r=Veykril
...
fix: Fix pat fragment handling in 2021 edition
Fixes https://github.com/rust-lang/rust-analyzer/issues/9055
The fix isn't that great, but we are kind of forced to do it the quick and hacky way right now since std has changed the `matches` macro to make use of this now. And for a proper fix we need to track hygiene for identifiers which is a long way off anyways
2023-04-24 20:36:45 +00:00
Lukas Wirth
d1ca505525
fix: Fix pat fragment handling in 2021 edition
2023-04-24 22:21:37 +02:00
Mara Bos
429d06b879
Remove "V1" from ArgumentsV1 and FlagsV1.
2023-04-24 16:16:14 +02:00
Lukas Wirth
cebc018e2a
Remove unnecessary is_derive field from MacroCallKind::Attr
2023-04-22 14:29:28 +02:00
bors
5750d81e30
Auto merge of #14632 - Veykril:lru-macro, r=lnicola
...
internal: Increase LRU cache size for parse_expansion and macro_expand queries
2023-04-22 11:13:35 +00:00
Lukas Wirth
6253fc031b
Increase LRU cache size for parse_expansion and macro_expand queries
2023-04-22 11:28:56 +02:00
Ryo Yoshida
85e76542fe
Cache Hygiene
in DefCollector
2023-04-22 18:22:29 +09:00
Ryo Yoshida
cf72b6232b
Resolve $crate
in derive paths
2023-04-20 15:50:17 +09:00
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
Lukas Wirth
4ea5d7f6a0
Re-introduce option for macro_arg to prevent calling macros with empty inputs
2023-04-16 20:26:26 +02:00
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
96a774261f
Option begone part 1
2023-04-16 19:20:42 +02:00
Lukas Wirth
0f4ffaa5af
Fix duplicate eager expansion errors
2023-04-16 19:20:35 +02: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
Lukas Wirth
a5558cdfe5
internal: Report macro definition errors on the definition
2023-04-16 14:15:59 +02:00
Lukas Wirth
ed3a5eac3c
internal: Put Attrs behind a query instead of AttsWithOwner
2023-04-14 12:47:33 +02:00
Jonas Schievink
901c8a4259
Map tokens from include!
expansion to the included file
2023-04-13 17:41:24 +02:00
hkalbasi
c54cb88950
Add bounds for associated types in derive macro
2023-04-07 19:33:14 +03:30
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro"
2023-04-07 11:01:17 +02:00
bors
d73161b491
Auto merge of #14524 - Veykril:hir-pretty, r=Veykril
...
internal: Render function parameters in hir-def pretty printing
2023-04-07 07:34:45 +00:00