Lenard Pratt
ce211434a6
Added macro resolution and expansion
2019-04-22 21:35:44 +01:00
Lenard Pratt
afaeb18910
Addeded resolver and db
2019-04-22 21:33:48 +01:00
bors[bot]
c416caeda2
Merge #1194
...
1194: Pr 1190 r=matklad a=matklad
Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-22 13:19:47 +00:00
Aleksey Kladov
aa1ef6ae9a
unused import
2019-04-22 16:18:14 +03:00
Aleksey Kladov
e01052d1f0
move auto-imoprter into IDE
...
auto-import is purely an IDE concern, so it should be done outside of
HIR
2019-04-22 15:56:28 +03:00
Edwin Cheng
d6d9aa2003
Change macro stack monitor test to func ptr based
2019-04-22 17:15:22 +08:00
Edwin Cheng
b177813f3b
Add mbe expand limit and poision macro set
2019-04-22 15:33:55 +08:00
Andrea Pretto
200032852b
complete_import: prevent panic when the anchor is the completion source range
...
(fix rebase mess)
Please enter the commit message for your changes. Lines starting
2019-04-22 00:48:43 +02:00
Andrea Pretto
9144214958
complete_import: add new import resolver infrastructure with some hardcoded importable name.
...
Changes complete_scope to support that.
2019-04-22 00:14:58 +02:00
Andrea Pretto
766813898f
auto_import: make auto import working with target as a list of SmolStr instead of ast::Path
2019-04-22 00:13:00 +02:00
Edwin Cheng
9a5b9638c1
Add more information on parse_macro fail
2019-04-22 05:04:37 +08:00
Florian Diebold
787fb3e5ec
Add HIR for where clauses & ignore impls with where clauses in trait resolution
...
This prevents any `impl<T> Trait for T where ...` from being treated as a
blanket impl while we don't handle where clauses yet.
2019-04-21 15:01:17 +02:00
bors[bot]
fa15c4d75e
Merge #1175
...
1175: Fix bugs and add error log about macro expansion r=matklad a=edwin0cheng
This PR fixed / add following things:
* Add a fused count which stop recursion of macro expansion in name resolution.
* Add some logs when macro expansion fails
* Add `$crate` meta variable support in mbe, which create a `$crate` ident token in token tree.
* Fixed matching a `$REPEAT` pattern inside a subtree, e.g. `(fn $name:ident {$($i:ident)*} ) => {...}`
* Remove composite-able punct token in syntax node to token conversion.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-21 10:34:07 +00:00
Florian Diebold
82751f8a4a
Add a simple test for str method completion
2019-04-20 18:26:53 +02:00
Edwin Cheng
9e35bf91b8
Fix bugs
2019-04-20 23:53:39 +08:00
Marco Groppo
8ac3d1f9aa
lang_item_lookup is now a salsa query.
2019-04-20 00:29:16 +02:00
Marco Groppo
8ebb20edce
New krate() method in Resolver.
...
Renamed Impl to ImplBlock.
2019-04-20 00:20:26 +02:00
Marco Groppo
e85ee60c42
Initial support for lang items.
2019-04-20 00:10:19 +02:00
Edwin Cheng
8747c903a2
Refactoring
2019-04-17 09:35:03 +08:00
Edwin Cheng
039ab2e820
Simpliy code
2019-04-17 09:31:53 +08:00
Edwin Cheng
0edb5ce97a
Bug fix and add more comments
2019-04-17 09:31:52 +08:00
Edwin Cheng
180655077a
Fix 1099
2019-04-17 09:31:52 +08:00
Florian Diebold
4f8a49f43c
Refactor method candidate generation a bit
...
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
Florian Diebold
8bcbcc454c
Extract generic_params method to a HasGenericParams trait
2019-04-14 13:07:45 +02:00
Florian Diebold
4497e1d3ea
Add Container enum to handle both kinds of container (impl/trait)
2019-04-14 11:28:53 +02:00
Florian Diebold
7650a44640
Make callable signature handling a bit nicer
2019-04-14 11:28:53 +02:00
Florian Diebold
9339241b78
Some cleanup
2019-04-14 11:28:53 +02:00
Florian Diebold
a1ed53a4f1
More trait infrastructure
...
- make it possible to get parent trait from method
- add 'obligation' machinery for checking that a type implements a
trait (and inferring facts about type variables from that)
- handle type parameters of traits (to a certain degree)
- improve the hacky implements check to cover enough cases to exercise the
handling of traits with type parameters
- basic canonicalization (will probably also be done by Chalk)
2019-04-14 11:28:53 +02:00
Florian Diebold
413c87f155
Get substs for trait refs in impl blocks
2019-04-14 11:28:53 +02:00
Robin Freyler
6aae0cf7fa
replace usages of algo::generate
with iter::successors
from std
2019-04-13 16:43:49 +02:00
Aleksey Kladov
2facb5e061
cleanups
2019-04-13 14:16:46 +03:00
Aleksey Kladov
b260641e0c
slight encapsulation
2019-04-13 11:29:47 +03:00
Aleksey Kladov
f9e825d956
move ScopeEntryWithSyntax
2019-04-13 11:24:09 +03:00
Aleksey Kladov
d387bdccba
drop obsolete fixme
2019-04-13 11:21:32 +03:00
Aleksey Kladov
4f8dc1b9f0
make expr scope stuff private
2019-04-13 11:06:53 +03:00
Aleksey Kladov
a2cc76ce63
make resolver private
2019-04-13 11:03:02 +03:00
Aleksey Kladov
62d01dd4df
hide resolver
2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc
fold ScopeWithSyntax into SourceAnalyzer
2019-04-13 10:49:01 +03:00
Aleksey Kladov
30481808fb
make stuff private
2019-04-13 09:53:02 +03:00
Aleksey Kladov
1e8569dce9
make private
2019-04-13 09:46:39 +03:00
Aleksey Kladov
d4043a8dba
only def-with-body remains
2019-04-13 09:45:52 +03:00
Aleksey Kladov
d88269bc2d
generalize
2019-04-13 09:38:37 +03:00
Aleksey Kladov
17a0e22883
simplify
2019-04-13 09:36:28 +03:00
Aleksey Kladov
65b0073653
simplify
2019-04-13 09:33:34 +03:00
Aleksey Kladov
9ead801a9c
make private
2019-04-13 09:32:25 +03:00
Aleksey Kladov
3aae223d93
hide some scopes
2019-04-13 09:31:03 +03:00
Aleksey Kladov
58fe5598e7
simplify
2019-04-13 01:32:43 +03:00
Aleksey Kladov
b0d8f9ff5d
make stuff private
2019-04-13 01:07:24 +03:00
Aleksey Kladov
81e91980dd
simplify
2019-04-13 01:05:18 +03:00
Aleksey Kladov
7c13e22334
simplify tests
2019-04-13 00:56:57 +03:00
Aleksey Kladov
0fd93bc14a
use really correct resolver for expressions
2019-04-13 00:44:47 +03:00
Aleksey Kladov
cf2ba2791d
add todo
2019-04-11 17:14:41 +03:00
Aleksey Kladov
a347208bb2
use correct resolver for expressions
2019-04-11 16:51:30 +03:00
Aleksey Kladov
ebb0c377f0
remove resolver from CompletonContext
2019-04-11 16:49:35 +03:00
Aleksey Kladov
3c9f2d0e37
simplify
2019-04-11 16:39:56 +03:00
Aleksey Kladov
5471c1ef4b
generalize SourceAnalyzer to handle all defs with bodies
2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f
minimize the API
2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695
rename
2019-04-11 16:29:33 +03:00
Aleksey Kladov
505acc973b
Make call info to use real name resolution
2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7
introduce SourceAnalyzer
2019-04-11 16:29:33 +03:00
Aleksey Kladov
6a8b3c1d4b
fix typo
2019-04-11 11:13:31 +03:00
Aleksey Kladov
10726fdb65
type-safer source-map for bindings
2019-04-10 10:48:15 +03:00
Aleksey Kladov
1cd184d653
use either for uses
2019-04-10 10:12:54 +03:00
Aleksey Kladov
6b993a9760
migrate to salsas interning
2019-04-09 22:51:22 +03:00
Laurențiu Nicola
61c09edb4a
Avoid two-phase borrow conflict
2019-04-08 16:47:28 +03:00
Lenard Pratt
b27fa33a9f
updated snapshots
2019-04-07 13:23:18 +01:00
Lenard Pratt
e175921932
Added ArrayExprKind,
...
changed the display for fixed array types,
Added Array Enum to ra_hir/expr
2019-04-07 13:23:14 +01:00
Lenard Pratt
2d73c909fe
Added inference of array length
2019-04-07 13:23:12 +01:00
robojumper
ca40ca93a5
Parse and infer tuple indices
2019-04-06 01:07:35 +02:00
bors[bot]
c6c88070c4
Merge #1068
...
1068: profiling crate first draft r=matklad a=pasa
I've made this first draft for #961
Could you look at it? Is this something what you are looking for?
It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues?
Additionally I'm thinking about to implement procedural macros to annotate methods with this profiler. Will it be helpful?
Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 09:09:11 +00:00
bors[bot]
fdbebccd71
Merge #1076
...
1076: Const body inference r=flodiebold a=Lapz
This is the second part of #887 . I've added type inference on const bodies and introduced the DefWithBody containing Function, Const and Static. I want to add tests but im unsure on how I would go about testing that completions work.
Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-02 19:01:54 +00:00
Lenard Pratt
b9d2c2c21f
made ExprCollector pub(crate) and moved
...
collect_fn_body_syntax
2019-04-02 19:22:06 +01:00
Lenard Pratt
88e22e9d70
Added const bodies and static body to the ast
...
and added inference the inference test
reduce code duplication
2019-04-02 19:21:36 +01:00
Aleksey Kladov
0de89f786f
always produce source for import
2019-04-02 17:58:04 +03:00
Sergey Parilin
b74449e995
Merge remote-tracking branch 'upstream/master' into issue961_profiling
2019-04-02 17:55:14 +03:00
Sergey Parilin
9b73f80959
PR issuse resolved
2019-04-02 17:52:04 +03:00
Aleksey Kladov
49f13d3a9b
fix a panic with glob-import missing a source map
2019-04-02 13:26:09 +03:00
Aleksey Kladov
0e1e40676a
rename flavor to kind
2019-04-02 12:53:44 +03:00
Aleksey Kladov
f3a82c372c
remove flavor
2019-04-02 12:25:24 +03:00
gfreezy
4ca51cfbcf
intelligently add parens when inlining local varaibles
2019-04-01 22:53:47 +08:00
Aleksey Kladov
9e213385c9
switch to new rowan
2019-04-01 12:06:24 +03:00
Lenard Pratt
7f3bf7cc73
Added defWithBody
2019-03-30 10:50:00 +00:00
Aleksey Kladov
a3fee2bda0
more realistic test for incrementality
2019-03-26 19:54:52 +03:00
Aleksey Kladov
1325a31e34
reduce visibility
2019-03-26 19:15:39 +03:00
Aleksey Kladov
e28db444df
rename
2019-03-26 19:11:01 +03:00
Aleksey Kladov
b17217b34a
simplify
2019-03-26 18:57:57 +03:00
Aleksey Kladov
cffa3f960e
make stuff private
2019-03-26 18:47:52 +03:00
Aleksey Kladov
8f32477312
more type safety
2019-03-26 18:27:22 +03:00
Aleksey Kladov
071a19537d
strongy-typed ids for macros
2019-03-26 18:03:17 +03:00
Aleksey Kladov
fb8b354dcc
add typed ids
2019-03-26 17:25:14 +03:00
Aleksey Kladov
6e5562224e
remove some dead code
2019-03-26 16:47:52 +03:00
Aleksey Kladov
f6f2d69bb8
simplify
2019-03-26 14:54:05 +03:00
Aleksey Kladov
0b820cacab
move source_id to a separate file
2019-03-26 14:42:28 +03:00
Aleksey Kladov
e231277ab2
make macro parsing a query
2019-03-26 14:13:17 +03:00
Aleksey Kladov
e4646ce0d5
reduce visibility
2019-03-26 13:53:50 +03:00
Aleksey Kladov
5270bca5f7
store macro def inside macro id
...
This solves the problem of "macro expansion can't call into name
resolution, because name resolution calls back into macro expansion"
Because we store macro def as a part of call id, macro expansion just
knows the def!
2019-03-26 13:20:54 +03:00
Florian Diebold
99711c1863
Clean up comments / use nicer Iterator methods
2019-03-25 21:28:36 +01:00
Florian Diebold
0f7e4a7d24
Implement a very naive implements check
...
... to make the infer_trait_method_simple test have the correct result.
2019-03-25 21:28:36 +01:00
Florian Diebold
c947c15ce1
Basics for trait method resolution
2019-03-25 21:28:36 +01:00
Aleksey Kladov
309716cffe
move tests to where they belong
2019-03-25 14:29:24 +03:00
Aleksey Kladov
5ce84f3cbc
tweak diagnostics API
2019-03-25 10:52:50 +03:00
Aleksey Kladov
4c4a714328
test diagnostics
2019-03-25 10:52:50 +03:00
Aleksey Kladov
c7ffd939f6
more enterprisey diagnostics setup
2019-03-25 10:52:50 +03:00
Aleksey Kladov
7ee2887d1e
fixes
2019-03-25 10:52:50 +03:00
Aleksey Kladov
45fbab2b1a
check impls as well
2019-03-25 10:52:50 +03:00
Aleksey Kladov
79df62bc74
cleanup
2019-03-25 10:52:50 +03:00
Aleksey Kladov
3fb88e95aa
switch modules to new diagnostics
2019-03-25 10:52:50 +03:00
Aleksey Kladov
fcca35969d
allow dyn diagnostics
2019-03-25 10:52:12 +03:00
Aleksey Kladov
7e8f17188e
diagnostics
2019-03-25 10:52:12 +03:00
Marco Groppo
67055c47da
Target only the actual operator.
...
Renamed `BinExpr::op()` and `PrefixExpr::op()` to `op_kind`.
Now `op()` returns the `SyntaxNode`.
2019-03-24 22:21:22 +01:00
Florian Diebold
dbfc68cea0
Fix apply_substs assertion failure
...
Fixes #1030 .
2019-03-23 18:03:09 +01:00
Aleksey Kladov
46a21b07e6
remove obsolete diagnostic
2019-03-23 16:31:11 +03:00
Aleksey Kladov
3f0cf6ebe1
rename persistent hir database -> def database
2019-03-23 15:44:24 +03:00
Aleksey Kladov
4fd8cfd6ad
replace todo with fixme
2019-03-23 11:07:09 +03:00
yanchith
504c8c7c2e
Refactor primitive types into more orthogonal representation
2019-03-22 10:09:35 +01:00
Florian Diebold
1ee779d1f7
Assert in apply_substs that the number of parameters doesn't change
...
... and fix a small bug revealed by that.
2019-03-21 22:39:31 +01:00
Florian Diebold
cbb418ebb8
Rename name field to ctor as well
2019-03-21 22:29:12 +01:00
Florian Diebold
97be0e6c46
Some more doc comments
2019-03-21 22:23:52 +01:00
Florian Diebold
f10f5a81b3
TypeName => TypeCtor
2019-03-21 22:20:03 +01:00
Florian Diebold
8a5fbf4713
Remove the old variants replaced by Ty::Apply
2019-03-21 22:17:00 +01:00
Florian Diebold
7a8ba53542
Add Ty::Apply
2019-03-21 22:11:53 +01:00
Florian Diebold
bc7752e527
Represent FnPtr and Tuple using Substs
2019-03-21 22:11:53 +01:00
Aleksey Kladov
f5165af9a7
make Name::new private
2019-03-20 22:33:26 +03:00
Vincent Esche
21f20d5deb
Fixed typo in Interner
’s name (Intener
)
2019-03-20 09:29:10 +01:00
Aleksey Kladov
5641feeddb
import resolution is immutable
2019-03-19 18:35:03 +03:00
bors[bot]
40c6dd1f4c
Merge #982
...
982: Implement BindingMode for pattern matching. r=flodiebold a=mjkillough
Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.
Fixes #888 .
- [Binding modes in The Reference](https://doc.rust-lang.org/reference/patterns.html#binding-modes )
- [`rustc` implementation](e17c48e2f2/src/librustc_typeck/check/_match.rs (L77)
) (and [definition of `BindingMode`](e957ed9d10/src/librustc/ty/binding.rs
))
- [Match Ergonomics RFC](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md#binding-mode-rules )
Co-authored-by: Michael Killough <michaeljkillough@gmail.com>
2019-03-17 21:41:37 +00:00
Michael Killough
6299ccd350
Split test case and use tested_by!.
2019-03-17 19:08:51 +00:00
Michael Killough
33add0ee30
Simplify match statement.
2019-03-17 18:50:22 +00:00
Michael Killough
354134ffb4
impl Default for BindingMode.
...
This decouples callers from knowing what the default binding mode of
pattern matching is.
2019-03-17 18:46:01 +00:00
Aleksey Kladov
3a77023365
docs
2019-03-17 12:53:22 +03:00
Aleksey Kladov
4d7fa6d30b
remove fixme
2019-03-17 12:53:22 +03:00
Aleksey Kladov
6955e392f8
remove old macro support
2019-03-17 12:53:22 +03:00
Aleksey Kladov
ee3cf6172b
rename ModuleId -> CrateModuleId
2019-03-17 12:53:22 +03:00
Aleksey Kladov
c51a6a7bdd
fix error on wrong path
2019-03-17 12:53:22 +03:00
Aleksey Kladov
0d6b8baa89
log time
2019-03-17 12:53:22 +03:00
Aleksey Kladov
967a4b64af
Reorganize name resolution
2019-03-17 12:53:22 +03:00
Aleksey Kladov
b2a6c17362
remove lower module
2019-03-17 12:52:52 +03:00
Aleksey Kladov
c7259a899c
remove ItemMap
2019-03-17 12:52:05 +03:00
Aleksey Kladov
71e5adf694
move tests over to crate-def-map
2019-03-17 12:49:07 +03:00
Aleksey Kladov
2195d1db6d
Replace module_tree with CrateDefMap
2019-03-17 12:49:07 +03:00
Aleksey Kladov
182c05a96c
add name resolution from the old impl
...
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Aleksey Kladov
0d8d918656
add skeleton for macro-aware name resolutions
2019-03-17 12:46:13 +03:00
Michael Killough
b42c5ced68
Implement BindingMode for pattern matching.
...
Implement `BindingMode` for pattern matching, so that types can be
correctly inferred using match ergonomics. The binding mode defaults to
`Move` (referred to as 'BindingMode::BindByValue` in rustc), and is
updated by automatic dereferencing of the value being matched.
2019-03-16 18:13:13 +00:00
Florian Diebold
7faae12311
Remove FnSig from FnDef type
...
It doesn't need to be in there since it's just information from the def. Another
step towards aligning Ty with Chalk's representation.
2019-03-16 17:29:55 +01:00
Florian Diebold
a9ddaba905
Refactor FnSig a bit
2019-03-16 17:21:32 +01:00
Florian Diebold
628b530e92
Some more Ty displaying cleanup
2019-03-16 16:50:31 +01:00
Florian Diebold
c5ee60e05b
Replace Display by a pretty printing trait for Ty
...
This allows removing the names from Adt and FnDef (and more later), as a first
step towards aligning more with chalk's Ty :)
2019-03-16 16:36:59 +01:00
pcpthm
adad641c52
derive Hash for ra_hir::ModuleDef
2019-03-14 17:25:51 +09:00
Aleksey Kladov
e9e792f2d7
remove Def
2019-03-12 12:36:37 +03:00
Ville Penttinen
4a0bb3d7c5
Add support for goto definition and hover on Self
...
This fixes #943
2019-03-07 17:34:44 +02:00