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
Lukas Wirth
513d4a9c9a
Render function parameters in hir-def pretty printing
2023-04-07 09:34:04 +02:00
hkalbasi
0241b52dad
Add bounds for fields in derive macro
2023-04-07 02:21:46 +03:30
Lukas Wirth
0e7117900c
internal: Resolve labels in body lowering
2023-04-06 14:21:20 +02:00
bors
d1c7984396
Auto merge of #14407 - Veykril:rename-fix, r=Veykril
...
fix: Fix renames of locals being broken in macro calls
Fixes https://github.com/rust-lang/rust-analyzer/issues/14379
2023-03-25 18:35:13 +00:00
Lukas Wirth
0daf069b0e
fix: Fix renames of locals being broken in macro calls
2023-03-25 18:37:18 +01:00
Lukas Wirth
d154ea88f9
Split out proc-macros from the CrateGraph
2023-03-25 16:46:44 +01:00
hkalbasi
8e73ea5253
Desugar try blocks
2023-03-19 13:02:51 +03:30
hkalbasi
a063f000ff
Support function pointer MIR lowering
2023-03-17 13:08:35 +03:30
Lukas Wirth
9fe206956f
fix: Fix ast::IfExpr child accessors
2023-03-15 14:34:31 +01:00
Lukas Wirth
aaf08bdcc5
Shrink ProcMacroExpander size
2023-03-13 16:49:38 +01:00
Lukas Wirth
9fb9ee3b6a
internal: Rename AstDatabase to ExpandDatabase
2023-03-13 16:35:41 +01:00
Lukas Wirth
3427d36d0e
fix: Fix search not searching bodies of attributed items
2023-03-09 15:30:17 +01:00
Lukas Wirth
fc2b395e00
Show pattern mismatch diagnostics
2023-03-03 10:41:44 +01:00
hkalbasi
cd67589f63
beginning of MIR
2023-02-27 23:45:54 +03:30
Lukas Wirth
3c0f20a7bd
internal: Enable smallvec's union
feature
2023-02-14 17:01:01 +01:00
bors
2a57b01980
Auto merge of #14122 - lowr:patch/abort-macro-expansion-on-overflow, r=Veykril
...
fix: Don't expand macros in the same expansion tree after overflow
This patch fixes 2 bugs:
- In `Expander::enter_expand_id()` (and in code paths it's called), we never check whether we've reached the recursion limit. Although it hasn't been reported as far as I'm aware, this may cause hangs or stack overflows if some malformed attribute macro is used on associated items.
- We keep expansion even when recursion limit is reached. Take the following for example:
```rust
macro_rules! foo { () => {{ foo!(); foo!(); }} }
fn main() { foo!(); }
```
We keep expanding the first `foo!()` in each expansion and would reach the limit at some point, *after which* we would try expanding the second `foo!()` in each expansion until it hits the limit again. This will (by default) lead to ~2^128 expansions.
This is essentially what's happening in #14074 . Unlike rustc, we don't just stop expanding macros when we fail as long as it produces some tokens so that we can provide completions and other services in incomplete macro calls.
This patch provides a method that takes care of recursion depths (`Expander::within_limit()`) and stops macro expansions in the whole macro expansion tree once it detects recursion depth overflow. To be honest, I'm not really satisfied with this fix because it can still be used in unintended ways to bypass overflow checks, and I'm still seeking ways such that misuses are caught by the compiler by leveraging types or something.
Fixes #14074
2023-02-14 07:37:53 +00:00
Ryo Yoshida
92fdfb548e
Make is_raw_identifier()
public util function
2023-02-13 18:43:59 +09:00
Ryo Yoshida
ae7e62c50f
Don't expand macros in the same expansion tree after overflow
2023-02-11 18:19:08 +09: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
Lukas Wirth
41a46a78f2
Make tt generic over the span data
2023-01-31 14:58:16 +01:00
Lukas Wirth
c65782e64a
Parse macros allow_internal_unsafe attribute
2023-01-30 15:41:08 +01:00
Lukas Wirth
54da0bfbf0
Record method resolution for call expressions
2023-01-27 11:06:41 +01:00
Lukas Wirth
1535881836
Replace SmolStr usage with lang item enum for lang items
2023-01-21 17:55:45 +01: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
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
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
15fb082cc1
Auto merge of #13753 - kdy1:limit, r=lnicola
...
fix: Increase token limit of proc macro
Fixes #13738
[The swc project](https://swc.rs ) has lots of type definitions, and the current limit is too low for the ECMAScript/CSS visitors.
[rustdoc](https://rustdoc.swc.rs/swc_ecma_visit )
---
With this fix, the rust-analyzer shows trait-related actions.
<img width="1840" alt="image" src="https://user-images.githubusercontent.com/29931815/206839269-d7a04589-7dba-449b-ad0b-1f69d52bd039.png ">
2023-01-13 11:45:50 +00:00
Lukas Wirth
1ce3e820dc
feat: Make unlinked_file diagnostic quickfixes work for inline modules
2023-01-11 22:39:05 +01:00
Lukas Wirth
621e96bd6a
Encode one level of cfg_attr in attr_id
2023-01-09 21:06:13 +01: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
Laurențiu Nicola
9f6567f20c
Fix option_env expansion
2023-01-06 16:00:23 +02:00
Donny/강동윤
4f369427b5
increase limit
2023-01-03 13:16:06 +09:00
Daniel Eades
8615bba105
use 'unwrap_or_default'
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