1 // compile-flags: --crate-type lib
4 // Regression test for issue #84399
5 // Tests that we keep the full `ParamEnv` when
6 // caching predicates with freshened types in the global cache
8 use std::marker::PhantomData;
9 pub trait Allocator<R> {
12 pub struct DefaultAllocator;
13 impl <R> Allocator<R> for DefaultAllocator {
16 pub type Owned<R> = <DefaultAllocator as Allocator<R>>::Buffer;
17 pub type MatrixMN<R> = Matrix<R, Owned<R>>;
18 pub type Matrix4<N> = Matrix<N, ()>;
19 pub struct Matrix<R, S> {
21 _phantoms: PhantomData<R>,
23 pub fn set_object_transform(matrix: &Matrix4<()>) {
24 matrix.js_buffer_view();
28 fn slice_to_items(_buffer: &()) -> &[Self::Cell] {
32 pub type Cell<T> = <T as Storable>::Cell;
33 impl<R> Storable for MatrixMN<R>
35 DefaultAllocator: Allocator<R>,
39 pub trait JsBufferView {
40 fn js_buffer_view(&self) -> usize {
44 impl<R> JsBufferView for [MatrixMN<R>]
46 DefaultAllocator: Allocator<R>,
47 MatrixMN<R>: Storable,
48 [Cell<MatrixMN<R>>]: JsBufferView,
50 fn js_buffer_view(&self) -> usize {
51 <MatrixMN<R> as Storable>::slice_to_items(&()).js_buffer_view()
54 impl JsBufferView for [()] {}
55 impl<R> JsBufferView for MatrixMN<R> where DefaultAllocator: Allocator<R> {}