Commit Graph

4708 Commits

Author SHA1 Message Date
bors[bot]
866b41ddd8
Merge #1733
1733: Parse arbitrarily complex `box` patterns. r=matklad a=ecstatic-morse

This fully resolves the pattern part of #1412 by enabling the parsing of complex `box` patterns such as:

```rust
let box Struct { box i, j: box Inner(box &x) } = todo!();
```

This introduces a new `ast::BoxPat` (in the mold of `ast::RefPat`) that gets translated to `hir::Pat::Missing`.

Co-authored-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
2019-08-25 09:47:44 +00:00
Dylan MacKenzie
c93903e9c7 Generate and bless tests 2019-08-23 16:24:30 -07:00
Dylan MacKenzie
c08ad1cf8a Handle Struct { box i } syntax
Named structs can have `box` patterns that will bind to their fields.
This is similar to the behavior of the `ref` and `mut` fields, but is at
least a little bit surprising.
2019-08-23 16:20:18 -07:00
Dylan MacKenzie
83433cd1f0 Centralize box pattern tests in patterns.rs 2019-08-23 16:19:53 -07:00
Dylan MacKenzie
1e991f2eaf Convert BoxPat to Missing in HIR 2019-08-23 16:07:11 -07:00
Dylan MacKenzie
ab51f57e1d Parse BoxPat 2019-08-23 16:07:11 -07:00
Dylan MacKenzie
e6f3790106 Add BoxPat variant 2019-08-23 15:11:34 -07:00
bors[bot]
fdece911fe
Merge #1732
1732: remove wrong config from .travis.yml r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-23 16:34:54 +00:00
Aleksey Kladov
c75f5d1190 remove wrong config from .travis.yml
The right key here is target_branch, not branch.

However, this works anyway b/c gh-pages is the default.
2019-08-23 19:33:57 +03:00
bors[bot]
a832a2f7dd
Merge #1731
1731: rename pos_field -> tuple_field r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-23 14:01:06 +00:00
Aleksey Kladov
5b18a4eef9 rename struct -> record, pos -> tuple 2019-08-23 16:59:50 +03:00
bors[bot]
c12dce0073
Merge #1716
1716: make ast object safe r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-23 12:07:56 +00:00
Aleksey Kladov
bbcca4f735 make ast object safe 2019-08-23 15:06:47 +03:00
bors[bot]
e055cfacdf
Merge #1724
1724: Refactor fill_match_arms assist to use AstBuilder facilities r=matklad a=viorina



Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
2019-08-23 05:43:32 +00:00
Ekaterina Babshukova
e84f93cb5b refactor fill_match_arms assist 2019-08-23 00:43:12 +03:00
bors[bot]
0c35d82329
Merge #1721 #1723
1721: Impl/dyn trait r=flodiebold a=flodiebold

This adds support for `impl Trait` and `dyn Trait` types as far as possible without Chalk. So we can represent them in the type system, and handle them in method resolution, but Chalk doesn't know about them yet. There's a small temporary hack here where we bypass Chalk during method resolution, so we can handle simple method calls on them and completion works.

Fixes #1608.

1723: Make sysroot use `RUST_SRC_PATH` if set r=matklad a=bkchr



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
2019-08-22 20:06:32 +00:00
Bastian Köcher
18c7a1ebe7 Make sysroot use RUST_SRC_PATH if set 2019-08-22 21:59:23 +02:00
bors[bot]
daf1a96ff0
Merge #1722
1722: Parse `box` keyword in patterns below top-level r=matklad a=ecstatic-morse

This extends the parser to handle patterns like `if let Some(box x) = ...` where the `box` keyword is not at the top-level. The last line of the added test caused a `ParseError`. This is a variant of #1412 which was not fixed by #1414.

~~I'm not familiar with `rust-analyzer`, otherwise I would fix this as well 😄.~~

Co-authored-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
2019-08-22 19:58:35 +00:00
Florian Diebold
4768f5e717 Improve/fix type bound lowering 2019-08-22 21:58:29 +02:00
Florian Diebold
b1a40042e8 Handle impl/dyn Trait in method resolution
When we have one of these, the `Trait` doesn't need to be in scope to call its
methods. So we need to consider this when looking for method
candidates. (Actually I think the same is true when we have a bound `T:
some::Trait`, but we don't handle that yet).

At the same time, since Chalk doesn't handle these types yet, add a small hack
to skip Chalk in method resolution and just consider `impl Trait: Trait` always
true. This is enough to e.g. get completions for `impl Trait`, but since we
don't do any unification we won't infer the return type of e.g. `impl
Into<i64>::into()`.
2019-08-22 21:55:11 +02:00
Dylan MacKenzie
3e14b16c4d Add test for nested box pattern 2019-08-22 12:53:54 -07:00
Dylan MacKenzie
f3b320adf4 Add BOX_KW to PATTERN_FIRST 2019-08-22 12:33:03 -07:00
Florian Diebold
16a7d8cc85 Add impl Trait and dyn Trait types
- refactor bounds handling in the AST a bit
 - add HIR for bounds
 - add `Ty::Dyn` and `Ty::Opaque` variants and lower `dyn Trait` / `impl Trait`
   syntax to them
2019-08-22 19:33:00 +02:00
bors[bot]
08e5d394df
Merge #1719
1719: ⬆️ salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-22 13:42:28 +00:00
Aleksey Kladov
8213db5c04 ⬆️ salsa 2019-08-22 16:42:05 +03:00
bors[bot]
79a46f2588
Merge #1717
1717: Don't add `?` bounds as real bounds r=flodiebold a=matklad

closes #1709


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-22 13:13:07 +00:00
bors[bot]
5c7d832bf9
Merge #1718
1718: disable clap's features r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-22 12:58:13 +00:00
Aleksey Kladov
77fa2ef96d disable clap's features 2019-08-22 15:57:48 +03:00
Aleksey Kladov
9f238930f1 Don't add ? bounds as real bounds
closes #1709
2019-08-22 15:35:42 +03:00
bors[bot]
0a612fad02
Merge #1715
1715: Feature flags r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-22 12:17:21 +00:00
Aleksey Kladov
69bbe79c50 implement feature flags 2019-08-22 15:07:31 +03:00
Aleksey Kladov
4dd5afb7fe show error to the user when deserializing config 2019-08-22 11:08:22 +03:00
bors[bot]
2d0931b9ba
Merge #1714
1714: Fix syntax-highlighting for fields (`NAMED_FIELD_DEF`) r=matklad a=cynecx

Before:

`ralsp.function: "#ff0000"`

![image](https://user-images.githubusercontent.com/5961244/63473802-13920600-c477-11e9-93df-67c04fc67636.png)

After:

`ralsp.field: "#9cdcfe"`

![image](https://user-images.githubusercontent.com/5961244/63473976-a894ff00-c477-11e9-8731-269a4c942e05.png)



Co-authored-by: cynecx <me@cynecx.net>
2019-08-22 06:57:01 +00:00
cynecx
1d87f85441 Update snapshots/highlighting.html to use correct highlighting 2019-08-22 01:08:07 +02:00
cynecx
5534167f58 Fix syntax-highlighting for fields (NAMED_FIELD_DEF) 2019-08-22 00:39:18 +02:00
bors[bot]
5fd9a5be09
Merge #1712
1712: fix default for the exlude key r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-21 14:31:35 +00:00
Aleksey Kladov
6ab85cc192 fix default for the exlude key 2019-08-21 17:30:58 +03:00
bors[bot]
8521f0456f
Merge #1711
1711: switch to jod threads r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-21 08:09:27 +00:00
Aleksey Kladov
8844ed9697 switch to jod threads 2019-08-21 11:09:01 +03:00
bors[bot]
bdf16d1b67
Merge #1706 #1708
1706: Normalize line endings to Unix flavor on IO bounraries r=matklad a=matklad



1708: update yanked getrandom r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-20 16:56:24 +00:00
Aleksey Kladov
77751cfe01 remove debug-print 2019-08-20 19:55:34 +03:00
Aleksey Kladov
deba1fedfa ⬆️ rustc_lexer 2019-08-20 19:53:05 +03:00
Aleksey Kladov
bbeb07e5ca switch to upstream ra_vfs 2019-08-20 19:53:05 +03:00
Aleksey Kladov
188c9967c0 Drop unnecessary &'_ from impls 2019-08-20 19:53:05 +03:00
Aleksey Kladov
4753409f86 refactor TryConvWith similar to ConvWith 2019-08-20 19:53:05 +03:00
Aleksey Kladov
6ea4184fd1 translate \n -> \r\n on the way out 2019-08-20 19:53:05 +03:00
Aleksey Kladov
80a6e61446 make CTX type param instead of assoc type
that way, we can implement ConvWith<&'_ CTX> for different lifetimes
2019-08-20 19:53:05 +03:00
Aleksey Kladov
de3f2948ea add tests for crlf 2019-08-20 19:53:05 +03:00
Aleksey Kladov
ccca427ce4 minor 2019-08-20 19:53:05 +03:00
Aleksey Kladov
f2d458760a update yanked getrandom 2019-08-20 19:28:40 +03:00