aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/_match.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/_match.rs')
-rw-r--r--crates/ra_hir_ty/src/_match.rs39
1 files changed, 18 insertions, 21 deletions
diff --git a/crates/ra_hir_ty/src/_match.rs b/crates/ra_hir_ty/src/_match.rs
index 149f65042..3e6e1e333 100644
--- a/crates/ra_hir_ty/src/_match.rs
+++ b/crates/ra_hir_ty/src/_match.rs
@@ -1946,6 +1946,23 @@ mod tests {
1946 1946
1947 check_no_diagnostic(content); 1947 check_no_diagnostic(content);
1948 } 1948 }
1949
1950 #[test]
1951 fn expr_diverges_missing_arm() {
1952 let content = r"
1953 enum Either {
1954 A,
1955 B,
1956 }
1957 fn test_fn() {
1958 match loop {} {
1959 Either::A => (),
1960 }
1961 }
1962 ";
1963
1964 check_no_diagnostic(content);
1965 }
1949} 1966}
1950 1967
1951#[cfg(test)] 1968#[cfg(test)]
@@ -1998,26 +2015,6 @@ mod false_negatives {
1998 } 2015 }
1999 2016
2000 #[test] 2017 #[test]
2001 fn expr_diverges_missing_arm() {
2002 let content = r"
2003 enum Either {
2004 A,
2005 B,
2006 }
2007 fn test_fn() {
2008 match loop {} {
2009 Either::A => (),
2010 }
2011 }
2012 ";
2013
2014 // This is a false negative.
2015 // Even though the match expression diverges, rustc fails
2016 // to compile here since `Either::B` is missing.
2017 check_no_diagnostic(content);
2018 }
2019
2020 #[test]
2021 fn expr_loop_missing_arm() { 2018 fn expr_loop_missing_arm() {
2022 let content = r" 2019 let content = r"
2023 enum Either { 2020 enum Either {
@@ -2035,7 +2032,7 @@ mod false_negatives {
2035 // We currently infer the type of `loop { break Foo::A }` to `!`, which 2032 // We currently infer the type of `loop { break Foo::A }` to `!`, which
2036 // causes us to skip the diagnostic since `Either::A` doesn't type check 2033 // causes us to skip the diagnostic since `Either::A` doesn't type check
2037 // with `!`. 2034 // with `!`.
2038 check_no_diagnostic(content); 2035 check_diagnostic(content);
2039 } 2036 }
2040 2037
2041 #[test] 2038 #[test]