File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ use std:: marker:: PhantomData ;
2
+
3
+ pub struct NfaBuilder < ' brand > {
4
+ brand : PhantomData < & ' brand mut & ' brand mut ( ) > ,
5
+ }
6
+
7
+ impl NfaBuilder < ' _ > {
8
+ pub fn with < R , F : FnOnce ( NfaBuilder < ' _ > ) -> R > ( f : F ) -> R {
9
+ Brand :: with ( |brand| {
10
+ // This should be using NfaBuilder instead of Self becuase they have diffrent lifetime constraints
11
+ f ( Self {
12
+ brand : brand. lt ,
13
+ } )
14
+ } )
15
+ }
16
+ }
17
+
18
+ #[ derive( Clone , Copy ) ]
19
+ pub struct Brand < ' brand > {
20
+ lt : PhantomData < & ' brand mut & ' brand mut ( ) > ,
21
+ }
22
+
23
+ impl Brand < ' _ > {
24
+ pub fn with < R , F : FnOnce ( Brand < ' _ > ) -> R > ( f : F ) -> R {
25
+ f ( Self { lt : PhantomData } )
26
+ }
27
+ }
28
+
29
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ #![ crate_type = "lib" ]
2
+ #![ feature( async_fn_in_trait) ]
3
+ trait T {
4
+ async fn foo ( ) ;
5
+ }
You can’t perform that action at this time.
0 commit comments