File tree Expand file tree Collapse file tree 1 file changed +18
-21
lines changed Expand file tree Collapse file tree 1 file changed +18
-21
lines changed Original file line number Diff line number Diff line change @@ -1946,6 +1946,23 @@ mod tests {
19461946
19471947 check_no_diagnostic ( content) ;
19481948 }
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+ }
19491966}
19501967
19511968#[ cfg( test) ]
@@ -1997,26 +2014,6 @@ mod false_negatives {
19972014 check_no_diagnostic ( content) ;
19982015 }
19992016
2000- #[ 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-
20202017 #[ test]
20212018 fn expr_loop_missing_arm ( ) {
20222019 let content = r"
@@ -2035,7 +2032,7 @@ mod false_negatives {
20352032 // We currently infer the type of `loop { break Foo::A }` to `!`, which
20362033 // causes us to skip the diagnostic since `Either::A` doesn't type check
20372034 // with `!`.
2038- check_no_diagnostic ( content) ;
2035+ check_diagnostic ( content) ;
20392036 }
20402037
20412038 #[ test]
You can’t perform that action at this time.
0 commit comments