This repository was archived by the owner on May 23, 2024. It is now read-only.
File tree 3 files changed +60
-0
lines changed 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > foo.rs << 'EOF '
4
+ pub trait Module {
5
+ type Algebra;
6
+ }
7
+
8
+ pub trait ChainComplex {
9
+ type Algebra;
10
+ type Module: Module;
11
+ }
12
+
13
+ pub struct FreeModule<A> {
14
+ foo: A,
15
+ }
16
+
17
+ impl<A> Module for FreeModule<A> {
18
+ type Algebra = A;
19
+ }
20
+
21
+ pub trait FreeChainComplex:
22
+ ChainComplex<Module = FreeModule<<Self as ChainComplex>::Algebra>>
23
+ {
24
+ }
25
+
26
+ pub struct ResolutionHomomorphism<CC2>
27
+ where
28
+ CC2: ChainComplex,
29
+ {
30
+ maps: CC2::Module,
31
+ }
32
+
33
+ pub struct SecondaryResolutionHomomorphism<
34
+ CC2: FreeChainComplex<Algebra = usize>,
35
+ > {
36
+ underlying: ResolutionHomomorphism<CC2>,
37
+ }
38
+ EOF
39
+
40
+ rustdoc foo.rs
Original file line number Diff line number Diff line change
1
+ #![ feature( allocator_api) ]
2
+
3
+ use std:: alloc:: { Allocator , Global , Layout } ;
4
+
5
+ fn main ( ) {
6
+ let layout: Layout = None . unwrap ( ) ;
7
+ let ptr: * mut u8 = Global . allocate ( layout) . unwrap ( ) . as_ptr ( ) as _ ;
8
+ let box_ = unsafe { Box :: from_raw_in ( ptr, & Global ) } ;
9
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( allocator_api) ]
2
+
3
+ use std:: alloc:: { Allocator , Global , Layout } ;
4
+
5
+ fn main ( ) {
6
+ let layout: Layout = None . unwrap ( ) ;
7
+ let ptr: * mut u8 = Global . allocate ( layout) . unwrap ( ) . as_ptr ( ) as _ ;
8
+ let slice: & mut [ u8 ] = unsafe { std:: slice:: from_raw_parts_mut ( ptr, 0 ) } ;
9
+ let box_ = unsafe { Box :: from_raw_in ( slice, & Global ) } ;
10
+ box_. len ( ) ;
11
+ }
You can’t perform that action at this time.
0 commit comments