Skip to content

Commit 7f009e5

Browse files
committed
Fail to test argument instantiation since we don't have types for most constants
1 parent b43e3b9 commit 7f009e5

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
@@ -110,6 +110,23 @@ fn test_stable_mir(tcx: TyCtxt<'_>) -> ControlFlow<()> {
110110
other => panic!("{other:?}"),
111111
}
112112

113+
let monomorphic = get_item(tcx, &items, (DefKind::Fn, "monomorphic")).unwrap();
114+
for block in monomorphic.body().blocks {
115+
match &block.terminator {
116+
stable_mir::mir::Terminator::Call { func, .. } => match func {
117+
stable_mir::mir::Operand::Constant(c) => match &c.literal {
118+
stable_mir::ty::ConstantKind::Allocated(alloc) => {
119+
assert!(alloc.bytes.is_empty())
120+
}
121+
other => panic!("{other:?}"),
122+
},
123+
other => panic!("{other:?}"),
124+
},
125+
stable_mir::mir::Terminator::Return => {}
126+
other => panic!("{other:?}"),
127+
}
128+
}
129+
113130
ControlFlow::Continue(())
114131
}
115132

@@ -147,6 +164,16 @@ fn generate_input(path: &str) -> std::io::Result<()> {
147164
write!(
148165
file,
149166
r#"
167+
fn generic<T, const U: usize>(t: T) -> [(); U] {{
168+
_ = t;
169+
[(); U]
170+
}}
171+
172+
pub fn monomorphic() {{
173+
generic::<(), 5>(());
174+
generic::<u32, 0>(45);
175+
}}
176+
150177
mod foo {{
151178
pub fn bar(i: i32) -> i64 {{
152179
i as i64

0 commit comments

Comments
 (0)