| Age | Commit message (Collapse) | Author | Lines |
|
It is used in the case where a variable-length slice pattern is used to
match on an array of known size. This allows considering only those
entries in the array that are captured by one of the patterns.
As a side-effect, diagnostics improve a bit for those cases.
|
|
|
|
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
|
|
|
|
|
|
|
|
The previous behaviour ignored slice lengths above a certain length
because it could not do otherwise. We now have VarLenSlice however, that
can represent the ignored lengths to make the algorithm more consistent.
This does not change the correctness of the algorithm, but makes it
easier to reason about.
As a nice side-effect, exhaustiveness errors have improved: they now
capture all missing lengths instead of only the shortest.
|
|
|
|
This improves error messages by indicating when slices above a certain
lengths have not been matched. Previously, we would only report examples
of such lengths, but of course never all of them.
|
|
This alters error messages slightly, but that'll be improved later
|
|
|
|
Validate error patterns and error annotation in ui tests when present
Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.
Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.
Fixes #56277
|
|
Those annotation are silently ignored rather than begin validated
against compiler output. Update them before validation is enabled,
to avoid test failures.
|
|
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
|
|
Point at local similarly named element and tweak references to variants
Partially address #65386.
|
|
I took most tests that were testing only for match exhaustiveness,
pattern refutability or match arm reachability, and put them in
the same test folder.
|
|
Point at the span for the definition of ADTs internal to the current
crate.
Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.
Turn fn `add_typo_suggestion` into a `Resolver` method.
|
|
|
|
|
|
Remove blanket check for existence of other errors before emitting
"type annotation needed" errors, and add some eager checks to avoid
adding obligations when they refer to types that reference
`[type error]` in order to reduce unneded errors.
|
|
|
|
|
|
|
|
r=petrochenkov
Stabilize `type_alias_enum_variants` in Rust 1.37.0
Stabilize `#![feature(type_alias_enum_variants)]` which allows type-relative resolution with highest priority to `enum` variants in both expression and pattern contexts. For example, you may now write:
```rust
enum Option<T> {
None,
Some(T),
}
type OptAlias<T> = Option<T>;
fn work_on_alias(x: Option<u8>) -> u8 {
match x {
OptAlias::Some(y) => y + 1,
OptAlias::None => 0,
}
}
```
Closes https://github.com/rust-lang/rfcs/issues/2218
Closes https://github.com/rust-lang/rust/issues/52118
r? @petrochenkov
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This commit ensures that non-exhaustive variants are considered
inhabited when used in extern crates.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test
This ensures that the test passes, regardless of what the user has set
RUST_BACKTRACE to.
|
|
clarify resolve typo suggestion
Include the kind of the binding that we're suggesting, and use a
structured suggestion.
Fixes #53445.
|
|
This ensures that the test passes, regardless of what the user has set
RUST_BACKTRACE to.
|
|
Point at match discriminant on type error in match arm pattern
```
error[E0308]: mismatched types
--> src/main.rs:5:9
|
4 | let temp: usize = match a + b {
| ----- this expression has type `usize`
5 | Ok(num) => num,
| ^^^^^^^ expected usize, found enum `std::result::Result`
|
= note: expected type `usize`
found type `std::result::Result<_, _>`
```
Fix #57279.
|
|
|
|
|
|
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495).
Co-Authored-By: Sebastian Malton <sebastian@malton.name>
|
|
Include the kind of the binding that we're suggesting, and use a
structured suggestion.
|