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

Commit

Permalink
Add a few ICEs (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanninpm authored Apr 23, 2021
1 parent 69c5ead commit 5c70b0d
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
50 changes: 50 additions & 0 deletions ices/84399.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#![crate_type = "lib"]

use std::marker::PhantomData;
pub trait Allocator<R> {
type Buffer;
}
pub struct DefaultAllocator;
impl <R> Allocator<R> for DefaultAllocator {
type Buffer = ();
}
pub type Owned<R> = <DefaultAllocator as Allocator<R>>::Buffer;
pub type MatrixMN<R> = Matrix<R, Owned<R>>;
pub type Matrix4<N> = Matrix<N, ()>;
pub struct Matrix<R, S> {
pub data: S,
_phantoms: PhantomData<R>,
}
pub fn set_object_transform(matrix: &Matrix4<()>) {
matrix.js_buffer_view();
}
pub trait Storable {
type Cell;
fn slice_to_items(_buffer: &()) -> &[Self::Cell] {
unimplemented!()
}
}
pub type Cell<T> = <T as Storable>::Cell;
impl<R> Storable for MatrixMN<R>
where
DefaultAllocator: Allocator<R>,
{
type Cell = ();
}
pub trait JsBufferView {
fn js_buffer_view(&self) -> usize {
unimplemented!()
}
}
impl<R> JsBufferView for [MatrixMN<R>]
where
DefaultAllocator: Allocator<R>,
MatrixMN<R>: Storable,
[Cell<MatrixMN<R>>]: JsBufferView,
{
fn js_buffer_view(&self) -> usize {
<MatrixMN<R> as Storable>::slice_to_items(&()).js_buffer_view()
}
}
impl JsBufferView for [()] {}
impl<R> JsBufferView for MatrixMN<R> where DefaultAllocator: Allocator<R> {}
31 changes: 31 additions & 0 deletions ices/84408.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#![feature(const_generics, const_evaluatable_checked)]
#![allow(incomplete_features)]

trait Melon<const X: usize> {
fn new(arr: [i32; X]) -> Self;
fn change<T: Melon<X>>(self) -> T;
}

struct Foo([i32; 5]);
struct Bar<const A: usize, const B: usize>([i32; A + B])
where [(); A + B]: ;

impl Melon<5> for Foo {
fn new(arr: [i32; 5]) -> Self {
Foo(arr)
}
fn change<T: Melon<5>>(self) -> T {
T::new(self.0)
}
}

impl<const A: usize, const B: usize> Melon<{A + B}> for Bar<A, B>
where [(); A + B]: ,
{
fn new(arr: [i32; A + B]) -> Self {
Bar(arr)
}
fn change<T: Melon<{A + B}>>(self) -> T {
T::new(self.0)
}
}
14 changes: 14 additions & 0 deletions ices/84434.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![crate_type = "lib"]
use std::path::Path;
struct A {
pub func: fn(check: bool, a: &Path, b: Option<&Path>),
}
const MY_A: A = A {
func: |check, a, b| {
if check {
let _ = ();
} else if let Some(parent) = b.and_then(|p| p.parent()) {
let _ = ();
}
},
};

0 comments on commit 5c70b0d

Please sign in to comment.