Skip to content

Commit

Permalink
Rollup merge of rust-lang#109968 - JohnTitor:issue-80409, r=compiler-…
Browse files Browse the repository at this point in the history
…errors

Add regression test for rust-lang#80409

r? `@compiler-errors`
Closes rust-lang#80409
  • Loading branch information
matthiaskrgr authored Apr 5, 2023
2 parents 4cb92cc + 2df3f49 commit 9349cb0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/ui/inference/issue-80409.rs
Original file line number Diff line number Diff line change
@@ -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(|_| {});
}

0 comments on commit 9349cb0

Please sign in to comment.