about summary refs log tree commit diff
path: root/src/test/ui/uninhabited
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-388/+0
2022-12-13Avoid rendering empty annotationsOli Scherer-3/+9
2022-12-13Don't emit empty notesOli Scherer-6/+0
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-15/+6
available
2022-09-26fix #102087, Suggest Default::default() when binding isn't initializedyukang-0/+5
2022-09-15Remove feature gate from let else suggestionest31-2/+2
The let else suggestion added by 0d92752b8aac53e033541d04fc7d9677d8bca227 does not need a feature gate any more.
2022-09-03Include enum path in variant suggestionMichael Goulet-3/+3
2022-07-07Tweak wording and spansEsteban Küber-2/+2
2022-07-07On partial uninit error point at where we need initEsteban Küber-3/+6
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-01Shorten def_span for more items.Camille GILLOT-27/+15
2022-03-24Check if call return type is visibly uninhabited when building MIRTomasz Miąsko-0/+38
2022-03-08Suggest `if let`/`let_else` for refutable pat in `let`Esteban Kuber-8/+16
2022-03-08Change wording of suggestion to add missing `match` armEsteban Kuber-6/+6
2022-03-08Point at uncovered variants in enum definition in `note` instead of a ↵Esteban Kuber-29/+50
`span_label` This makes the order of the output always consistent: 1. Place of the `match` missing arms 2. The `enum` definition span 3. The structured suggestion to add a fallthrough arm
2022-03-08When finding a match expr with a single arm that requires more, suggest itEsteban Kuber-3/+15
Given ```rust match Some(42) { Some(0) => {} } ``` suggest ```rust match Some(42) { Some(0) => {} None | Some(_) => todo!(), } ```
2022-03-08When encountering a match expr with no arms, suggest itEsteban Kuber-6/+21
Given ```rust match Some(42) {} ``` suggest ```rust match Some(42) { None | Some(_) => todo!(), } ```
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-1/+1
2021-08-11Modify structured suggestion outputEsteban Küber-1/+1
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-3/+3
2021-02-06path trimming: ignore type aliasesDan Aloni-3/+3
2021-01-03Add note on void reference testDaniel Noom-0/+1
This test is also changed by adding a note about uninhabited references still counting as inhabited.
2020-09-01Permit uninhabited enums to cast into intsMark Rousskov-10/+3
This essentially reverts part of #6204.
2020-07-27mv std libs to library/mark-3/+3
2020-06-15Tweak "non-primitive cast" errorEsteban Küber-3/+1
- Suggest borrowing expression if it would allow cast to work. - Suggest using `<Type>::from(<expr>)` when appropriate. - Minor tweak to `;` typo suggestion. Partily address #47136.
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-12/+7
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+8
2020-03-23Ignore tests on some platforms due to #53081Aaron Hill-7/+12
2020-03-22Store idents for `DefPathData` into crate metadataAaron Hill-0/+15
Previously, we threw away the `Span` associated with a definition's identifier when we encoded crate metadata, causing us to lose location and hygiene information. We now store the identifier's `Span` in the crate metadata. When we decode items from the metadata, we combine the name and span back into an `Ident`. This improves the output of several tests, which previously had messages suppressed due to dummy spans. This is a prerequisite for #68686, since throwing away a `Span` means that we lose hygiene information.
2020-01-24Normalise notes with the/isvarkor-1/+1
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-1/+1
2019-12-22Remove mem::uninitalized from testsMark Rousskov-14/+17
This purges uses of uninitialized where possible from test cases. Some are merely moved over to the equally bad pattern of MaybeUninit::uninit().assume_init() but with an annotation that this is "the best we can do".
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-7/+9
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-04Forgot to update some test outputsNadrieril-0/+3
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-9/+7
Also remove `never_type` the feature-gate test.
2019-11-05Make exhaustiveness error message more consistent for slice patternsNadrieril-2/+2
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.
2019-10-27Gather together usefulness testsNadrieril-51/+0
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.
2019-10-15Organize `never_type` testsMazdak Farrokhzad-0/+51
Also move {run-fail -> ui}/never_type
2019-10-09Suggest `if let` on `let` refutable bindingEsteban Küber-0/+14
2019-09-09check_match: unify check_irrefutable & check_exhaustive more.Mazdak Farrokhzad-0/+1
2019-07-05Remove never_type feature requirement for exhaustive patternsMarcel Hellwig-0/+9
2019-07-04Permit use of mem::uninitialized via allow(deprecated)Mark Rousskov-7/+9
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-1/+1
2019-04-22Remove double trailing newlinesvarkor-2/+0
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-1/+1
2019-03-11Update testsVadim Petrochenkov-12/+12
2019-03-02Point at enum definition when match patterns are not exhaustiveEsteban Küber-17/+19
``` error[E0004]: non-exhaustive patterns: type `X` is non-empty --> file.rs:9:11 | 1 | / enum X { 2 | | A, | | - variant not covered 3 | | B, | | - variant not covered 4 | | C, | | - variant not covered 5 | | } | |_- `X` defined here ... 9 | match x { | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` and `C` not covered --> file.rs:11:11 | 1 | / enum X { 2 | | A, 3 | | B, 4 | | C, | | - not covered 5 | | } | |_- `X` defined here ... 11 | match x { | ^ patterns `C` not covered ``` When a match expression doesn't have patterns covering every variant, point at the enum's definition span. On a best effort basis, point at the variant(s) that are missing. This does not handle the case when the missing pattern is due to a field's enum variants: ``` enum E1 { A, B, C, } enum E2 { A(E1), B, } fn foo() { match E2::A(E1::A) { E2::A(E1::B) => {} E2::B => {} } //~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled } ``` Unify look between match with no arms and match with some missing patterns. Fix #37518.
2018-12-25Remove licensesMark Rousskov-58/+18
2018-12-11Update testsvarkor-2/+2
2018-12-11Restore old match behaviourvarkor-3/+27
2018-12-11Make liveness analysis respect privacyvarkor-2/+3