]> git.lizzy.rs Git - rust.git/blob - tests/ui/typeck/issue-72225-call-fnmut-through-derefmut.rs
Rollup merge of #106570 - Xaeroxe:div-duration-tests, r=JohnTitor
[rust.git] / tests / ui / typeck / issue-72225-call-fnmut-through-derefmut.rs
1 // check-pass
2
3 // rust-lang/rust#72225: confusing diagnostics when calling FnMut through DerefMut.
4
5 use std::cell::RefCell;
6
7 struct S {
8     f: Box<dyn FnMut()>
9 }
10
11 fn test(s: &RefCell<S>) {
12     let mut guard = s.borrow_mut();
13     (guard.f)();
14 }
15
16 fn main() {
17     let s = RefCell::new(S {
18         f: Box::new(|| ())
19     });
20     test(&s);
21 }