Skip to content

Commit 3562248

Browse files
committed
1 parent 95f5628 commit 3562248

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

ices/102209.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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() {}

ices/102219.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![crate_type = "lib"]
2+
#![feature(async_fn_in_trait)]
3+
trait T {
4+
async fn foo();
5+
}

0 commit comments

Comments
 (0)