Skip to content

Commit c08a871

Browse files
Add regression test for #65348
1 parent 8fd16ba commit c08a871

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/test/ui/consts/issue-65348.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
3+
struct Generic<T>(T);
4+
5+
impl<T> Generic<T> {
6+
const ARRAY: [T; 0] = [];
7+
const NEWTYPE_ARRAY: Generic<[T; 0]> = Generic([]);
8+
const ARRAY_FIELD: Generic<(i32, [T; 0])> = Generic((0, []));
9+
}
10+
11+
pub const fn array<T>() -> &'static T {
12+
&Generic::<T>::ARRAY[0]
13+
}
14+
15+
pub const fn newtype_array<T>() -> &'static T {
16+
&Generic::<T>::NEWTYPE_ARRAY.0[0]
17+
}
18+
19+
pub const fn array_field<T>() -> &'static T {
20+
&(Generic::<T>::ARRAY_FIELD.0).1[0]
21+
}
22+
23+
fn main() {}

0 commit comments

Comments
 (0)