Rollup merge of #109968 - JohnTitor:issue-80409, r=compiler-errors

Add regression test for #80409

r? ``@compiler-errors``
Closes #80409
This commit is contained in:
Yuki Okushi 2023-04-06 07:18:31 +09:00 committed by GitHub
commit 1424268a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,36 @@
// check-pass
#![allow(unreachable_code, unused)]
use std::marker::PhantomData;
struct FsmBuilder<TFsm> {
_fsm: PhantomData<TFsm>,
}
impl<TFsm> FsmBuilder<TFsm> {
fn state(&mut self) -> FsmStateBuilder<TFsm> {
todo!()
}
}
struct FsmStateBuilder<TFsm> {
_state: PhantomData<TFsm>,
}
impl<TFsm> FsmStateBuilder<TFsm> {
fn on_entry<TAction: Fn(&mut StateContext<'_, TFsm>)>(&self, _action: TAction) {}
}
trait Fsm {
type Context;
}
struct StateContext<'a, TFsm: Fsm> {
context: &'a mut TFsm::Context,
}
fn main() {
let mut builder: FsmBuilder<usize> = todo!();
builder.state().on_entry(|_| {});
}