2024-01-17 00:10:19 -06:00
|
|
|
// This should not pass, because `usize: Fsm` does not hold. However, it currently ICEs.
|
|
|
|
|
2024-01-19 01:19:18 -06:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
|
|
|
// revisions: compat no-compat
|
|
|
|
//[compat] check-pass
|
|
|
|
//[no-compat] compile-flags: -Zno-implied-bounds-compat
|
|
|
|
//[no-compat] check-fail
|
|
|
|
//[no-compat] known-bug: #80409
|
|
|
|
//[no-compat] failure-status: 101
|
|
|
|
//[no-compat] normalize-stderr-test "note: .*\n\n" -> ""
|
|
|
|
//[no-compat] normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
|
|
|
//[no-compat] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
|
|
|
|
//[no-compat] rustc-env:RUST_BACKTRACE=0
|
2023-04-05 07:20:07 -05:00
|
|
|
|
|
|
|
#![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(|_| {});
|
|
|
|
}
|