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

Commit 5c70b0d

Browse files
authored
Add a few ICEs (#725)
1 parent 69c5ead commit 5c70b0d

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

ices/84399.rs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#![crate_type = "lib"]
2+
3+
use std::marker::PhantomData;
4+
pub trait Allocator<R> {
5+
type Buffer;
6+
}
7+
pub struct DefaultAllocator;
8+
impl <R> Allocator<R> for DefaultAllocator {
9+
type Buffer = ();
10+
}
11+
pub type Owned<R> = <DefaultAllocator as Allocator<R>>::Buffer;
12+
pub type MatrixMN<R> = Matrix<R, Owned<R>>;
13+
pub type Matrix4<N> = Matrix<N, ()>;
14+
pub struct Matrix<R, S> {
15+
pub data: S,
16+
_phantoms: PhantomData<R>,
17+
}
18+
pub fn set_object_transform(matrix: &Matrix4<()>) {
19+
matrix.js_buffer_view();
20+
}
21+
pub trait Storable {
22+
type Cell;
23+
fn slice_to_items(_buffer: &()) -> &[Self::Cell] {
24+
unimplemented!()
25+
}
26+
}
27+
pub type Cell<T> = <T as Storable>::Cell;
28+
impl<R> Storable for MatrixMN<R>
29+
where
30+
DefaultAllocator: Allocator<R>,
31+
{
32+
type Cell = ();
33+
}
34+
pub trait JsBufferView {
35+
fn js_buffer_view(&self) -> usize {
36+
unimplemented!()
37+
}
38+
}
39+
impl<R> JsBufferView for [MatrixMN<R>]
40+
where
41+
DefaultAllocator: Allocator<R>,
42+
MatrixMN<R>: Storable,
43+
[Cell<MatrixMN<R>>]: JsBufferView,
44+
{
45+
fn js_buffer_view(&self) -> usize {
46+
<MatrixMN<R> as Storable>::slice_to_items(&()).js_buffer_view()
47+
}
48+
}
49+
impl JsBufferView for [()] {}
50+
impl<R> JsBufferView for MatrixMN<R> where DefaultAllocator: Allocator<R> {}

ices/84408.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#![feature(const_generics, const_evaluatable_checked)]
2+
#![allow(incomplete_features)]
3+
4+
trait Melon<const X: usize> {
5+
fn new(arr: [i32; X]) -> Self;
6+
fn change<T: Melon<X>>(self) -> T;
7+
}
8+
9+
struct Foo([i32; 5]);
10+
struct Bar<const A: usize, const B: usize>([i32; A + B])
11+
where [(); A + B]: ;
12+
13+
impl Melon<5> for Foo {
14+
fn new(arr: [i32; 5]) -> Self {
15+
Foo(arr)
16+
}
17+
fn change<T: Melon<5>>(self) -> T {
18+
T::new(self.0)
19+
}
20+
}
21+
22+
impl<const A: usize, const B: usize> Melon<{A + B}> for Bar<A, B>
23+
where [(); A + B]: ,
24+
{
25+
fn new(arr: [i32; A + B]) -> Self {
26+
Bar(arr)
27+
}
28+
fn change<T: Melon<{A + B}>>(self) -> T {
29+
T::new(self.0)
30+
}
31+
}

ices/84434.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_type = "lib"]
2+
use std::path::Path;
3+
struct A {
4+
pub func: fn(check: bool, a: &Path, b: Option<&Path>),
5+
}
6+
const MY_A: A = A {
7+
func: |check, a, b| {
8+
if check {
9+
let _ = ();
10+
} else if let Some(parent) = b.and_then(|p| p.parent()) {
11+
let _ = ();
12+
}
13+
},
14+
};

0 commit comments

Comments
 (0)