This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6550e6b
commit c048d45
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |