@@ -33,7 +33,7 @@ fn test_stable_mir() -> ControlFlow<()> {
33
33
// Get all items and split generic vs monomorphic items.
34
34
let ( generic, mono) : ( Vec < _ > , Vec < _ > ) =
35
35
items. into_iter ( ) . partition ( |item| item. requires_monomorphization ( ) ) ;
36
- assert_eq ! ( mono. len( ) , 3 , "Expected 2 mono functions and one constant" ) ;
36
+ assert_eq ! ( mono. len( ) , 4 , "Expected 2 mono functions and one constant" ) ;
37
37
assert_eq ! ( generic. len( ) , 2 , "Expected 2 generic functions" ) ;
38
38
39
39
// For all monomorphic items, get the correspondent instances.
@@ -57,8 +57,9 @@ fn test_body(body: mir::Body) {
57
57
for term in body. blocks . iter ( ) . map ( |bb| & bb. terminator ) {
58
58
match & term. kind {
59
59
Call { func, .. } => {
60
- let TyKind :: RigidTy ( ty) = func. ty ( body. locals ( ) ) . unwrap ( ) . kind ( ) else { unreachable !
61
- ( ) } ;
60
+ let TyKind :: RigidTy ( ty) = func. ty ( body. locals ( ) ) . unwrap ( ) . kind ( ) else {
61
+ unreachable ! ( )
62
+ } ;
62
63
let RigidTy :: FnDef ( def, args) = ty else { unreachable ! ( ) } ;
63
64
let instance = Instance :: resolve ( def, & args) . unwrap ( ) ;
64
65
let mangled_name = instance. mangled_name ( ) ;
@@ -102,6 +103,9 @@ fn generate_input(path: &str) -> std::io::Result<()> {
102
103
write ! (
103
104
file,
104
105
r#"
106
+
107
+ struct Foo(());
108
+
105
109
pub fn ty_param<T>(t: &T) -> T where T: Clone {{
106
110
t.clone()
107
111
}}
@@ -116,6 +120,7 @@ fn generate_input(path: &str) -> std::io::Result<()> {
116
120
}}
117
121
118
122
pub fn monomorphic() {{
123
+ Foo(());
119
124
let v = vec![10];
120
125
let dup = ty_param(&v);
121
126
assert_eq!(v, dup);
0 commit comments