4
4
// ignore-stage1
5
5
// ignore-cross-compile
6
6
// ignore-remote
7
+ // ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
7
8
// edition: 2021
8
9
9
10
#![ feature( rustc_private) ]
13
14
extern crate rustc_middle;
14
15
#[ macro_use]
15
16
extern crate rustc_smir;
16
- extern crate stable_mir;
17
17
extern crate rustc_driver;
18
18
extern crate rustc_interface;
19
+ extern crate stable_mir;
19
20
20
21
use rustc_middle:: ty:: TyCtxt ;
21
22
22
- use stable_mir:: * ;
23
23
use rustc_smir:: rustc_internal;
24
+ use stable_mir:: * ;
24
25
use std:: io:: Write ;
25
26
use std:: ops:: ControlFlow ;
26
27
@@ -31,16 +32,16 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
31
32
let items = stable_mir:: all_local_items ( ) ;
32
33
33
34
// Get all items and split generic vs monomorphic items.
34
- let ( generic, mono) : ( Vec < _ > , Vec < _ > ) = items. into_iter ( ) . partition ( |item| {
35
- item. requires_monomorphization ( )
36
- } ) ;
35
+ let ( generic, mono) : ( Vec < _ > , Vec < _ > ) =
36
+ items. into_iter ( ) . partition ( |item| item. requires_monomorphization ( ) ) ;
37
37
assert_eq ! ( mono. len( ) , 3 , "Expected 2 mono functions and one constant" ) ;
38
38
assert_eq ! ( generic. len( ) , 2 , "Expected 2 generic functions" ) ;
39
39
40
40
// For all monomorphic items, get the correspondent instances.
41
- let instances = mono. iter ( ) . filter_map ( |item| {
42
- mir:: mono:: Instance :: try_from ( * item) . ok ( )
43
- } ) . collect :: < Vec < mir:: mono:: Instance > > ( ) ;
41
+ let instances = mono
42
+ . iter ( )
43
+ . filter_map ( |item| mir:: mono:: Instance :: try_from ( * item) . ok ( ) )
44
+ . collect :: < Vec < mir:: mono:: Instance > > ( ) ;
44
45
assert_eq ! ( instances. len( ) , mono. len( ) ) ;
45
46
46
47
// For all generic items, try_from should fail.
@@ -49,7 +50,6 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
49
50
ControlFlow :: Continue ( ( ) )
50
51
}
51
52
52
-
53
53
/// This test will generate and analyze a dummy crate using the stable mir.
54
54
/// For that, it will first write the dummy crate into a file.
55
55
/// Then it will create a `StableMir` using custom arguments and then
0 commit comments