Skip to content

Commit

Permalink
add 2 ices
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jun 22, 2022
1 parent 6550e6b commit 766291a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ices/98322.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#![feature(generic_const_exprs)]

// Main function seems irrelevant
fn main() {}

// Constant must be provided via an associated constant in a trait
pub trait ConstTrait {
const ASSOC_CONST: usize;
}

// For some reason I find it's necessary to have an implementation of this trait that recurses
pub trait OtherTrait
{
fn comm(self);
}

// There must be a blanket impl here
impl<T> OtherTrait for T where
T: ConstTrait,
[();T::ASSOC_CONST]: Sized,
{
fn comm(self) {
todo!()
}
}

// The struct must be recursive
pub struct RecursiveStruct(Box<RecursiveStruct>);

// This implementation must exist, and it must recurse into its child
impl OtherTrait for RecursiveStruct {
fn comm(self) {
(self.0).comm();
}
}

38 changes: 38 additions & 0 deletions ices/98372.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#![feature(
no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
untagged_unions, decl_macro, rustc_attrs, transparent_unions, auto_traits,
thread_local
)]
#![no_core]

#[lang = "sized"]
pub trait Sized {}

#[lang = "unsize"]
pub trait Unsize<T: ?Sized> {}

#[lang = "coerce_unsized"]
pub trait CoerceUnsized<T> {}

#[lang = "copy"]
pub trait Copy {}

#[lang = "sync"]
pub unsafe trait Sync {}

unsafe impl Sync for [u8; 16] {}

pub trait Allocator {
}

pub struct Global;

impl Allocator for Global {}

#[lang = "owned_box"]
pub struct Box<
T: ?Sized,
A: Allocator = Global,
>(*mut T, A);

pub fn main() {}

0 comments on commit 766291a

Please sign in to comment.