about summary refs log tree commit diff
path: root/tests/ui/destructuring-assignment
AgeCommit message (Collapse)AuthorLines
2025-07-10cleaned up some testsKivooeo-0/+2
2025-07-01moved testsKivooeo-0/+7
2025-06-02Suppress redundant errorMichael Goulet-12/+2
2025-06-02Don't declare variables in ExprKind::Let in invalid positionsMichael Goulet-0/+33
2025-02-21More sophisticated span trimmingMichael Goulet-3/+2
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-10/+15
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2024-12-09Introduce `default_field_values` featureEsteban Küber-11/+11
Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681. Support default fields in enum struct variant Allow default values in an enum struct variant definition: ```rust pub enum Bar { Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Allow using `..` without a base on an enum struct variant ```rust Bar::Foo { .. } ``` `#[derive(Default)]` doesn't account for these as it is still gating `#[default]` only being allowed on unit variants. Support `#[derive(Default)]` on enum struct variants with all defaulted fields ```rust pub enum Bar { #[default] Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Check for missing fields in typeck instead of mir_build. Expand test with `const` param case (needs `generic_const_exprs` enabled). Properly instantiate MIR const The following works: ```rust struct S<A> { a: Vec<A> = Vec::new(), } S::<i32> { .. } ``` Add lint for default fields that will always fail const-eval We *allow* this to happen for API writers that might want to rely on users' getting a compile error when using the default field, different to the error that they would get when the field isn't default. We could change this to *always* error instead of being a lint, if we wanted. This will *not* catch errors for partially evaluated consts, like when the expression relies on a const parameter. Suggestions when encountering `Foo { .. }` without `#[feature(default_field_values)]`: - Suggest adding a base expression if there are missing fields. - Suggest enabling the feature if all the missing fields have optional values. - Suggest removing `..` if there are no missing fields.
2024-11-23Update tests for new TRPL chapter orderChris Krycho-1/+1
2024-10-24add third help hint to diagnostic error E0027Duncan Proctor-0/+4
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-8/+8
2024-01-09Add error code for missing base expression in struct update syntaxclubby789-3/+8
2023-12-08Support bare unit structs in destructuring assignmentsMichael Goulet-11/+28
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-07-17add more testsb-naber-24/+3
2023-07-17add test, bless testsb-naber-17/+40
2023-04-27Provide RHS type hint when reporting operator errorMichael Goulet-2/+2
2023-01-30Modify primary span label for E0308Esteban Küber-1/+1
The previous output was unintuitive to users.
2023-01-11Move /src/test to /testsAlbert Larsan-0/+680