File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
tests/ui-fulldeps/stable-mir Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments