]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-70746.rs
Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc
[rust.git] / src / test / ui / issues / issue-70746.rs
1 // check-pass
2
3 pub trait Trait1 {
4     type C;
5 }
6
7 struct T1;
8 impl Trait1 for T1 {
9     type C = usize;
10 }
11 pub trait Callback<T: Trait1>: FnMut(<T as Trait1>::C) {}
12 impl<T: Trait1, F: FnMut(<T as Trait1>::C)> Callback<T> for F {}
13
14 pub struct State<T: Trait1> {
15     callback: Option<Box<dyn Callback<T>>>,
16 }
17 impl<T: Trait1> State<T> {
18     fn new() -> Self {
19         Self { callback: None }
20     }
21     fn test_cb(&mut self, d: <T as Trait1>::C) {
22         (self.callback.as_mut().unwrap())(d)
23     }
24 }
25
26 fn main() {
27     let mut s = State::<T1>::new();
28     s.test_cb(1);
29 }