Commit c5a4e07 1 parent d1f1075 commit c5a4e07 Copy full SHA for c5a4e07
File tree 1 file changed +8
-5
lines changed
tests/ui/rfcs/rfc-0000-never_patterns
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -9,21 +9,24 @@ enum Void {}
9
9
10
10
// A never pattern alone diverges.
11
11
12
- fn never_arg ( !: Void ) -> u32 { }
12
+ fn never_arg ( !: Void ) -> ! { }
13
13
14
- fn ref_never_arg ( & !: & Void ) -> u32 { }
14
+ fn never_arg_returns_anything < T > ( !: Void ) -> T { }
15
15
16
- fn never_let ( ) -> u32 {
16
+ fn ref_never_arg ( & !: & Void ) -> ! { }
17
+
18
+ fn never_let ( ) -> ! {
17
19
let ptr: * const Void = std:: ptr:: null ( ) ;
18
20
unsafe {
19
21
let ! = * ptr;
20
22
}
21
23
}
22
24
23
- fn never_match ( ) -> u32 {
25
+ fn never_match ( ) -> ! {
24
26
let ptr: * const Void = std:: ptr:: null ( ) ;
25
27
unsafe {
26
28
match * ptr { ! } ;
27
29
}
28
- println ! ( ) ; // Ensures this typechecks because of divergence.
30
+ // Ensures this typechecks because of divergence and not the type of the match expression.
31
+ println ! ( ) ;
29
32
}
You can’t perform that action at this time.
0 commit comments