@@ -24,11 +24,11 @@ use rustc_smir::rustc_internal;
24
24
use stable_mir:: mir:: mono:: { Instance , InstanceKind } ;
25
25
use stable_mir:: mir:: visit:: { Location , MirVisitor } ;
26
26
use stable_mir:: mir:: { LocalDecl , Terminator , TerminatorKind } ;
27
- use stable_mir:: ty:: { FnDef , GenericArgs , IntrinsicDef , RigidTy , TyKind } ;
27
+ use stable_mir:: ty:: { FnDef , GenericArgs , RigidTy , TyKind } ;
28
+ use std:: assert_matches:: assert_matches;
28
29
use std:: convert:: TryFrom ;
29
30
use std:: io:: Write ;
30
31
use std:: ops:: ControlFlow ;
31
- use std:: assert_matches:: assert_matches;
32
32
33
33
/// This function tests that we can correctly get type information from binary operations.
34
34
fn test_intrinsics ( ) -> ControlFlow < ( ) > {
@@ -41,9 +41,9 @@ fn test_intrinsics() -> ControlFlow<()> {
41
41
42
42
let calls = visitor. calls ;
43
43
assert_eq ! ( calls. len( ) , 3 , "Expected 3 calls, but found: {calls:?}" ) ;
44
- for ( fn_def, args) in & calls {
45
- check_instance ( & Instance :: resolve ( * fn_def, & args) . unwrap ( ) ) ;
46
- check_def ( fn_def. as_intrinsic ( ) . unwrap ( ) ) ;
44
+ for ( fn_def, args) in calls. into_iter ( ) {
45
+ check_instance ( & Instance :: resolve ( fn_def, & args) . unwrap ( ) ) ;
46
+ check_def ( fn_def) ;
47
47
}
48
48
49
49
ControlFlow :: Continue ( ( ) )
@@ -68,7 +68,11 @@ fn check_instance(instance: &Instance) {
68
68
}
69
69
}
70
70
71
- fn check_def ( intrinsic : IntrinsicDef ) {
71
+ fn check_def ( fn_def : FnDef ) {
72
+ assert ! ( fn_def. is_intrinsic( ) ) ;
73
+ let intrinsic = fn_def. as_intrinsic ( ) . unwrap ( ) ;
74
+ assert_eq ! ( fn_def, intrinsic. into( ) ) ;
75
+
72
76
let name = intrinsic. fn_name ( ) ;
73
77
match name. as_str ( ) {
74
78
"likely" | "size_of_val" => {
0 commit comments