Created
April 14, 2018 01:20
-
-
Save bitshifter/afa4a3403802eebf9516ae7c3d174ba8 to your computer and use it in GitHub Desktop.
Minimal reproduction of rustc ICE issue #48638
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::Any; | |
use std::fmt::Debug; | |
use std::marker::PhantomData; | |
// use std::ops::Mul; | |
pub trait Scalar: Copy + PartialEq + Debug + Any {} | |
impl Scalar for f64 {} | |
pub trait Dim: Any + Debug + Copy + PartialEq + Send {} | |
// pub trait DimName : Dim { | |
// type Value: NamedDim<Name = Self>; | |
// } | |
// pub trait NamedDim: Sized + Any/* + Unsigned*/ { | |
// type Name: DimName<Value = Self>; | |
// } | |
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | |
pub struct U1; | |
impl Dim for U1 {} | |
// impl DimName for U1 {} | |
pub unsafe trait ContiguousStorageMut<N: Scalar, R: Dim, C: Dim = U1> { } | |
pub trait Allocator<N: Scalar, R: Dim, C: Dim = U1>: Any + Sized { | |
type Buffer: ContiguousStorageMut<N, R, C> + Clone; | |
} | |
// #[repr(C)] | |
// pub struct MatrixArray<N, R, C> | |
// where | |
// R: DimName, | |
// C: DimName, | |
// R::Value: Mul<C::Value>, | |
// Prod<R::Value, C::Value>: ArrayLength<N>, | |
// { | |
// data: GenericArray<N, Prod<R::Value, C::Value>>, | |
// } | |
pub struct DefaultAllocator; | |
// impl<N, R, C> Allocator<N, R, C> for DefaultAllocator | |
// where | |
// N: Scalar, | |
// R: DimName, | |
// C: DimName, | |
// { | |
// type Buffer = MatrixArray<N, R, C>; | |
// } | |
pub type Owned<N, R, C = U1> = <DefaultAllocator as Allocator<N, R, C>>::Buffer; | |
#[repr(C)] | |
#[derive(Hash, Clone, Copy)] | |
pub struct Matrix<N: Scalar, R: Dim, C: Dim, S> { | |
pub data: S, | |
_phantoms: PhantomData<(N, R, C)>, | |
} | |
#[repr(packed)] | |
struct S { | |
x:Matrix<f64, U1, U1, Owned<f64, U1, U1>>, | |
} | |
fn main() { | |
} |
Author
bitshifter
commented
Apr 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment