]>
git.proxmox.com Git - rustc.git/blob - src/test/incremental/issue-85360-eval-obligation-ice.rs
1 // revisions:cfail1 cfail2
2 //[cfail1] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=not-loaded
3 //[cfail2] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=loaded
7 use core
::marker
::PhantomData
;
9 struct DerefWrap
<T
>(T
);
11 impl<T
> core
::ops
::Deref
for DerefWrap
<T
> {
13 fn deref(&self) -> &Self::Target
{
18 struct Storage
<T
, D
> {
19 phantom
: PhantomData
<(T
, D
)>,
22 type ReadStorage
<T
> = Storage
<T
, DerefWrap
<MaskedStorage
<T
>>>;
32 impl Component
for Pos
{
33 type Storage
= VecStorage
;
36 struct GenericComp
<T
> {
40 impl<T
: '
static> Component
for GenericComp
<T
> {
41 type Storage
= VecStorage
;
44 pos_interpdata
: ReadStorage
<GenericComp
<Pos
>>,
50 fn run(data
: Self::SystemData
, any
: Box
<dyn Any
>);
56 type SystemData
= (ReadData
, ReadStorage
<Pos
>);
58 fn run((data
, pos
): Self::SystemData
, any
: Box
<dyn Any
>) {
59 <ReadStorage
<GenericComp
<Pos
>> as SystemData
>::setup(any
);
61 ParJoin
::par_join((&pos
, &data
.pos_interpdata
));
73 impl<'a
, T
, D
> ParJoin
for &'a Storage
<T
, D
>
76 D
: core
::ops
::Deref
<Target
= MaskedStorage
<T
>>,
81 impl<A
, B
> ParJoin
for (A
, B
)
88 pub trait SystemData
{
89 fn setup(any
: Box
<dyn Any
>);
92 impl<T
: '
static> SystemData
for ReadStorage
<T
>
96 fn setup(any
: Box
<dyn Any
>) {
97 let storage
: &MaskedStorage
<T
> = any
.downcast_ref().unwrap();
99 <dyn Any
as CastFrom
<MaskedStorage
<T
>>>::cast(&storage
);
103 pub struct MaskedStorage
<T
: Component
> {
107 pub unsafe trait CastFrom
<T
> {
108 fn cast(t
: &T
) -> &Self;
111 unsafe impl<T
> CastFrom
<T
> for dyn Any
115 fn cast(t
: &T
) -> &Self {