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 {
1946
1946
1947
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
1968
#[ cfg( test) ]
@@ -1997,26 +2014,6 @@ mod false_negatives {
1997
2014
check_no_diagnostic ( content) ;
1998
2015
}
1999
2016
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
-
2020
2017
#[ test]
2021
2018
fn expr_loop_missing_arm ( ) {
2022
2019
let content = r"
@@ -2035,7 +2032,7 @@ mod false_negatives {
2035
2032
// We currently infer the type of `loop { break Foo::A }` to `!`, which
2036
2033
// causes us to skip the diagnostic since `Either::A` doesn't type check
2037
2034
// with `!`.
2038
- check_no_diagnostic ( content) ;
2035
+ check_diagnostic ( content) ;
2039
2036
}
2040
2037
2041
2038
#[ test]
You can’t perform that action at this time.
0 commit comments