Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit b8c8fb0

Browse files
authored
Merge pull request #457 from JohnTitor/add-ices
Add 5 ICEs
2 parents cd8671b + 16442cc commit b8c8fb0

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

ices/75153.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub const fn is_zst<T: ?Sized>() -> usize {
2+
if std::mem::size_of::<T>() == 0 {
3+
1
4+
} else {
5+
0
6+
}
7+
}
8+
9+
pub struct AtLeastByte<T: ?Sized> {
10+
value: T,
11+
pad: [u8; is_zst::<T>()],
12+
}
13+
14+
fn main() {}

ices/75158.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct S<T> { x: [T; !0] }
2+
3+
pub fn f() -> usize {
4+
std::mem::size_of::<S<u8>>()
5+
}
6+
7+
fn main() {
8+
let x = f();
9+
}

ices/75299.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
rustc -Z mir-opt-level=3 - << EOF
4+
#![feature(const_generics, box_syntax)]
5+
#![allow(incomplete_features)]
6+
7+
fn main() {
8+
fn foo<const N: usize>() {
9+
box [0; N];
10+
}
11+
foo::<1>();
12+
}
13+
14+
EOF

ices/75323.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(min_const_generics)]
2+
3+
fn test<const N: usize>() {}
4+
5+
fn wow<'a>() -> &'a () {
6+
test::<
7+
{
8+
let _: &'a ();
9+
3
10+
},
11+
>();
12+
&()
13+
}

ices/75415.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![allow(incomplete_features)]
2+
#![feature(generic_associated_types)]
3+
#![feature(const_generics)]
4+
5+
pub trait Buffer<const T: usize> {}
6+
7+
pub trait Device {
8+
type Buffer<const T: usize>: Buffer<{ T }>;
9+
10+
fn create_buffer<const T: usize>(&self) -> Option<Self::Buffer<{ T }>>;
11+
}
12+
13+
fn main() {}

0 commit comments

Comments
 (0)