Lukas Wirth
9476fdaaa9
HIR ExternCrateDecl
2023-06-19 14:15:08 +02:00
Lukas Wirth
0bde3fc77e
Intern use and extern crate items like other items
2023-06-19 13:51:44 +02:00
Laurențiu Nicola
9326cf7f0c
Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-ra
2023-06-19 09:14:04 +03:00
Lukas Wirth
c3186202a2
Shrink size of hir::Binding
2023-06-18 12:03:04 +02:00
Lukas Wirth
83d7724629
fix: Add binding definition for for-expr iterator desugared binding
2023-06-18 11:44:01 +02:00
Lukas Wirth
58ac823864
Less eager parsing for module sources
2023-06-17 10:58:52 +02:00
Lukas Wirth
3484b5a116
internal: Do not allocate unnecessarily when importing macros from parent modules
2023-06-16 18:41:06 +02: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
Lukas Wirth
abe249559d
internal: Give ConstBlockId and InTypeConstId named Location types
2023-06-12 18:21:17 +02:00
hkalbasi
a4695788ca
Add a bunch of fixme comments
2023-06-12 00:37:11 +03:30
hkalbasi
e83b56739f
Flatten the TypeOwnerId
2023-06-11 01:36:32 +03:30
hkalbasi
f8594f78bb
Use ConstArg
instead of Expr
for AstId
of InTypeConstId
2023-06-11 00:39:28 +03:30
hkalbasi
d9136df9e5
Handle return types for in type const bodies
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
bors
9d5c34a80e
Auto merge of #14970 - HKalbasi:mir-fix, r=HKalbasi
...
Detect "bound more than once" error and suppress `need-mut` for it.
Fix the `need-mut` false positive for `izip!`
2023-06-04 09:33:53 +00:00
hkalbasi
71f3e4b08c
Detect "bound more than once" error and suppress need-mut
for it.
2023-06-04 12:39:36 +03:30
Lukas Wirth
f9a9e40c0a
Update builtin attribute list
2023-06-04 10:02:11 +02:00
bors
0b4c09b1d2
Auto merge of #14941 - Veykril:def-map, r=Veykril
...
Shrink `DefMap`, share crate level items with block def maps
2023-06-01 16:42:12 +00:00
Lukas Wirth
11b937177b
Skip extern prelude path resolution in block def maps
2023-06-01 17:58:08 +02:00
bors
4458e7f190
Auto merge of #14942 - HKalbasi:for-loop-label, r=HKalbasi
...
fix bug in labeled for loop desugaring
fix https://github.com/rust-lang/rust-analyzer/pull/14892#discussion_r1213091393
2023-06-01 14:54:47 +00:00
hkalbasi
f4c52b40bd
fix bug in labeled for loop desugaring
2023-06-01 17:51:53 +03:30
Lukas Wirth
54e3ef658a
Rename nameres::CrateData to DefMapCrateData
2023-06-01 15:50:19 +02:00
Lukas Wirth
1e6406e223
Move extern prelude into CrateData
2023-06-01 15:49:05 +02:00
Lukas Wirth
bdca349573
Arc DefMap::data so the block def maps can share it
2023-06-01 15:27:05 +02:00
Lukas Wirth
5c466ccc2b
Refactor out some crate wide data in DefMap into nested struct
2023-06-01 15:04:38 +02:00
Lukas Wirth
dc7c6d43c7
Slightly shrink DefMap
2023-06-01 14:46:36 +02:00
Lukas Wirth
0e28202832
Insert missing expr/pat for leading comma tuples
2023-06-01 08:56:40 +02:00
Oli Scherer
1570299af4
Remove const eval limit and implement an exponential backoff lint instead
2023-05-31 10:24:17 +00:00
bors
76d86502f7
Auto merge of #14912 - Veykril:cargo-alltargets, r=Veykril
...
Don't add --all-targets to runnables for no-std crates
Fixes https://github.com/rust-lang/rust-analyzer/issues/14155
2023-05-30 12:34:28 +00:00
hkalbasi
51368793b4
MIR episode 6
2023-05-28 23:25:15 +03:30
Lukas Wirth
8bc826dd53
Add diagnostic for _
expressions (typed holes)
2023-05-28 14:55:28 +02:00
Lukas Wirth
bbd9e41606
Don't add --all-targets to runnables for no-std crates
2023-05-28 14:18:44 +02:00
Ryo Yoshida
0d4d1d7e3b
Implement ${count()}
metavariable expression
2023-05-28 19:54:36 +09:00
Ryo Yoshida
9ebaa85d37
Split test module for metavariable expressions
2023-05-28 19:54:23 +09:00
hkalbasi
780349bdaf
fix need-mut
false positive in closure capture of match scrutinee
2023-05-26 02:08:37 +03:30
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
bors
2df56cadcb
Auto merge of #14755 - poliorcetics:clippy-fixes, r=Veykril
...
Fix: a TODO and some clippy fixes
- fix(todo): implement IntoIterator for ArenaMap<IDX, V>
- chore: remove unused method
- fix: remove useless `return`s
- fix: various clippy lints
- fix: simplify boolean test to a single negation
2023-05-24 11:13:52 +00:00
Lukas Wirth
74d6826858
expand: Change how #![cfg(FALSE)]
behaves on crate root
2023-05-24 13:02:38 +02:00
hkalbasi
c5ea2d7adc
handle match scrutinee in closure captures
2023-05-19 12:04:12 +03:30
hkalbasi
4adfbbfbad
partially support panic message in MirEvalError
2023-05-18 18:30:49 +03:30
bors
9ce95674e8
Auto merge of #14837 - Veykril:rustc-lexer, r=Veykril
...
Support c string literals
2023-05-18 11:55:38 +00:00
Lukas Wirth
3e528b85f9
Fix cstring literals construct &CStr not &str
2023-05-18 12:03:15 +02:00
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
Lukas Wirth
4b577e2bc8
Support c string literals
2023-05-18 11:06:05 +02:00
hkalbasi
5c83e222a3
fix format_args
expansion error with raw strings
2023-05-18 12:32:41 +03:30
bors
c7b03491cd
Auto merge of #14834 - Veykril:ty-diag-unit, r=Veykril
...
internal: Less file parsing for symbol index generation
2023-05-18 06:25:40 +00:00
Lukas Wirth
d6dcfa5744
internal: Less file parsing for symbol index generation
2023-05-18 08:25:06 +02:00
Ryo Yoshida
68a74decb6
Process macro_use
prelude in semantic scope resolver
2023-05-17 17:45:44 +09:00
hkalbasi
a2fba7c67e
Add test for eager expanding of format_args
2023-05-17 01:15:04 +03:30
hkalbasi
a6e5a912f9
Expand format_args!
with more details
2023-05-16 19:12:40 +03:30
bors
9eb26a9375
Auto merge of #14809 - lowr:patch/macro_use-filter, r=Veykril
...
Support `#[macro_use(name, ...)]`
This PR adds support for another form of the `macro_use` attribute: `#[macro_use(name, ...)]` ([reference]).
Note that this form of the attribute is only applicable to extern crate decls, not to mod decls.
[reference]: https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute
2023-05-15 10:04:05 +00:00
bors
bc03418127
Auto merge of #14746 - lowr:patch/associated-return-types, r=Veykril
...
Parse associated return type bounds
This PR implements parser support for associated return type bounds: `T: Foo<bar(): Send>`. This PR does not implement associated return types (`T::bar(): Send`) because it's not implemented even in rustc, and also removes `(..)`-style return type notation because it has been removed in rust-lang/rust#110203 (effectively reverting #14465 ).
I don't plan to proactively follow this unstable feature unless an RFC is accepted and my main motivation here is to remove no-longer-valid syntax `(..)` from our parser, nevertheless adding minimal parser support so anyone interested (as can be seen in #14465 ) can experiment it without rust-analyzer's syntax errors.
2023-05-15 09:16:51 +00:00
Ryo Yoshida
1bc7f8a4c6
Support #[macro_use(name, ...)]
2023-05-15 00:05:44 +09:00
bors
daa03b0b0b
Auto merge of #14800 - lowr:patch/macro-subns-and-prelude, r=Veykril
...
Expand more single ident macro calls upon item collection
Addresses https://github.com/rust-lang/rust-analyzer/pull/14781#issuecomment-1546201022
I believe this (almost) brings the number of unresolved names back to pre-#14781:
|r-a version|`analysis-stats compiler/rustc` (rust-lang/rust@69fef92ab2 ) |
|---|---|
|pre-#14781 (b069eb720b
) | exprs: 2747778, ??ty: 122236 (4%), ?ty: 107826 (3%), !ty: 728 |
| #14781 (a7944a93a1
) | exprs: 2713080, ??ty: 139651 (5%), ?ty: 114444 (4%), !ty: 730 |
| with this fix | exprs: 2747871, ??ty: 122237 (4%), ?ty: 108171 (3%), !ty: 676 |
(I haven't investigated on the increase in some numbers but hopefully not too much of a problem)
This is only a temporary solution. The core problem is that we haven't fully implemented the textual scope of legacy macros. For example, we *have been* failing to resolve `foo` in the following snippet, even before #14781 or after this patch. As noted in a FIXME, we need a way to resolve names in textual scope without eager expansion during item collection.
```rust
//- /main.rs crate:main deps:lib
lib::mk_foo!();
const A: i32 = foo!();
//^^^^^^ unresolved-macro-call
//- /lib.rs crate:lib
#[macro_export]
macro_rules! mk_foo {
() => {
macro_rules! foo { () => { 42 } }
}
}
```
2023-05-13 18:47:42 +00:00
Ryo Yoshida
e9ddb62c65
Expand more single ident macro calls upon their collection
2023-05-14 03:11:10 +09:00
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
f2a35deb50
Consider macro sub-namespace during name resolution
2023-05-11 21:13:12 +09:00
Ryo Yoshida
3203ea896d
Add macro_use
prelude to DefMap
2023-05-11 21:13:11 +09:00
Ryo Yoshida
96113b7b8e
Remove prelude fallback path for Rust <1.52.0
...
We've already removed non-sysroot proc macro server, which effectively
removed support for Rust <1.64.0, so this removal of fallback path
shouldn't be problem at this point.
2023-05-11 21:13:10 +09:00
Ryo Yoshida
34a9129333
fix: column!()
and line!()
built-in macros return u32
2023-05-11 21:13:05 +09:00
Ryo Yoshida
a0a7860141
Refactor
2023-05-11 18:17:16 +09:00
Arpad Borsos
35940bcda3
Remove identity_future
from stdlib
...
This function/lang_item was introduced in #104321 as a temporary workaround of future lowering.
The usage and need for it went away in #104833 .
After a bootstrap update, the function itself can be removed from `std`.
2023-05-07 10:52:01 +02:00
Alexis (Poliorcetics) Bourget
d7fdf141a4
fix: various clippy lints
2023-05-07 09:43:37 +02:00
Ryo Yoshida
fa2340a4df
Parse associated return type bounds
2023-05-06 20:31:11 +09:00
Ryo Yoshida
d7d8971203
Remove (..)
-style return type notation
2023-05-06 20:30:17 +09:00
bors
0dd94d3b07
Auto merge of #14738 - Veykril:def-map-fix, r=Veykril
...
fix: Fix body lowering not using block def maps
Fixes the issue in the comment here https://github.com/rust-lang/rust-analyzer/issues/10084#issuecomment-1534320254 , not the general issue unfortunately.
2023-05-04 18:47:04 +00:00
Lukas Wirth
9419fcb109
fix: Fix body lowering not using block def maps
2023-05-04 20:46:05 +02: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
hkalbasi
3a3c3630a2
fix break-outside-of-loop false positive in try block
2023-05-02 03:11:56 +03:30
hkalbasi
6312fbf521
MIR episode 4
2023-05-01 23:23:10 +03:30
Lukas Wirth
cf8f13b531
fix: Fix restart server button trying to start instead of restart the server
2023-04-28 21:34:31 +02:00
Matthias Krüger
e99a9904aa
Rollup merge of #110766 - m-ou-se:fmt-rt, r=jyn514
...
More core::fmt::rt cleanup.
- Removes the `V1` suffix from the `Argument` and `Flag` types.
- Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.)
Part of https://github.com/rust-lang/rust/issues/99012
Follow-up to https://github.com/rust-lang/rust/pull/110616
2023-04-28 07:34:02 +02:00
Lukas Wirth
10d7d7304b
Revert "Handle dev-dependency cycles"
2023-04-25 14:29:26 +02:00
Lukas Wirth
e205af259d
Prefer test duped crates for ide features
2023-04-25 11:39:58 +02:00
Matthias Krüger
6bd8fee558
Revert "Remove #[alloc_error_handler] from the compiler and library"
...
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-25 00:08:35 +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
bors
b2e6f3a9da
Auto merge of #14636 - Veykril:macros, r=Veykril
...
internal: Remove unnecessary is_derive field from MacroCallKind::Attr
2023-04-24 06:13:18 +00:00
hkalbasi
232f293c19
Fix some typos in StructFlags
2023-04-23 21:55:47 +03:30
Lukas Wirth
cebc018e2a
Remove unnecessary is_derive field from MacroCallKind::Attr
2023-04-22 14:29:28 +02:00
bors
442a769f82
Auto merge of #14634 - Veykril:assoc-collect, r=Veykril
...
fix: Report remaining macro errors in assoc item collection
2023-04-22 09:49:57 +00:00
Lukas Wirth
77afc6e793
fix: Report remaining macro errors in assoc item collection
2023-04-22 11:49:00 +02:00
bors
34ebb30e84
Auto merge of #14610 - lowr:fix/hygiene-for-meta-item, r=Veykril
...
fix: Resolve `$crate` in derive paths
Paths in derive meta item list may contain any kind of paths, including those that start with `$crate` generated by macros. We need to take hygiene into account when we lower paths in the list.
This issue was identified while investigating #14607 , though this patch doesn't fix the broken trait resolution.
2023-04-22 09:36:38 +00:00
Ryo Yoshida
85e76542fe
Cache Hygiene
in DefCollector
2023-04-22 18:22:29 +09:00
bors
6f43a56201
Auto merge of #14633 - Veykril:assoc-collect, r=Veykril
...
internal: Don't reparse files when trying to expand assoc item macro calls
2023-04-22 09:02:25 +00:00
Lukas Wirth
2aa44c8e37
internal: Don't reparse files when trying to expand assoc item macro calls
2023-04-22 11:02:11 +02:00
bors
1379b5fac7
Auto merge of #14630 - Veykril:arc, r=Veykril
...
internal: `Arc<String>` -> `Arc<str>`
2023-04-22 07:58:13 +00:00
Lukas Wirth
f00dcf9a69
internal: Arc<String> -> Arc<str>
2023-04-22 09:48:37 +02: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
bors
9b835f334f
Auto merge of #14594 - Veykril:Simplify, r=Veykril
...
internal: Move Expander and LowerCtx into separate modules
2023-04-17 19:00:42 +00:00
Lukas Wirth
bca8029a6e
Move Expander and LowerCtx into separate modules
2023-04-17 20:44:06 +02:00
Laurențiu Nicola
160ab88bb9
Bump bitflags
2023-04-17 18:42:59 +03:00
bors
9b54e39762
Auto merge of #14587 - Veykril:macro-def-err, r=Veykril
...
fix: Bring back LRU limit for macro_expand query
Should fix the memory increase
2023-04-16 19:30:42 +00:00
Lukas Wirth
76718ea2fc
Bring back LRU limit for macro_expand query
2023-04-16 21:30:04 +02:00
bors
924d30a772
Auto merge of #14585 - Veykril:macro-def-err, r=Veykril
...
Make `ExpandDatabase::parse_macro_expansion` and `ExpandDatabase::parse_or_expand` infallible
2023-04-16 18:50:02 +00: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
bors
697b335fda
Auto merge of #14584 - Veykril:macro-def-err, r=Veykril
...
internal: Report item-level macro expansion syntax errors
2023-04-16 17:40:20 +00: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
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
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
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
Ryo Yoshida
89a1439de3
Parse exclusive range pattern
2023-04-16 04:28:29 +09:00
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
Lukas Wirth
ce0896b78c
Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
2023-04-14 12:05:11 +02:00
bors
7afd2048f0
Auto merge of #14544 - HKalbasi:dev, r=Veykril
...
Infer types of nested RPITs
fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
2023-04-11 14:49:04 +00:00
Ryo Yoshida
0ce71dd76f
completion: check stability
2023-04-11 21:21:13 +09:00
hkalbasi
a584cb998f
Infer types of nested RPITs
2023-04-11 04:32:11 +03:30
hkalbasi
59b6f2d9f2
Compute closure captures
2023-04-10 23:04:34 +03:30
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
bca364c3fe
Auto merge of #14525 - Veykril:hir-pretty, r=Veykril
...
internal: Remove parameter names from function item tree
2023-04-07 07:57:58 +00:00
Lukas Wirth
79c4c4fb48
Remove parameter names from function item tree
2023-04-07 09:57:19 +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
f742943a4b
Don't recreate Hygiene unnecessarily
2023-04-06 21:16:11 +02:00
Lukas Wirth
b7c443569a
Don't unnecessarily query the ast_id_map for blocks if they aren't interned
2023-04-06 20:19:59 +02:00
Lukas Wirth
a1b96b1e00
Remove unnecessary Names from FunctionData::params
2023-04-06 20:14:51 +02:00
Lukas Wirth
3f5c9920d6
Move hir_def::builtin_attr to hir_def::attr::builtin
2023-04-06 19:55:49 +02:00
Lukas Wirth
12b069f434
Move hir_def::keys to hir_def::dyn_map
2023-04-06 19:49:33 +02:00
Lukas Wirth
40c068f502
Use hir_def::builtin_attr::find_builtin_attr_idx
2023-04-06 19:44:29 +02:00
Lukas Wirth
99b69525f4
hir_def::expr -> hir_def::hir, hir_def::type_ref -> hir_def::hir::type_ref
2023-04-06 19:36:25 +02:00
Lukas Wirth
8e7c104b3a
Move hir_def::adt to hir_def::data::adt
2023-04-06 19:23:29 +02:00
Lukas Wirth
0e7117900c
internal: Resolve labels in body lowering
2023-04-06 14:21:20 +02:00
bors
25124a84de
Auto merge of #14490 - Veykril:crategraph-dedup, r=Veykril
...
internal: Switch crate graph to use an Arena instead of a hashmap
2023-04-05 14:12:11 +00:00
bors
a1ca52e2a9
Auto merge of #14486 - HKalbasi:dev, r=Veykril
...
Desugar async fn completely
fix #14479
2023-04-05 13:58:38 +00:00
bors
265f83031f
Auto merge of #14433 - hecatia-elegua:alias-based-completion, r=Veykril
...
Add doc-alias based completion
Closes #14406 .
I adapted the parsing code from the CfgExpr parsing code, maybe there's a better abstraction for both, or attribute parsing in general. It also includes `doc(hidden)`-parsing, which means it could replace the other function.
There are a few tests for parsing.
`process_all_names` changed the most, I added some docs there to explain what happens.
Many call sites just pass an empy vec to `add_path_resolution`'s `doc_aliases`, since either it doesn't make sense to pass anything (e.g. visibility completion) or I don't know where to get them from. Shouldn't really matter, as it will just not show aliases if the vec is empty and we can extend alias completion in these cases later.
I added two tests in `special.rs` for struct name completion (which was the main thing I wanted). I also tried function and field names, but these don't work yet. I want to add those in a follow-up PR.
2023-04-05 13:44:51 +00:00
bors
af30656785
Auto merge of #14436 - lowr:patch/normalize-assoc-type-in-path-expr, r=HKalbasi
...
Normalize associated types in paths in expressions
Part of #14393
When we resolve paths in expressions (either path expressions or paths in struct expressions), there's a need of projection normalization, which `TyLoweringContext` cannot do on its own. We've been properly applying normalization for paths in struct expressions without type anchor, but not for others:
```rust
enum E {
S { v: i32 }
Empty,
}
impl Foo for Bar {
type Assoc = E;
fn foo() {
let _ = Self::Assoc::S { v: 42 }; // path in struct expr without type anchor; we already support this
let _ = <Self>::Assoc::S { v: 42 }; // path in struct expr with type anchor; resolves with this PR
let _ = Self::Assoc::Empty; // path expr; resolves with this PR
}
}
```
With this PR we correctly resolve the whole path, but we need some more tweaks in HIR and/or IDE layers to properly resolve a qualifier (prefix) of such paths and provide IDE features that are pointed out in #14393 to be currently broken.
2023-04-05 10:47:47 +00:00
Lukas Wirth
7f0fbf7f9d
Switch crate graph to use an Arena instead of a hashmap
2023-04-05 10:32:02 +02:00
hkalbasi
c26b12d01c
Desugar async fn completely
2023-04-04 23:07:38 +03:30
hecatia-elegua
170822b018
Add note for future me or others
2023-04-02 16:03:42 +02:00
tamasfe
25910bcde6
chore: replace TODO comment with FIXME
2023-04-01 16:31:16 +02:00
tamasfe
0b9c0c5088
feat(syntax): RTN in bounds
...
Limited syntactic support for experimental return type notations.
https://github.com/rust-lang/rust/issues/109417
2023-04-01 15:26:03 +02:00
hkalbasi
8a6ca86247
Use async block in async fn type inference
2023-04-01 04:35:28 +03:30
hecatia-elegua
c469936aac
Address review comments part 1
2023-03-30 17:35:57 +02:00
Lukas Wirth
e244942209
internal: Set Durability to HIGH for enable_proc_attr_macros input
2023-03-30 15:11:22 +02:00
bors
02ea92fecb
Auto merge of #14445 - Veykril:adt-flags, r=Veykril
...
internal: Introduce StructFlags
2023-03-30 12:34:37 +00:00
bors
fc8c5139fa
Auto merge of #14410 - Veykril:query-lru-capacities, r=Veykril
...
internal: Add config to specifiy lru capacities for all queries
Might help figuring out what queries should be limited by LRU by default, as currently we only limit `parse`, `parse_macro_expansion` and `macro_expand`.
2023-03-30 12:20:24 +00:00
Lukas Wirth
5616d91b73
internal: Add config to specifiy lru capacities for all queries
2023-03-30 12:52:28 +02:00
Lukas Wirth
33b6012827
Introduce StructFlags
2023-03-30 12:49:08 +02:00
Ryo Yoshida
8aef04f1a7
Resolve and normalize path segments one by one in variant resolution
2023-03-29 23:32:37 +09:00
hecatia-elegua
ba2b48d1b8
Fix3
2023-03-29 14:58:33 +02:00
hecatia-elegua
c351f6bf43
Fix
2023-03-29 14:27:20 +02:00
hecatia-elegua
0863389dd1
Add doc-alias based completion
2023-03-29 14:08:25 +02:00
Lukas Wirth
342fd2b9f3
fix: Properly handle local trait impls
2023-03-28 08:34:29 +02:00
Lukas Wirth
c04a13cb19
Simplify
2023-03-27 17:16:45 +02:00
bors
82ec4586f1
Auto merge of #14408 - Veykril:intern-block, r=Veykril
...
internal: Only intern blocks that declare items
We only used `BlockId` for the block defmap, so this is wasted memory. Lowering for non item declaring blocks is also cheaper now as we no longer have to fully lower a block that defines not items.
2023-03-25 19:48:04 +00:00
Lukas Wirth
675fc88afd
internal: Only intern blocks that declare items
2023-03-25 20:44:12 +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
eb4939e217
Support overloaded deref MIR lowering
2023-03-17 14:02:55 +03:30
hkalbasi
9564773d5e
Improve pattern matching MIR lowering
2023-03-17 13:08:36 +03:30
hkalbasi
b7b9ae59a0
desugar ? operator
2023-03-17 13:08:35 +03:30
Lukas Wirth
3bf07a5f04
Simplify
2023-03-15 13:54:06 +01:00
Zachary S
af175ddcdc
Add test for async closure types.
...
(rebased onto 6dfd8ae
)
2023-03-15 13:10:35 +01:00
Zachary S
6746a08b44
fix: Fix return type of async closures.
...
(rebased onto 6dfd8ae
)
2023-03-15 13:10:00 +01:00
Lukas Wirth
610a94c421
Add fundamental attributes to data
2023-03-14 20:16:41 +01:00
Lukas Wirth
f34b2469bd
lint incoherent inherent impls
2023-03-14 19:20:44 +01:00
Lukas Wirth
1a9fbf0a6d
fix: Fix visibility resolution not respecting parent blocks
2023-03-14 13:42:08 +01:00
bors
6a98e961f8
Auto merge of #14340 - Veykril:expand, r=lnicola
...
internal: Rename AstDatabase to ExpandDatabase
2023-03-14 09:37:54 +00:00
hkalbasi
d7da9e64d1
Add storage dead for let bindings without initializer
2023-03-14 12:15:16 +03:30
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
879cac4b28
minor: Remove dead code
2023-03-09 15:40:51 +01:00
Lukas Wirth
d038892947
fix: Fix block defmap not looking into tail expressions for macro calls
2023-03-08 14:37:27 +01:00
hkalbasi
af90ec8096
Partially support "overloaded deref" MIR lowering
2023-03-06 21:09:09 +03:30
hkalbasi
a25710b0c0
Add need-mut
and unused-mut
diagnostics
2023-03-06 21:09:08 +03:30
hkalbasi
61ad6a96ad
Add BindingId
2023-03-06 21:09:08 +03:30
Lukas Wirth
27fad2ad75
Lift segment check out of the loop in resolve_path_in_value_ns
2023-03-05 15:42:40 +01:00
Lukas Wirth
a51267c5e0
Allocate traits in scope upfront when type checking instead of recollecting them everytime
2023-03-05 15:04:46 +01:00
Lukas Wirth
a8606e5363
Re-use the resolver in InferenceContext instead of rebuilding it on every expression change
2023-03-05 14:37:44 +01:00
Lukas Wirth
95c4cb991f
Handle new hir block kinds in scope calculations
2023-03-04 15:22:39 +01:00