Commit Graph

23 Commits

Author SHA1 Message Date
Esteban Küber
5c3e01a340 On resolve error of [rest..], suggest [rest @ ..]
When writing a pattern to collect multiple entries of a slice in a
single binding, it is easy to misremember or typo the appropriate syntax
to do so, instead writing the experimental `X..` pattern syntax. When we
encounter a resolve error because `X` isn't available, we suggest
`X @ ..` as an alternative.

```
error[E0425]: cannot find value `rest` in this scope
  --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13
   |
LL |         [1, rest..] => println!("{rest:?}"),
   |             ^^^^ not found in this scope
   |
help: if you meant to collect the rest of the slice in `rest`, use the at operator
   |
LL |         [1, rest @ ..] => println!("{rest:?}"),
   |                  +
```

Fix #88404.
2023-11-17 00:55:55 +00:00
Nadrieril
746197c08a Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
Nadrieril
1baf8bf54d Fix range overflow checking 2023-10-11 04:55:55 +02:00
Nadrieril
c5e17021cc Add tests 2023-10-11 04:54:49 +02:00
Ralf Jung
a1d6fc4340 rename lint; add tracking issue 2023-09-25 19:05:10 +02:00
Ralf Jung
c5fccb98ea work towards rejecting consts in patterns that do not implement PartialEq 2023-09-24 16:36:26 +02:00
Nikita Popov
531830cecd Update to LLVM 17.0.0
This rebases our LLVM fork to 17.0.0.

Fixes #115681.
2023-09-19 11:14:35 +02:00
Sebastian Toh
d87b87d10e Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
Sebastian Toh
43dd8613a3 Add note when matching on nested non-exhaustive enums 2023-08-28 14:50:32 +08:00
bors
2bc7929138 Auto merge of #114847 - nikic:update-llvm-12, r=cuviper
Update LLVM submodule

Merge the current release/17.x branch.

Fixes #114691.
Fixes #114312.

The test for the latter is taken from #114726.
2023-08-16 09:19:38 +00:00
Nikita Popov
62ca87f45d Add test for #114691 2023-08-15 11:33:45 +02:00
Esteban Küber
55f8c66a60 Point at return type when it influences non-first match arm
When encountering code like

```rust
fn foo() -> i32 {
    match 0 {
        1 => return 0,
        2 => "",
        _ => 1,
    }
}
```

Point at the return type and not at the prior arm, as that arm has type
`!` which isn't influencing the arm corresponding to arm `2`.

Fix #78124.
2023-08-14 21:43:56 +00:00
Michael Goulet
fe870424a7 Do not set up wrong span for adjustments 2023-07-10 20:09:26 +00:00
James Dietz
71362c733f remove FIXME and add test 2023-06-28 07:59:36 -04:00
James Dietz
b1f7ab2ea2 add test 2023-06-15 06:50:56 -04:00
Oli Scherer
d030ece6f7 Only rewrite valtree-constants to patterns and keep other constants opaque 2023-05-31 14:02:57 +00:00
Camille GILLOT
84cb7ecbc1 Remove wrong assertion. 2023-04-30 14:08:26 +00:00
Eric Huss
a4e851cf62 Add some reasons why tests are ignored. 2023-04-15 16:11:42 -07:00
Camille GILLOT
05082f57af Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
Michael Howell
3f374128ee diagnostics: update test cases to refer to assoc fn with self as method 2023-02-22 08:40:47 -07:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Esteban Küber
7b8251e188 Account for method call and indexing when looking for inner-most path in expression 2023-01-17 02:52:43 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00