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
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
Laurențiu Nicola
dbf04a5ee2
⬆️ rust-analyzer
2023-03-20 08:31:01 +02: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
Laurențiu Nicola
b2f6fd4f96
⬆️ rust-analyzer
2023-03-13 10:42:24 +02: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
Laurențiu Nicola
7e711da2f0
⬆️ rust-analyzer
2023-02-20 10:14:12 +02:00
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
Laurențiu Nicola
bc45c7659a
⬆️ rust-analyzer
2023-02-13 13:55:14 +02: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
arcnmx
25242fe93f
⬆️ rust-analyzer
...
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -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
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
Ryo Yoshida
0430b68398
Remove unused known Name
s
2022-12-31 16:17:38 +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
hkalbasi
86b5b609f1
Compute data layout of types
2022-12-04 00:29:34 +03:30
Crauzer
b3bd5a471e
implement vararg type collection from function params
2022-11-29 00:32:13 +01:00
Lukas Wirth
7bf2a25dfe
Encode the variants of HirFileId
in a u32 with MSB as the tag
2022-11-25 23:28:35 +01:00
Laurențiu Nicola
a2a1d99545
⬆️ rust-analyzer
2022-11-23 17:24:03 +02:00
Jake Heinz
427b63b676
hir-expand: fix compile_error! expansion not unquoting strings
2022-11-20 08:48:27 +00:00
bors
6f313cef8e
Auto merge of #13548 - lowr:fix/tt-punct-spacing, r=Veykril
...
Fix `tt::Punct`'s spacing calculation
Fixes #13499
We currently set a `tt::Punct`'s spacing to `Spacing::Joint` unless its next token is a trivia (i.e. whitespaces or comment). As I understand it, rustc only [sets `Spacing::Joint` if the next token is an operator](5b3e909075/compiler/rustc_parse/src/lexer/tokentrees.rs (L77-L78)
) and we should follow it to guarantee the consistent behavior of proc macros.
2022-11-11 12:19:30 +00:00
Ryo Yoshida
5b07061011
Test TokenTree
s' equality modulo Punct
s' spacing
2022-11-10 19:40:40 +09:00
Ryo Yoshida
4f415fc348
Ignore outermost non-delimited Subtree
when reversing fixups
2022-11-10 19:22:20 +09:00
Lukas Wirth
ffd7bf8bf9
Bump Cargo rust-version fields to latest stable
2022-11-07 12:59:51 +01:00
Laurențiu Nicola
cff7ab1308
Fix typos
2022-11-07 12:54:12 +02:00
Ryo Yoshida
41b0c54c07
Fix tt::Punct
's spacing calculation
2022-11-05 19:42:09 +09:00
Laurențiu Nicola
8807fc4cc3
⬆️ rust-analyzer
2022-10-26 17:40:41 +03:00
Ryo Yoshida
6459d7f817
Support const generics for builtin derive macro
2022-10-23 00:05:22 +09:00
Lukas Wirth
8047512dca
Revert "feat: Diagnose some incorrect usages of the question mark operator"
2022-10-18 14:18:59 +02:00
Laurențiu Nicola
a99a48e786
⬆️ rust-analyzer
2022-10-18 09:12:49 +03:00
Lukas Wirth
381366f1dd
Diagnose incorrect usages of the question mark operator
2022-10-16 12:58:24 +02:00
bors
855cd5c280
Auto merge of #13418 - lnicola:bump-deps, r=lnicola
...
Bump deps
2022-10-15 11:27:12 +00:00
Laurențiu Nicola
50f990c46f
Bump smallvec
2022-10-15 12:52:34 +03:00
Laurențiu Nicola
cbce0cda08
Bump anyhow, arbitrary, itertools, semver, serde
2022-10-15 12:52:34 +03:00
Laurențiu Nicola
4f55ebbd4f
⬆️ rust-analyzer
2022-10-11 10:37:35 +03:00
bors
21319d135f
Auto merge of #13329 - Veykril:rustc-proc-macro, r=Veykril
...
Use $crate instead of std for panic builtin_fn_macro
This should be closer to the expected output and gets rid of a few type mismatches in rustc/library
2022-10-10 21:35:07 +00:00
Lukas Wirth
c069f1b7d2
Prefer similar tokens when expanding macros speculatively
2022-10-10 22:47:52 +02:00
Lukas Wirth
1574fe0d54
Use $crate instead of std for panic builtin_fn_macro
...
This should be closer to the expected output and gets rid of a few
type mismatches in rustc/library
2022-10-10 10:33:49 +02:00
bors
f88293f777
Auto merge of #13324 - Veykril:trait-impl-completion, r=Veykril
...
Fix trait impl item completions using macro file text ranges
Fixes https://github.com/rust-lang/rust-analyzer/issues/13323
2022-10-01 13:35:08 +00:00
Lukas Wirth
bfd5f00bfc
Fix trait impl item completions using macro file text ranges
2022-10-01 15:34:45 +02:00
Ryo Yoshida
6d8903ae5f
fix: infer for-loop item type with IntoIterator
and Iterator
2022-09-29 19:48:08 +09:00
unexge
89107d5469
Emit unconfigured code diagnostics for fields
2022-09-26 19:04:57 +01:00
Laurențiu Nicola
65e1dc4d9c
⬆️ rust-analyzer
2022-09-06 21:20:49 +03:00
bors
4f8153e4a5
Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril
...
feat: Implement `feature(exhaustive_patterns)` from unstable Rust
Closes #12753
Recognize Rust's unstable `#![feature(exhaustive_patterns)]` (RFC 1872). Allow omitting visibly uninhabited variants from `match` expressions when the feature is on.
This adjusts match checking to the current implementation of the postponed RFC 1872 in rustc.
2022-09-02 12:32:36 +00:00
iDawer
8ae58b9fe4
Record enabled unstable features into DefMap
2022-09-02 16:31:15 +05:00
Lukas Wirth
192a79c235
Remove hir::Expr::MacroStmts
...
This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.
2022-08-31 16:58:11 +02:00
Laurențiu Nicola
31519bb394
⬆️ rust-analyzer
2022-08-23 10:05:52 +03:00