From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/traits/issue-84399-bad-fresh-caching.rs | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/ui/traits/issue-84399-bad-fresh-caching.rs (limited to 'tests/ui/traits/issue-84399-bad-fresh-caching.rs') diff --git a/tests/ui/traits/issue-84399-bad-fresh-caching.rs b/tests/ui/traits/issue-84399-bad-fresh-caching.rs new file mode 100644 index 000000000..149400156 --- /dev/null +++ b/tests/ui/traits/issue-84399-bad-fresh-caching.rs @@ -0,0 +1,55 @@ +// compile-flags: --crate-type lib +// check-pass +// +// Regression test for issue #84399 +// Tests that we keep the full `ParamEnv` when +// caching predicates with freshened types in the global cache + +use std::marker::PhantomData; +pub trait Allocator { + type Buffer; +} +pub struct DefaultAllocator; +impl Allocator for DefaultAllocator { + type Buffer = (); +} +pub type Owned = >::Buffer; +pub type MatrixMN = Matrix>; +pub type Matrix4 = Matrix; +pub struct Matrix { + pub data: S, + _phantoms: PhantomData, +} +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 = ::Cell; +impl Storable for MatrixMN +where + DefaultAllocator: Allocator, +{ + type Cell = (); +} +pub trait JsBufferView { + fn js_buffer_view(&self) -> usize { + unimplemented!() + } +} +impl JsBufferView for [MatrixMN] +where + DefaultAllocator: Allocator, + MatrixMN: Storable, + [Cell>]: JsBufferView, +{ + fn js_buffer_view(&self) -> usize { + as Storable>::slice_to_items(&()).js_buffer_view() + } +} +impl JsBufferView for [()] {} +impl JsBufferView for MatrixMN where DefaultAllocator: Allocator {} -- cgit v1.2.3