Kirill Bulatov
6dae5cbb11
Require ModPath for importing
2020-02-02 14:06:51 +02:00
Kirill Bulatov
7a2e449424
Prefer imports starting with std
2020-01-28 01:02:06 +02:00
Edwin Cheng
6ebb1edf21
Use dummy value for line! and column! macro
2020-01-15 01:47:01 +08:00
Edwin Cheng
d7be1a4372
Use attr location for builtin macro goto-imp
2020-01-12 18:08:53 +08:00
Florian Diebold
4496e2a06a
Apply review suggestions
2020-01-11 23:33:04 +01:00
Florian Diebold
12905e5b58
Some more refactoring
2020-01-11 23:33:04 +01:00
Florian Diebold
b62292e8f9
basics working
2020-01-11 23:33:04 +01:00
bors[bot]
7c1af25b22
Merge #2795
...
2795: Use dummy value for macro file in bulitin macros r=matklad a=edwin0cheng
This PR skip the actual line and column computation for `MacroFile` and return a dummy value instead.
Related to #2794
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-11 20:13:48 +00:00
Edwin Cheng
9f65ae20c2
Use dummy value for macro file in bulitin macros
2020-01-11 16:37:42 +08:00
Florian Diebold
dd6ec81d65
Add test for macro expansion in various expressions
2020-01-10 22:08:02 +01:00
Edwin Cheng
dca9195f75
Add missing expr cases for expand macro
2020-01-11 03:11:23 +08:00
Edwin Cheng
ca62d98781
Expand PAREN_EXPR as expression
2020-01-11 00:29:00 +08:00
Aleksey Kladov
4d66f5d7d2
Fix panic in tuple fields
2020-01-07 14:49:42 +01:00
Florian Diebold
2058f704cb
Add dummy implementations of env! and option_env! builtins
...
They don't do anything except return the correct type.
Also refactor the builtin macro tests a bit.
2019-12-21 13:34:43 +01:00
bors[bot]
1cbef27ff8
Merge #2625
...
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-21 06:12:36 +00:00
kjeremy
0d5d63a80e
Clippy lints
2019-12-20 15:14:30 -05:00
Edwin Cheng
ad81d1dbc1
Add support macros in impl blocks
2019-12-21 03:37:03 +08:00
bors[bot]
af5e2abe15
Merge #2614
...
2614: Clippy cleanup r=matklad a=kjeremy
Just a few tweaks from the latest clippy. There are a lot more but we should probably tweak our settings.
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 14:46:24 +00:00
kjeremy
133b4063a6
Remove useless clone
2019-12-20 09:43:01 -05:00
Edwin Cheng
dddee23f43
Add std::ops::Index support for infering
2019-12-19 12:45:07 +08:00
Edwin Cheng
2ea1cfd780
Rename range to by_kind
2019-12-18 11:36:10 +08:00
Edwin Cheng
320416d756
Add TokenTextRange
2019-12-18 11:20:22 +08:00
Edwin Cheng
59295854f8
Add token id to delims
2019-12-18 11:20:22 +08:00
Edwin Cheng
aceb9d7fb0
Add token ids for all tt::Leaf
2019-12-18 11:20:22 +08:00
bors[bot]
4a58522119
Merge #2562
...
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng
Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553
This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call
And fix the corresponding tests and make these tests easily to follow.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
Edwin Cheng
b53587c7bd
Re-export Origin to replace ExpansionOrigin
2019-12-15 01:46:39 +08:00
Edwin Cheng
61360fdfec
Fix original_source find order
2019-12-15 01:24:51 +08:00
Florian Diebold
6911bc89a7
Rename N! to name!
2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e
Add macros for known names and paths
2019-12-13 22:33:37 +01:00
bors[bot]
9c9f4635b4
Merge #2550
...
2550: Infer - and ! using std::ops::{Neg, Not} r=flodiebold a=kiljacken
Found some low hanging fruit while taking a cursory look at index inferring.
Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-13 19:49:01 +00:00
Edwin Cheng
98f98cbb54
Refactor tt::Delimiter
2019-12-13 21:53:34 +08:00
Emil Lauridsen
7705209051
Correctly infer - and ! using std::ops::{Neg,Not}
2019-12-13 12:45:38 +01:00
Aleksey Kladov
82e9b24558
Move traits to the new loc
2019-12-12 14:36:14 +01:00
Florian Diebold
5e096def15
Expand macros in blocks to expressions for now
...
Expanding to statements isn't handled properly yet and breaks things.
2019-12-08 13:03:13 +01:00
Florian Diebold
91f28e43a2
Fix expansion of format_args
2019-12-08 13:02:52 +01:00
Edwin Cheng
509fedd9d2
Remove MacroFileKind
2019-12-08 16:16:52 +08:00
Florian Diebold
b2c01f446e
Implement ancestors_with_macros in a better way
2019-12-06 21:53:31 +01:00
Florian Diebold
4a99ef5c39
Builtin macros only use caller tokens
2019-12-06 21:25:22 +01:00
Florian Diebold
a565072dde
Try to make go to definition work in format!
...
SourceAnalyzer didn't work properly within expression macro expansions because
it didn't find the enclosing function. Fix this by going up the expansion chain
to find ancestors. This makes the test work, but apparently in real usage it's
still not working.
2019-12-06 21:25:22 +01:00
Florian Diebold
eae425b10f
Implement format_args more properly
2019-12-06 21:25:22 +01:00
Florian Diebold
3a5aa03e66
Remove unnecessary len parameter for Name::new_inline_ascii
...
I assume it was previously required because `len` was not const, but that
doesn't seem to be a problem anymore.
2019-12-06 21:25:22 +01:00
Florian Diebold
c5ffb0dc81
Add stub implementation of format_args{_nl} macros
...
Just enough to fix the huge amount of type mismatches they cause.
2019-12-06 21:25:22 +01:00
Florian Diebold
10697041c1
Implement all the other built-in derives
...
Since as long as we're not implementing the bodies, they all work the same way.
2019-12-05 19:52:52 +01:00
Florian Diebold
db8a00bd99
Implement derive(Copy, Clone) properly (well, kind of)
2019-12-05 19:29:57 +01:00
Florian Diebold
18f6a995d0
Add expansion infrastructure for derive macros
2019-12-05 17:23:09 +01:00
ice1000
009437f5d9
Replace ra_hir_expand::either
with crate
2019-12-03 11:07:56 -05:00
oxalica
4992d2bf79
Infer range types
2019-11-29 03:10:16 +08:00
Aleksey Kladov
e823c578c9
Use InFile for AstId
2019-11-28 16:02:38 +03:00
Aleksey Kladov
ccd1b0800a
Rename Source -> InFile
2019-11-28 12:50:26 +03:00
Edwin Cheng
447268ceac
Hide MacroCallLoc
2019-11-27 01:33:08 +08:00