add test for issue 102964
This commit is contained in:
parent
50f6d337c6
commit
950ca0c302
10
src/test/ui/issues/issue-102964.rs
Normal file
10
src/test/ui/issues/issue-102964.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use std::rc::Rc;
|
||||
type Foo<'a, T> = &'a dyn Fn(&T);
|
||||
type RcFoo<'a, T> = Rc<Foo<'a, T>>;
|
||||
|
||||
fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
|
||||
//~^ ERROR mismatched types
|
||||
let rc = Rc::new(function);
|
||||
}
|
||||
|
||||
fn main() {}
|
19
src/test/ui/issues/issue-102964.stderr
Normal file
19
src/test/ui/issues/issue-102964.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-102964.rs:5:41
|
||||
|
|
||||
LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
|
||||
| ------------ ^^^^^^^^ expected struct `Rc`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
|
||||
= note: expected struct `Rc<&dyn for<'a> Fn(&'a T)>`
|
||||
found unit type `()`
|
||||
help: consider returning the local binding `rc`
|
||||
|
|
||||
LL ~ let rc = Rc::new(function);
|
||||
LL + rc
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
x
Reference in New Issue
Block a user