File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ use std:: rc:: Rc ;
2+ type Foo < ' a , T > = & ' a dyn Fn ( & T ) ;
3+ type RcFoo < ' a , T > = Rc < Foo < ' a , T > > ;
4+
5+ fn bar_function < T > ( function : Foo < T > ) -> RcFoo < T > {
6+ //~^ ERROR mismatched types
7+ let rc = Rc :: new ( function) ;
8+ }
9+
10+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/issue-102964.rs:5:41
3+ |
4+ LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
5+ | ------------ ^^^^^^^^ expected struct `Rc`, found `()`
6+ | |
7+ | implicitly returns `()` as its body has no tail or `return` expression
8+ |
9+ = note: expected struct `Rc<&dyn for<'a> Fn(&'a T)>`
10+ found unit type `()`
11+ help: consider returning the local binding `rc`
12+ |
13+ LL ~ let rc = Rc::new(function);
14+ LL + rc
15+ |
16+
17+ error: aborting due to previous error
18+
19+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments