1 // Regression test for #74429, where we didn't think that a type parameter
6 use std::marker::PhantomData;
9 pub unsafe trait RawData {
13 unsafe impl<A> RawData for OwnedRepr<A> {
17 unsafe impl<'a, A> RawData for ViewRepr<&'a A> {
21 pub struct OwnedRepr<A> {
25 // these Copy impls are not necessary for the repro, but allow the code to compile without error
27 #[derive(Copy, Clone)]
28 pub struct ViewRepr<A> {
32 #[derive(Copy, Clone)]
33 pub struct ArrayBase<S>
37 ptr: NonNull<S::Elem>,
40 pub type Array<A> = ArrayBase<OwnedRepr<A>>;
42 pub type ArrayView<'a, A> = ArrayBase<ViewRepr<&'a A>>;
44 impl<A, S> ArrayBase<S>
48 pub fn index_axis(&self) -> ArrayView<'_, A> {
52 pub fn axis_iter<'a>(&'a self) -> std::iter::Empty<&'a A> {
57 pub fn x<T: Copy>(a: Array<T>) {
58 // drop just avoids a must_use warning
59 drop((0..1).filter(|_| true));
60 let y = a.index_axis();
61 a.axis_iter().for_each(|_| {