Commit Graph

878 Commits

Author SHA1 Message Date
Aleksey Kladov
0efb5364c3 sort hash maps for tests 2019-05-21 14:14:31 +03:00
bors[bot]
c59a3cdb03 Merge #1296
1296: ⬆️ insta r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-21 10:28:55 +00:00
Aleksey Kladov
507c97a18c ⬆️ insta 2019-05-21 13:21:54 +03:00
Aleksey Kladov
69341a0bbe add _query to query functions 2019-05-21 12:44:08 +03:00
Aleksey Kladov
4ca8331933 remove minor code duplication 2019-05-21 01:02:29 +03:00
Aleksey Kladov
9680ae865e simplify 2019-05-20 23:01:49 +03:00
Edwin Cheng
3fc344b9f1 Use normal iteration instead of walk_mut 2019-05-20 17:48:58 +08:00
Edwin Cheng
d4dc879415 Add infer for generic default type 2019-05-19 21:08:16 +08:00
Edwin Cheng
e74d8f148b Add default type to GenericParam 2019-05-19 17:44:29 +08:00
Aleksey Kladov
caa8663c08 allow expanding expressions 2019-05-14 09:03:43 +03:00
Aleksey Kladov
16c7405262 expand to syntax node 2019-05-14 09:03:43 +03:00
Aleksey Kladov
101b3abfd7 store macro kind in HirFileId 2019-05-14 09:03:43 +03:00
bors[bot]
bebc5c7166 Merge #1271
1271: make AstId untyped r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-13 21:04:04 +00:00
Florian Diebold
c29a692137 Increase Chalk solver max_size back to 4
Reducing it to 2 was just a failed attempt to see whether that would help fix
some slow cases; in fact, it can create new slow cases by replacing concrete
types by variables.
2019-05-13 22:20:39 +02:00
Aleksey Kladov
549728bba8 make AstId untyped 2019-05-13 19:39:06 +03:00
Aleksey Kladov
9cba67b2ad simplify 2019-05-12 23:03:37 +03:00
Aleksey Kladov
98531dc785 simplify 2019-05-12 22:51:03 +03:00
Florian Diebold
bc59f83991 Use traits from prelude for method resolution 2019-05-12 20:25:26 +02:00
Florian Diebold
7fda874dd4 Blacklist some traits from being considered in where clauses
For Send/Sync/Sized, we don't handle auto traits correctly yet and because they
have a lot of impls, they can easily lead to slowdowns. In the case of
Fn/FnMut/FnOnce, we don't parse the special Fn notation correctly yet and don't
handle closures yet, so we are very unlikely to find an impl.
2019-05-12 20:23:57 +02:00
Florian Diebold
c8b85891b0 Fix impl blocks with unresolved target trait being treated as inherent impls 2019-05-12 20:21:45 +02:00
Florian Diebold
cbe75676b9 Add support for inline bounds
E.g. impl<T: Clone> Foo for T.
2019-05-11 16:56:36 +02:00
Florian Diebold
d6dc75f9f2 Handle auto traits & negative impls
We don't pass field types to Chalk yet though, so the auto trait inference won't
be correct.
2019-05-11 16:21:20 +02:00
Florian Diebold
7744cd41e2 Reduce Chalk max_size parameter, add test for slow case 2019-05-11 16:21:20 +02:00
Florian Diebold
d8cd0e36f5 Handle Chalk conversion for FnDef 2019-05-11 16:21:20 +02:00
Florian Diebold
58b68966bf Handle resolution errors in where clauses
This is slightly hacky, but maybe more elegant than alternative solutions: We
just use a hardcoded Chalk trait ID which we special-case to have no impls.
2019-05-11 16:21:20 +02:00
Florian Diebold
50bbf9eb09 Handle where clauses in trait solving 2019-05-11 16:21:20 +02:00
Florian Diebold
530b3047ed Deduplicate impls in impls_for_trait
This was duplicating impls in dependencies a lot...
2019-05-07 13:45:29 +02:00
Florian Diebold
4083caa233 Add a HirDisplay implementation for TraitRef 2019-05-07 13:45:29 +02:00
Florian Diebold
a78228a39c Turn implements into a query again 2019-05-07 13:45:29 +02:00
Sergey Parilin
26ed925685 fill struct fields diagnostic 2019-05-06 17:16:11 +03:00
bors[bot]
aa7bdfd37f Merge #1208
1208: [WIP] Goto for Macro's r=matklad a=Lapz

Adds goto definition for macros. Currently only works for macros in the current crate ~~otherwise it panics~~. Proper macro resolution needs to be added for it to resolve macros in other crates.

Todo
- [X] Allow goto from macro calls
- [X] Fix panics
- [x] Add tests



![Screen Recording 2019-04-25 at 18 00 24](https://user-images.githubusercontent.com/19998186/56754499-1dd01c00-6785-11e9-9e9a-1e36de70cfa3.gif)



Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-05-04 18:38:10 +00:00
Florian Diebold
a4eb1a546c Differentiate Tuple / FnPtr type constructors by cardinality
This is necessary because Chalk (reasonably) expects each 'struct' to know how
many type parameters it takes.
2019-05-04 19:11:21 +02:00
Florian Diebold
19fbd91998 Simplify subst / subst_bound_vars a bit 2019-05-04 18:41:48 +02:00
Lenard Pratt
8198e13c26 Added local macro goto 2019-05-04 17:39:51 +01:00
Florian Diebold
f43e69a64e Handle recursive types in canonicalization 2019-05-04 18:25:36 +02:00
Florian Diebold
5795d773db Remove ToChalk implementation for ApplicationTy 2019-05-04 18:18:30 +02:00
Florian Diebold
621864319f Make canonicalization API a bit nicer 2019-05-04 18:18:30 +02:00
Florian Diebold
0bcf47b22b Update Chalk 2019-05-04 18:18:30 +02:00
Florian Diebold
0f34568924 Turn eprintln!s into debug!s 2019-05-04 18:18:30 +02:00
Florian Diebold
7310f3f801 Handle Ty::Unknown in Chalk conversion
Badly, but at least it doesn't crash.
2019-05-04 18:18:30 +02:00
Florian Diebold
0ad7317b24 Canonicalize before doing method resolution 2019-05-04 18:18:30 +02:00
Florian Diebold
ef77d83751 Document the peculiarity of the solver query a bit
Also remove the only remaining mention of chalk outside of the ty::traits
module.
2019-05-04 18:18:30 +02:00
Florian Diebold
c8a643f090 Move Chalk conversion code to its own module 2019-05-04 18:18:30 +02:00
Florian Diebold
99492278ac Implement Deref<Target=[Ty]> for Substs 2019-05-04 18:18:30 +02:00
Florian Diebold
6c3ee834d6 Simplify solution_from_chalk 2019-05-04 18:18:30 +02:00
Florian Diebold
b9c0c2abb7 Chalk integration
- add proper canonicalization logic
 - add conversions from/to Chalk IR
2019-05-04 18:18:30 +02:00
Florian Diebold
6269791d36 Add Ty::Bound variant for use in Chalk integration 2019-05-04 18:18:30 +02:00
Aleksey Kladov
bcf45371ff make macro expansion into a proper query 2019-05-04 18:01:43 +03:00
Aleksey Kladov
87a1e276d5 minor, move 2019-05-04 17:42:24 +03:00
Aleksey Kladov
5dc384132f introduce macro_arg intermediate query
Currently, when expanding macros, we look at the source code
directly (we invoke ast_id_to_node query via to_node method).

This is less then ideal, because it make us re-expand macros after
every source change.

This commit establishes a salsa-firewall: a query to get macro call's
token tree. Unlike the syntax tree, token tree changes only if we
actually modify the macro itself.
2019-05-04 17:38:09 +03:00
Aleksey Kladov
8876f44054 Revert "eagarly clean astd maps"
This reverts commit 6c63a59425.

This causes massive slowdowns: looks like we accidentally have some source-depndent
2019-05-04 16:04:34 +03:00
Aleksey Kladov
6c63a59425 eagarly clean astd maps 2019-05-04 11:53:44 +03:00
Aleksey Kladov
594aac059e Use correct FileId when expanding macros in expressions 2019-05-01 15:53:13 +03:00
Felix S. Klock II
d694b0174a Sidestep two-phase borrow violation signaled by mutable_borrow_reservation_conflict.
See rust-lang/rust#59159 for further information/discussion.
2019-04-29 14:03:51 +02:00
Edwin Cheng
dfab545d5d Add more information on macro rules fail to parse 2019-04-26 02:03:55 +08:00
Aleksey Kladov
848cb16a01 drop empty file 2019-04-25 10:07:23 +03:00
Lenard Pratt
1ab7066e32 Introduced resolve_macro_call on resolver
changed to manual expansion

fix for nested macros
2019-04-23 10:17:31 +01:00
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