Commit graph

13050 commits

Author SHA1 Message Date
bors[bot]
c423738921
Merge #6189
6189: adt: correctly inherit field visibility from enum r=jonas-schievink a=jonas-schievink

Previously, "find all references" on a variant field wouldn't find any
references outside the defining module. This is because variant fields
were incorrectly assumed to be private, like struct fields without
explicit visibility, but they actually inherit the enum's visibility.

bors r+ 🤖 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-09 18:47:52 +00:00
Jonas Schievink
5dcbf03d0f adt: correctly inherit field visibility from enum
Previously, "find all references" on a variant field wouldn't find any
references outside the defining module. This is because variant fields
were incorrectly assumed to be private, like struct fields without
explicit visibility, but they actually inherit the enum's visibility.
2020-10-09 20:46:45 +02:00
bors[bot]
cde189c5d5
Merge #6188
6188: Treat `ast::Name` in field patterns as use r=jonas-schievink a=jonas-schievink

bors r+ 🤖 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-09 17:57:20 +00:00
Jonas Schievink
210456aeaa Treat ast::Name in field patterns as use 2020-10-09 19:56:54 +02:00
Laurențiu Nicola
cca330ef53 Remove release build overrides 2020-10-09 19:55:30 +03:00
bors[bot]
95c498d913
Merge #6185
6185: Add note if RUST_SRC_PATH is likely to be wrong r=jonas-schievink a=jonas-schievink

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-09 14:18:29 +00:00
Jonas Schievink
55ecfbb99b
Update crates/project_model/src/sysroot.rs
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-10-09 16:17:05 +02:00
Jonas Schievink
7d0772e796 Add note if RUST_SRC_PATH is likely to be wrong 2020-10-09 16:11:16 +02:00
bors[bot]
c1a8c03299
Merge #6181
6181: Fix source_to_def for named enum variant fields r=jonas-schievink a=jonas-schievink

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-09 01:00:18 +00:00
Jonas Schievink
468b804856 Fix source_to_def for named enum variant fields 2020-10-09 02:57:35 +02:00
Benjamin Coenen
3bfa3e8123 when generating new function, focus on return type instead of body
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-08 20:57:18 +02:00
Benjamin Coenen
36459284c7 add eprintln in fmt-like postfix
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-08 20:53:39 +02:00
bors[bot]
636b413e14
Merge #6173
6173: Bump rustc_lexer, cfg-if to 1.0 and add new license to check r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-10-08 15:58:48 +00:00
kjeremy
13bb0404a8 Bump rustc_lexer, cfg-if to 1.0 and add new license to check 2020-10-08 10:39:02 -04:00
bors[bot]
e6a05e6566
Merge #5651
5651: Add track_env_var to the proc macro server r=kjeremy a=lnicola

See https://github.com/rust-lang/rust/pull/74653.

Fixes #6054.
Fixes #5640, maybe.

Should be merged when 1.47 is released.

Proc macros still don't work for me, but it no longer crashes.



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-08 14:27:30 +00:00
Laurențiu Nicola
3d169bd3f4 Add track_env_var to the proc macro server 2020-10-08 17:06:20 +03:00
Zac Pullar-Strecker
3bd4fe96dc Remove methodowner & fix formatting 2020-10-08 15:50:48 +13:00
Zac Pullar-Strecker
8af1dd7337 Rebase fixes 2020-10-08 15:22:57 +13:00
Zac Pullar-Strecker
d2c68809ea Changes from review 2020-10-08 15:05:24 +13:00
Zac Pullar-Strecker
e4a787fcbc Remove outdated part of doc_links module docs 2020-10-08 15:05:23 +13:00
Zac Pullar-Strecker
f6759ba3bb Add ignored test to demonstrate ImportMap bug 2020-10-08 15:05:23 +13:00
Zac Pullar-Strecker
6cae6b8f3c Fix namespace detection & function test 2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
37a4d060a7 Add tests 2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
ec75d8bd75 Update tests for new function field 2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
f1decfc110 Fix send->sent typo 2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
26086faab2 Change Option::Some bug to a fixme note
IMO this is too much work to be worth fixing at the moment.
2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
c648884397 Differentiate method/tymethod by determining 'defaultness'
Currently a method only has defaultness if it is a provided trait
method, but this will change when specialisation is available and may
need to become a concept known to hir.

I opted to go for a 'fewest changes' approach given specialisation is
still under development.
2020-10-08 15:04:21 +13:00
Zac Pullar-Strecker
62b76e7004 Document the protocol extension 2020-10-08 15:04:20 +13:00
Zac Pullar-Strecker
974518fde7 Code reorganisation and field support 2020-10-08 15:04:20 +13:00
Zac Pullar-Strecker
a14194b428 Changes from review 2020-10-08 15:01:30 +13:00
Zac Pullar-Strecker
8c32bdea36 Rename ide::link_rewrite -> ide::doc_links & tidy imports 2020-10-08 15:01:30 +13:00
Zac Pullar-Strecker
a06d736b77 Add support for struct & trait methods 2020-10-08 14:59:31 +13:00
Zac Pullar-Strecker
bfda0d2583 WIP: Command to open docs under cursor 2020-10-08 14:59:31 +13:00
bors[bot]
e95e666b10
Merge #6161
6161: Bump chalk to use latest git to get upstream fix r=jonas-schievink a=Ameobea

 * Chalk very recently (like an hour ago) merged a fix that prevents rust analyzer from panicking.  This allows it to be usable again for code that hits those situations.  See #6134, #6145, Probably #6120

Co-authored-by: Casey Primozic <me@ameo.link>
2020-10-07 20:46:33 +00:00
Casey Primozic
37df2138ec
Switch from git to latest tagged release of chalk deps 2020-10-07 12:11:22 -07:00
bors[bot]
83a651b123
Merge #6154
6154: Shorten type hints for std::iter Iterators r=SomeoneToIgnore a=Veykril

Fixes #3750.

This re-exports the `hir_expand::name::known` module to be able to fetch the `Iterator` and `iter` names.
I'm not sure if there is anything to do with `Solution::Ambig` in `normalize_trait_assoc_type` or whether discarding those results is always wanted.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-07 11:52:05 +00:00
Lukas Wirth
783af171f7 Clean up inlay_hints 2020-10-07 13:18:12 +02:00
Aleksey Kladov
5359e8f742 minor 2020-10-07 13:11:33 +02:00
bors[bot]
76c68dbefe
Merge #6167
6167: Add comparisons guideline to style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-07 11:03:49 +00:00
Aleksey Kladov
1688e481b3 minor 2020-10-07 13:03:13 +02:00
Aleksey Kladov
6976494781 Add comparisons guideline to style 2020-10-07 12:57:49 +02:00
Aleksey Kladov
fdf2f6226b Reorg style 2020-10-07 12:50:46 +02:00
bors[bot]
2aa46034c2
Merge #6166
6166: Better progress API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-07 10:17:14 +00:00
Aleksey Kladov
6219142c96 Better progress API
Percentage is a UI concern, the physical fact here is fraction. It's
sad that percentage bleeds into the protocol level, we even duplicated
this bad API ourselves!
2020-10-07 12:15:37 +02:00
Lukas Wirth
e106857e80 Shorten iterator hints for std::iter iterators behind references 2020-10-07 12:14:08 +02:00
bors[bot]
67c76c35a3
Merge #6165
6165: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-07 09:55:44 +00:00
Aleksey Kladov
fd8622e1ec Cleanup 2020-10-07 11:55:20 +02:00
bors[bot]
faddea9353
Merge #6158
6158: Fix for negative literals in macros r=matklad a=cutsoy

_This pull request fixes #6028._

When writing `-42.0f32` in Rust, it is usually parsed as two different tokens (a minus operator and a float literal).

But a procedural macro can also generate new tokens, including negative [float literals](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.f32_suffixed):

```rust
#[proc_macro]
fn example_verbose(input: TokenStream) -> TokenStream {
    let literal = Literal::f32_suffixed(-42.0);
    quote! { #literal }
}
```

or even shorter

```rust
#[proc_macro]
fn example(input: TokenStream) -> TokenStream {
    let literal = -42.0f32;
    quote! { #literal }
}
```

Unfortunately, these currently cause RA to crash:

```
thread '<unnamed>' panicked at 'Fail to convert given literal Literal {
    text: "-42.0f32",
    id: TokenId(
        4294967295,
    ),
}', crates/mbe/src/subtree_source.rs:161:28
```

This pull request contains both a fix 8cf9362 and a unit test 27798ee. In addition, I installed the patched server with `cargo xtask install --server` and verified in VSCode that it no longer crashes when a procedural macro returns a negative number literal.

Co-authored-by: Tim <tim@glacyr.com>
2020-10-07 09:32:47 +00:00
Lukas Wirth
209e9b9926 Shorten iterator chain hints 2020-10-07 11:30:42 +02:00
bors[bot]
a184c83535
Merge #6160
6160: Add validation check for ambiguous trait objects r=matklad a=Veykril

Fixes #285.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-07 09:12:09 +00:00