Skip to content

Commit f6517ca

Browse files
committed
Fix error in libgccjit12 while creating an array type
1 parent 0cbf2b9 commit f6517ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/type_.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
200200
value.get_type()
201201
}
202202

203-
fn type_array(&self, ty: Type<'gcc>, len: u64) -> Type<'gcc> {
203+
#[cfg_attr(feature="master", allow(unused_mut))]
204+
fn type_array(&self, ty: Type<'gcc>, mut len: u64) -> Type<'gcc> {
204205
// TODO: remove this as well?
205206
/*if let Some(struct_type) = ty.is_struct() {
206207
if struct_type.get_field_count() == 0 {
@@ -212,6 +213,12 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
212213
}
213214
}*/
214215

216+
// NOTE: see note above. Some other test uses usize::MAX.
217+
#[cfg(not(feature="master"))]
218+
if len == u64::MAX {
219+
len = 0;
220+
}
221+
215222
self.context.new_array_type(None, ty, len)
216223
}
217224
}

0 commit comments

Comments
 (0)