Commit Graph

68 Commits

Author SHA1 Message Date
Benjamin Coenen
b60a29ca94 feat(diagnostics): use default expression instead of todo! when missing fields
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-07 14:13:34 +01:00
Benjamin Coenen
f4ce0d78bb add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-06 15:42:29 +01:00
Benjamin Coenen
336c899a07 add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-04 15:59:00 +01:00
Benjamin Coenen
df6fa50f92 feat(diagnostics): add new config to fill default expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-31 16:29:08 +01:00
Benjamin Coenen
0435463439 feat(diagnostics): use Default::default() expression instead of todo! when missing fields
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-30 15:49:31 +01:00
bors[bot]
f46731a230
Merge #11028
11028: Bump MSRV (1.57) r=Veykril a=iDawer

This bumps MSRV on all crates to 1.57 except `la-arena`

#10986 requires >=1.57 

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
iDawer
a9ad7be748 Respect binding mode of a binding pattern for exhaustiveness check 2021-12-20 00:14:39 +05:00
iDawer
b17aefb83a internal: Normalize field type after substituting 2021-12-20 00:14:39 +05:00
Dawer
deb05930ef internal: Sync match checking algorithm with rustc
Original version: rust-lang/rust  68b76a483 2021-10-01
2021-12-20 00:10:01 +05:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
iDawer
676744be6e Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
rainy-me
a0c52794bd fix: lookup upwards for struct and enum 2021-12-12 01:23:27 +09:00
Jonas Schievink
b365b6119c Treat extern blocks as item containers 2021-12-07 17:31:26 +01:00
Lukas Wirth
045014c17e minor: Shorten spans of mismatched_arg_count diag 2021-12-04 00:27:29 +01:00
Lukas Wirth
ea03defeac fix: Diagnose invalid derive attribute input 2021-11-19 13:17:35 +01:00
Lukas Wirth
6757910934 fix: Diagnose using derive on non-adt items 2021-11-19 12:10:55 +01:00
Lukas Wirth
439a8194b0 Replace more Name::to_string usages with Name::to_smol_str 2021-11-04 18:12:05 +01:00
Laurențiu Nicola
8457ae34bd Set MSRV 2021-10-23 15:07:11 +03:00
Lukas Wirth
1294bfce86 Migrate to edition 2021 2021-10-21 20:10:40 +02:00
Lukas Wirth
ac505b21a8 Fix missing_fields diagnostic fix replacing wrong text ranges 2021-10-15 19:27:19 +02:00
bors[bot]
64ca0f63bf
Merge #10504
10504: Remove needless clone r=lnicola a=k-nasa

## Why

Delete clones for efficiency

## What

- I erased unnecessary clones


Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-10-10 07:17:52 +00:00
k-nasa
b50cb5c261 Remove neesless clone 2021-10-10 10:50:51 +09:00
Aleksey Kladov
a85a3d73ed feat: be more precise in mismatch arg counts highlighting 2021-10-09 22:45:54 +03:00
Aleksey Kladov
afacdd612d internal: update expect 2021-10-09 17:17:16 +03:00
crauzer
ba62a8a075 fix test 2021-10-06 23:37:43 +02:00
Lukas Wirth
7faa35cbbd Simplify 2021-10-04 15:16:13 +02:00
Aleksey Kladov
76e875542a fix: remove semicolon diagnostics only highlights the semi 2021-10-02 12:54:10 +03:00
Lukas Wirth
b6ed91a6de Rename *Owner traits to Has* 2021-09-27 12:54:24 +02:00
Jonas Schievink
7860d6ade6 Fix item-level lazy macro errors 2021-09-24 21:17:25 +02:00
Jonas Schievink
5967f3d3a9 Fix diagnostics in unnamed consts 2021-09-24 20:41:24 +02:00
bors[bot]
eb17e90eba
Merge #10105
10105: RfC: Use `todo!()` instead of `()` for missing fields r=jonas-schievink a=jo-so

Most commonly a field of a struct can be initialized with its default value than an empty tuple.

Co-authored-by: Jörg Sommer <joerg@jo-so.de>
2021-09-24 15:12:17 +00:00
Lukas Wirth
bd8c95a580 Fix incorrect mod.rs handling in unlinked_file fixes 2021-09-24 14:20:43 +02:00
Jörg Sommer
c87b860d3d Use todo!() instead of () for missing fields
The generated code with `()` doesn't compile in most of the cases. To signal
the developer there's something to do, fill in `todo!()`.

Because the file *missing_fields.rs* contains the string `todo!()` it needs
an exception for the test *check_todo*.
2021-09-09 18:04:50 +02:00
bors[bot]
20f3792d10
Merge #10089
10089: Fix minor mispelling r=bjorn3 a=NerdyPepper

`find_map` misspelt as `wind_map` in test identifier. 

Co-authored-by: Akshay <nerdy@peppe.rs>
2021-08-30 19:35:00 +00:00
bors[bot]
02a3d898e4
Merge #10076
10076: Use struct init shorthand when applicable in fill struct fields assist r=matklad a=nathanwhit

This PR tweaks the fill struct fields assist to use the struct init shorthand when a local variable with a matching name and type is in scope.

For example:
```rust
struct Foo {
    a: usize,
    b: i32,
    c: char,
}

fn main() {
    let a = 1;
    let b = 2;
    let c = 3;
    let foo = Foo { <|> };
}
```
Before we would insert
```rust
Foo {
    a: (),
    b: (),
    c: (),
}
```
now we would insert
```rust
Foo {
    a,
    b,
    c: ()
}
```

Co-authored-by: nathan.whitaker <nathan.whitaker01@gmail.com>
2021-08-30 18:55:18 +00:00
nathan.whitaker
e1d86a42fe Add coverage mark for struct init shorthand test 2021-08-30 14:37:03 -04:00
Akshay
e304a623ad fix minor mispelling
find_map misspelt as wind_map
2021-08-30 22:51:14 +05:30
nathan.whitaker
e4757f9407 Update existing fill struct fields test 2021-08-29 13:14:15 -04:00
nathan.whitaker
251f9dfc8a Add tests for fill struct fields shorthand 2021-08-29 13:14:03 -04:00
nathan.whitaker
dcd4157420 Use struct init shorthand in fill struct fields assist 2021-08-29 13:12:59 -04:00
Aleksey Kladov
78365c64c8 internal: slightly improve compile times
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Jonas Schievink
3047ae8d0f Enable diagnostics in const and static items 2021-08-27 23:21:21 +02:00
bors[bot]
b07c83f8b0
Merge #9810
9810: Add reference here r=matklad a=ivan770

Superseds #6853 

Co-authored-by: ivan770 <ivan@ivan770.me>
2021-08-08 10:35:00 +00:00
ivan770
be3e70c604
Add reference here diagnostic 2021-08-08 10:12:40 +02:00
Lukas Wirth
c4a119f433 Simplify 2021-08-07 22:16:15 +02:00
Jonas Schievink
260936d0b7 Fix detection of macro file in inactive-code diag 2021-08-04 18:02:45 +02:00
Lukas Wirth
b96f1adf5c Give TypeInfo fields and methods more appropriate names 2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2 Revise TypeInfo::ty usage 2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4 Introduce TypeInfo 2021-08-03 16:41:53 +02:00
Lukas Wirth
1edbaa29f9 Wrap inner tail expressions in MissingOkOrSomeInTailExpr 2021-07-31 20:00:09 +02:00