Skip to content

Commit 9461852

Browse files
committed
Add regression test
1 parent 72cbb8b commit 9461852

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/ui-fulldeps/stable-mir/check_instance.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn test_stable_mir() -> ControlFlow<()> {
3333
// Get all items and split generic vs monomorphic items.
3434
let (generic, mono): (Vec<_>, Vec<_>) =
3535
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");
3737
assert_eq!(generic.len(), 2, "Expected 2 generic functions");
3838

3939
// For all monomorphic items, get the correspondent instances.
@@ -57,8 +57,9 @@ fn test_body(body: mir::Body) {
5757
for term in body.blocks.iter().map(|bb| &bb.terminator) {
5858
match &term.kind {
5959
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+
};
6263
let RigidTy::FnDef(def, args) = ty else { unreachable!() };
6364
let instance = Instance::resolve(def, &args).unwrap();
6465
let mangled_name = instance.mangled_name();
@@ -102,6 +103,9 @@ fn generate_input(path: &str) -> std::io::Result<()> {
102103
write!(
103104
file,
104105
r#"
106+
107+
struct Foo(());
108+
105109
pub fn ty_param<T>(t: &T) -> T where T: Clone {{
106110
t.clone()
107111
}}
@@ -116,6 +120,7 @@ fn generate_input(path: &str) -> std::io::Result<()> {
116120
}}
117121
118122
pub fn monomorphic() {{
123+
Foo(());
119124
let v = vec![10];
120125
let dup = ty_param(&v);
121126
assert_eq!(v, dup);

0 commit comments

Comments
 (0)