forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#102967 - Rageking8:add-test-for-issue-10296…
…4, r=TaKO8Ki Add test for issue 102964 Fixes rust-lang#102964
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |