]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMerge #2641
bors[bot] [Sun, 22 Dec 2019 07:56:33 +0000 (07:56 +0000)]
Merge #2641

2641: Parse const generics r=matklad a=roblabla

Adds very primitive support for parsing const generics (`const IDENT: TY`) so that rust-analyzer stops complaining about the syntax being invalid.

Fixes #1574
Fixes #2281

Co-authored-by: roblabla <unfiltered@roblab.la>
4 years agoParse const generics
roblabla [Sun, 22 Dec 2019 00:38:23 +0000 (00:38 +0000)]
Parse const generics

Fixes #1574
Fixes #2281

4 years agoMerge #2640
bors[bot] [Sat, 21 Dec 2019 20:53:34 +0000 (20:53 +0000)]
Merge #2640

2640: Add some module docs r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoAdd some module docs
Jeremy Kolb [Sat, 21 Dec 2019 20:27:38 +0000 (15:27 -0500)]
Add some module docs

4 years agoMerge #2638
bors[bot] [Sat, 21 Dec 2019 18:44:51 +0000 (18:44 +0000)]
Merge #2638

2638: More profiling r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMore profiling
Aleksey Kladov [Sat, 21 Dec 2019 18:40:20 +0000 (19:40 +0100)]
More profiling

4 years agoMerge #2637
bors[bot] [Sat, 21 Dec 2019 17:46:52 +0000 (17:46 +0000)]
Merge #2637

2637: Optimize and profile r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoOptimize and profile
Aleksey Kladov [Sat, 21 Dec 2019 17:45:46 +0000 (18:45 +0100)]
Optimize and profile

4 years agoMerge #2635
bors[bot] [Sat, 21 Dec 2019 16:35:21 +0000 (16:35 +0000)]
Merge #2635

2635: Remove import source map r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMove LocalImportId
Aleksey Kladov [Sat, 21 Dec 2019 16:34:28 +0000 (17:34 +0100)]
Move LocalImportId

4 years agoRemove import source map
Aleksey Kladov [Sat, 21 Dec 2019 16:26:05 +0000 (17:26 +0100)]
Remove import source map

4 years agoRemove import from resolution
Aleksey Kladov [Sat, 21 Dec 2019 16:22:48 +0000 (17:22 +0100)]
Remove import from resolution

4 years agoMerge #2634
bors[bot] [Sat, 21 Dec 2019 15:56:04 +0000 (15:56 +0000)]
Merge #2634

2634: Update crates r=matklad a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoUpdate crates
Jeremy Kolb [Sat, 21 Dec 2019 15:44:02 +0000 (10:44 -0500)]
Update crates

4 years agoMerge #2633
bors[bot] [Sat, 21 Dec 2019 14:25:15 +0000 (14:25 +0000)]
Merge #2633

2633: Remove imports from hir r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove imports from hir
Aleksey Kladov [Sat, 21 Dec 2019 14:17:10 +0000 (15:17 +0100)]
Remove imports from hir

4 years agoMerge #2632
bors[bot] [Sat, 21 Dec 2019 14:08:10 +0000 (14:08 +0000)]
Merge #2632

2632: Revert "Merge #2629" r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRevert "Merge #2629"
Aleksey Kladov [Sat, 21 Dec 2019 14:04:33 +0000 (15:04 +0100)]
Revert "Merge #2629"

This reverts commit cdc9d682b066b110e0a44e5f8f1c574b38c16ba9, reversing
changes made to 90ef070db3dce0a7acb9cd11d0b0d72de13c9d79.

4 years agoMerge #2630
bors[bot] [Sat, 21 Dec 2019 12:37:41 +0000 (12:37 +0000)]
Merge #2630

2630: Add dummy implementations of env! and option_env! builtins r=matklad a=flodiebold

They don't do anything except return the correct type.

Also refactor the builtin macro tests a bit.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
4 years agoAdd dummy implementations of env! and option_env! builtins
Florian Diebold [Sat, 21 Dec 2019 12:33:44 +0000 (13:33 +0100)]
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.

4 years agoMerge #2629
bors[bot] [Sat, 21 Dec 2019 11:48:12 +0000 (11:48 +0000)]
Merge #2629

2629: Remove imports from hir r=matklad a=matklad

We only used them to avoid self-confirming completions (`use self::foo`), but that can be handled more locally.

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoPrivatize LocalImportID
Aleksey Kladov [Sat, 21 Dec 2019 11:47:34 +0000 (12:47 +0100)]
Privatize LocalImportID

4 years agoRemove import source map
Aleksey Kladov [Sat, 21 Dec 2019 11:44:28 +0000 (12:44 +0100)]
Remove import source map

4 years agoDon't track imports
Aleksey Kladov [Sat, 21 Dec 2019 11:38:40 +0000 (12:38 +0100)]
Don't track imports

4 years agoRemove hir for imports
Aleksey Kladov [Sat, 21 Dec 2019 11:15:56 +0000 (12:15 +0100)]
Remove hir for imports

4 years agoMerge #2628
bors[bot] [Sat, 21 Dec 2019 10:47:47 +0000 (10:47 +0000)]
Merge #2628

2628: Add macro 2.0 support in parser r=matklad a=edwin0cheng

This PR added a new syntax kind : `MACRO_DEF` and a keyword `MACRO_KW`

there are two syntax for declarative macro 2.0 :
1. Normal : `macro m { ($i:ident) => {} }` , which handle similar to legacy one.
2. Call like: `macro m($i:ident) {}`, it produces a single token tree which have two child token trees : `($i:ident)` and `{}`

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoAdd macro keyword to ITEM_RECOVERY_SET
Edwin Cheng [Sat, 21 Dec 2019 10:42:17 +0000 (18:42 +0800)]
Add macro keyword to  ITEM_RECOVERY_SET

4 years agoAdd macro 2.0 support in parser
Edwin Cheng [Sat, 21 Dec 2019 10:29:14 +0000 (18:29 +0800)]
Add macro 2.0 support in parser

4 years agoMerge #2626
bors[bot] [Sat, 21 Dec 2019 10:12:18 +0000 (10:12 +0000)]
Merge #2626

2626: Recursive collect macros in impl items r=matklad a=edwin0cheng

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoMerge #2627
bors[bot] [Sat, 21 Dec 2019 10:01:42 +0000 (10:01 +0000)]
Merge #2627

2627: Use SelectionRange from LSP 3.15 r=matklad a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoMerge #2625
bors[bot] [Sat, 21 Dec 2019 06:12:36 +0000 (06:12 +0000)]
Merge #2625

2625: Clippy lints r=matklad a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoUse SelectionRange from LSP 3.15
Jeremy Kolb [Fri, 20 Dec 2019 23:57:31 +0000 (18:57 -0500)]
Use SelectionRange from LSP 3.15

4 years agoAdd a limit for protect against infinite recursion
Edwin Cheng [Fri, 20 Dec 2019 21:16:29 +0000 (05:16 +0800)]
Add a limit for protect against infinite recursion

4 years agoRecursive collect macros in impl items
Edwin Cheng [Fri, 20 Dec 2019 21:02:31 +0000 (05:02 +0800)]
Recursive collect macros in impl items

4 years agoClippy lints
kjeremy [Fri, 20 Dec 2019 20:14:30 +0000 (15:14 -0500)]
Clippy lints

4 years agoMerge #2624
bors[bot] [Fri, 20 Dec 2019 19:51:03 +0000 (19:51 +0000)]
Merge #2624

2624: Separate module item from module scope r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #2623
bors[bot] [Fri, 20 Dec 2019 19:42:46 +0000 (19:42 +0000)]
Merge #2623

2623: Add support macros in impl blocks r=matklad a=edwin0cheng

This PR add support for macros in impl blocks, which reuse `Expander` for macro expansion.

see also: #2459

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoAdd support macros in impl blocks
Edwin Cheng [Fri, 20 Dec 2019 19:37:03 +0000 (03:37 +0800)]
Add support macros in impl blocks

4 years agoMerge #2622
bors[bot] [Fri, 20 Dec 2019 19:17:28 +0000 (19:17 +0000)]
Merge #2622

2622: Simplify r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSimplify
Aleksey Kladov [Fri, 20 Dec 2019 19:15:54 +0000 (20:15 +0100)]
Simplify

4 years agoMerge #2620
bors[bot] [Fri, 20 Dec 2019 19:09:02 +0000 (19:09 +0000)]
Merge #2620

2620: Update packages r=matklad a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoProtect against null as revealed by `npm test`
kjeremy [Fri, 20 Dec 2019 18:52:34 +0000 (13:52 -0500)]
Protect against null as revealed by `npm test`

4 years agoUpdate to latest packages
kjeremy [Fri, 20 Dec 2019 18:52:11 +0000 (13:52 -0500)]
Update to latest packages

4 years agoMerge #2617
bors[bot] [Fri, 20 Dec 2019 18:16:16 +0000 (18:16 +0000)]
Merge #2617

2617: Remove index resolving from hover r=matklad a=kjeremy

I have left in `HoverResult`'s support for multiple entries because we may still want that at some point.

Per https://github.com/rust-analyzer/rust-analyzer/issues/2542#issuecomment-565238142

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoMerge #2619
bors[bot] [Fri, 20 Dec 2019 17:58:59 +0000 (17:58 +0000)]
Merge #2619

2619: Coerce closures to fn pointers r=flodiebold a=flodiebold

E.g. `let x: fn(A) -> B = |x| { y };`

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoCoerce closures to fn pointers
Florian Diebold [Fri, 20 Dec 2019 17:53:40 +0000 (18:53 +0100)]
Coerce closures to fn pointers

E.g. `let x: fn(A) -> B = |x| { y };`

4 years agoMerge #2618
bors[bot] [Fri, 20 Dec 2019 17:29:11 +0000 (17:29 +0000)]
Merge #2618

2618: Fix coercion of last expression in function body r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoFix coercion of last expression in function body
Florian Diebold [Fri, 20 Dec 2019 17:27:51 +0000 (18:27 +0100)]
Fix coercion of last expression in function body

4 years agoMerge #2616
bors[bot] [Fri, 20 Dec 2019 17:18:52 +0000 (17:18 +0000)]
Merge #2616

2616: Handle closure return types r=flodiebold a=flodiebold

Fixes #2547.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoHandle closure return types
Florian Diebold [Fri, 20 Dec 2019 15:41:32 +0000 (16:41 +0100)]
Handle closure return types

Fixes #2547.

4 years agoRemove unused imports
kjeremy [Fri, 20 Dec 2019 16:18:24 +0000 (11:18 -0500)]
Remove unused imports

4 years agoRemove the index resolution from hover
kjeremy [Fri, 20 Dec 2019 16:12:31 +0000 (11:12 -0500)]
Remove the index resolution from hover

We are reasonably precise now to do this.

4 years agoMake legacy macros private
Aleksey Kladov [Fri, 20 Dec 2019 16:09:13 +0000 (17:09 +0100)]
Make legacy macros private

4 years agoPrivitize impls
Aleksey Kladov [Fri, 20 Dec 2019 15:55:38 +0000 (16:55 +0100)]
Privitize impls

4 years agoMake items private
Aleksey Kladov [Fri, 20 Dec 2019 15:47:22 +0000 (16:47 +0100)]
Make items private

4 years agoMove some code to scope
Aleksey Kladov [Fri, 20 Dec 2019 15:26:49 +0000 (16:26 +0100)]
Move some code to scope

4 years agoFix typos
Aleksey Kladov [Fri, 20 Dec 2019 15:19:28 +0000 (16:19 +0100)]
Fix typos

4 years agoMove impls to ItemScope
Aleksey Kladov [Fri, 20 Dec 2019 14:58:20 +0000 (15:58 +0100)]
Move impls to ItemScope

4 years agoReduce visibility
Aleksey Kladov [Fri, 20 Dec 2019 14:51:43 +0000 (15:51 +0100)]
Reduce visibility

4 years agoRename ModuleScope -> ItemScope
Aleksey Kladov [Fri, 20 Dec 2019 14:45:12 +0000 (15:45 +0100)]
Rename ModuleScope -> ItemScope

4 years agoDocs
Aleksey Kladov [Fri, 20 Dec 2019 14:44:40 +0000 (15:44 +0100)]
Docs

4 years agoMove ModuleScope to a new module
Aleksey Kladov [Fri, 20 Dec 2019 14:43:45 +0000 (15:43 +0100)]
Move ModuleScope to a new module

4 years agoAdd item_scope module
Aleksey Kladov [Fri, 20 Dec 2019 14:38:17 +0000 (15:38 +0100)]
Add item_scope module

4 years agoMerge #2615
bors[bot] [Fri, 20 Dec 2019 15:30:36 +0000 (15:30 +0000)]
Merge #2615

2615: Fix wrong path parsing for macro call in pattern position r=edwin0cheng a=edwin0cheng

The parser incorrectly insert a `PathPat` inside `MacroCall` syntax node when parsing inside a pattern position, for example :

```rust
let foo!() = 0;
```

become:

```
 MACRO_CALL@[60; 66)
    PATH_PAT@[60; 63)     <------------- It should not exist
      PATH@[60; 63)
        PATH_SEGMENT@[60; 63)
          NAME_REF@[60; 63)
            IDENT@[60; 63) "foo"
    EXCL@[63; 64) "!"
    TOKEN_TREE@[64; 66)
      L_PAREN@[64; 65) "("
      R_PAREN@[65; 66) ")"
```

This PR fix this bug and add some test to make sure goto-defintion works for macro inside pattern.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoFix parser for macro call in pattern position
Edwin Cheng [Fri, 20 Dec 2019 15:11:07 +0000 (23:11 +0800)]
Fix parser for macro call in pattern position

4 years agoMerge #2614
bors[bot] [Fri, 20 Dec 2019 14:46:24 +0000 (14:46 +0000)]
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>
4 years agoUse unwrap_or_default
kjeremy [Fri, 20 Dec 2019 14:43:30 +0000 (09:43 -0500)]
Use unwrap_or_default

4 years agoRemove useless clone
kjeremy [Fri, 20 Dec 2019 14:43:01 +0000 (09:43 -0500)]
Remove useless clone

4 years agoMerge #2592
bors[bot] [Fri, 20 Dec 2019 14:36:53 +0000 (14:36 +0000)]
Merge #2592

2592: Add std::ops::Index support for infering r=edwin0cheng a=edwin0cheng

see also #2534

Seem like this can't fix #2534 for this case:

```rust
fn foo3(bar: [usize; 2]) {
    let baz = bar[1];   // <--- baz is still unknown ?
    println!("{}", baz);
}
```

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoMerge #2613
bors[bot] [Fri, 20 Dec 2019 14:28:41 +0000 (14:28 +0000)]
Merge #2613

2613: Remove code that never was alive? r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove code that never was alive?
Aleksey Kladov [Fri, 20 Dec 2019 14:26:19 +0000 (15:26 +0100)]
Remove code that never was alive?

4 years agoMerge #2612
bors[bot] [Fri, 20 Dec 2019 13:50:44 +0000 (13:50 +0000)]
Merge #2612

2612: Fix resolve for field init shorthand r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix resolve for field init shorthand
Aleksey Kladov [Fri, 20 Dec 2019 13:47:01 +0000 (14:47 +0100)]
Fix resolve for field init shorthand

4 years agoMerge #2611
bors[bot] [Fri, 20 Dec 2019 13:12:39 +0000 (13:12 +0000)]
Merge #2611

2611: Fix highlighting for field init shorthand r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix highlighting for field init shorthand
Aleksey Kladov [Fri, 20 Dec 2019 13:11:49 +0000 (14:11 +0100)]
Fix highlighting for field init shorthand

4 years agoImprove highlighting test
Aleksey Kladov [Fri, 20 Dec 2019 13:10:31 +0000 (14:10 +0100)]
Improve highlighting test

4 years agoMerge #2610
bors[bot] [Fri, 20 Dec 2019 12:58:55 +0000 (12:58 +0000)]
Merge #2610

2610: Reduce copy-paste some more r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoReduce copy-paste some more
Aleksey Kladov [Fri, 20 Dec 2019 12:58:09 +0000 (13:58 +0100)]
Reduce copy-paste some more

4 years agoMerge #2609
bors[bot] [Fri, 20 Dec 2019 12:48:27 +0000 (12:48 +0000)]
Merge #2609

2609: Use generic ItemLoc for impls r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse generic ItemLoc for impls
Aleksey Kladov [Fri, 20 Dec 2019 12:47:44 +0000 (13:47 +0100)]
Use generic ItemLoc for impls

4 years agoRemove more copy-paste
Aleksey Kladov [Fri, 20 Dec 2019 12:19:41 +0000 (13:19 +0100)]
Remove more copy-paste

4 years agoRemove more copy-paste
Aleksey Kladov [Fri, 20 Dec 2019 12:11:01 +0000 (13:11 +0100)]
Remove more copy-paste

4 years agoMerge #2608
bors[bot] [Fri, 20 Dec 2019 11:43:19 +0000 (11:43 +0000)]
Merge #2608

2608: Support for nested traits r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSupport for nested traits
Aleksey Kladov [Fri, 20 Dec 2019 11:29:25 +0000 (12:29 +0100)]
Support for nested traits

4 years agoSupport for nested statics, consts and type aliases
Aleksey Kladov [Fri, 20 Dec 2019 11:22:55 +0000 (12:22 +0100)]
Support for nested statics, consts and type aliases

4 years agoSupport for nested ADT
Aleksey Kladov [Fri, 20 Dec 2019 11:20:49 +0000 (12:20 +0100)]
Support for nested ADT

4 years agoIntroduce `ContainerId`
Aleksey Kladov [Fri, 20 Dec 2019 11:07:23 +0000 (12:07 +0100)]
Introduce `ContainerId`

4 years agoRename ContainerId -> AssocContainerId
Aleksey Kladov [Fri, 20 Dec 2019 10:59:50 +0000 (11:59 +0100)]
Rename ContainerId -> AssocContainerId

4 years agoMerge #2607
bors[bot] [Fri, 20 Dec 2019 10:56:59 +0000 (10:56 +0000)]
Merge #2607

2607: More ground work for local defs r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRebuild ra_lsp_server and nest helper function.
Aleksey Kladov [Fri, 20 Dec 2019 10:30:22 +0000 (11:30 +0100)]
Rebuild ra_lsp_server and nest helper function.

Completion now works again, so there's no need not to nest

4 years agoHandle nested declrations in from_source
Aleksey Kladov [Fri, 20 Dec 2019 10:24:23 +0000 (11:24 +0100)]
Handle nested declrations in from_source

4 years agoAdd local functions to bodies
Aleksey Kladov [Fri, 20 Dec 2019 10:19:09 +0000 (11:19 +0100)]
Add local functions to bodies

4 years agoUse fill instread of for loop
Edwin Cheng [Thu, 19 Dec 2019 19:04:55 +0000 (03:04 +0800)]
Use fill instread of for loop

4 years agoMerge #2601
bors[bot] [Thu, 19 Dec 2019 17:32:51 +0000 (17:32 +0000)]
Merge #2601

2601: :arrow_up: deps r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years ago:arrow_up: deps
Aleksey Kladov [Thu, 19 Dec 2019 17:28:57 +0000 (18:28 +0100)]
:arrow_up: deps

4 years ago:arrow_up: Rust
Aleksey Kladov [Thu, 19 Dec 2019 17:27:44 +0000 (18:27 +0100)]
:arrow_up: Rust

4 years agoMerge #2600
bors[bot] [Thu, 19 Dec 2019 17:22:40 +0000 (17:22 +0000)]
Merge #2600

2600: Plumbing for local items support r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoImplement ChildBySource for DefWithBody
Aleksey Kladov [Thu, 19 Dec 2019 17:21:26 +0000 (18:21 +0100)]
Implement ChildBySource for DefWithBody

4 years agoAdd body as a possible container for items
Aleksey Kladov [Thu, 19 Dec 2019 17:12:46 +0000 (18:12 +0100)]
Add body as a possible container for items

4 years agoAllow storing defs in bodies
Aleksey Kladov [Thu, 19 Dec 2019 16:30:28 +0000 (17:30 +0100)]
Allow storing defs in bodies