Skip to content

Commit 7242c65

Browse files
committed
Fail to test argument instantiation since we don't have types for most constants
1 parent caf2f33 commit 7242c65

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/ui-fulldeps/stable-mir/crate-info.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,23 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
108108
stable_mir::mir::Terminator::Assert { .. } => {}
109109
other => panic!("{other:?}"),
110110
}
111+
112+
let monomorphic = get_item(tcx, &items, (DefKind::Fn, "monomorphic")).unwrap();
113+
for block in monomorphic.body().blocks {
114+
match &block.terminator {
115+
stable_mir::mir::Terminator::Call { func, .. } => match func {
116+
stable_mir::mir::Operand::Constant(c) => match &c.literal {
117+
stable_mir::ty::ConstantKind::Allocated(alloc) => {
118+
assert!(alloc.bytes.is_empty())
119+
}
120+
other => panic!("{other:?}"),
121+
},
122+
other => panic!("{other:?}"),
123+
},
124+
stable_mir::mir::Terminator::Return => {}
125+
other => panic!("{other:?}"),
126+
}
127+
}
111128
}
112129

113130
// Use internal API to find a function in a crate.
@@ -144,6 +161,16 @@ fn generate_input(path: &str) -> std::io::Result<()> {
144161
write!(
145162
file,
146163
r#"
164+
fn generic<T, const U: usize>(t: T) -> [(); U] {{
165+
_ = t;
166+
[(); U]
167+
}}
168+
169+
pub fn monomorphic() {{
170+
generic::<(), 5>(());
171+
generic::<u32, 0>(45);
172+
}}
173+
147174
mod foo {{
148175
pub fn bar(i: i32) -> i64 {{
149176
i as i64

0 commit comments

Comments
 (0)