Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs b/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs index ff1eeb0516..f20b6dea12 100644 --- a/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs +++ b/crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs @@ -14,6 +14,7 @@ pub(crate) fn non_exhaustive_let( format!("non-exhaustive pattern: {}", d.uncovered_patterns), d.pat.map(Into::into), ) + .stable() } #[cfg(test)] @@ -105,4 +106,29 @@ fn test(x: Result<i32, &'static !>) { "#, ); } + + #[test] + fn empty_patterns_normalize() { + check_diagnostics( + r#" +enum Infallible {} + +trait Foo { + type Assoc; +} +enum Enum<T: Foo> { + A, + B(T::Assoc), +} + +impl Foo for () { + type Assoc = Infallible; +} + +fn foo(v: Enum<()>) { + let Enum::A = v; +} + "#, + ); + } } |