-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] require return types are sized on project
This is a crude and not 100% complete fix, a described in https://zulip-archive.rust-lang.org/144729wgtraits/32496PR83915.html
- Loading branch information
1 parent
6265286
commit e5615dc
Showing
3 changed files
with
42 additions
and
1 deletion.
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
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,7 @@ | ||
fn weird_situation<F: FnOnce() -> str>() { | ||
println!("if this is reachable, there’s a function type with unsized Output type `str`"); | ||
} | ||
|
||
fn main() { | ||
weird_situation::<fn() -> str>() | ||
} |
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,18 @@ | ||
#![feature(unboxed_closures)] | ||
|
||
trait A { | ||
fn a() | ||
where | ||
Self: Sized; | ||
} | ||
|
||
fn foo<F: FnOnce<()>>() | ||
where | ||
F::Output: A, | ||
{ | ||
F::Output::a() | ||
} | ||
|
||
fn main() { | ||
foo::<fn() -> dyn A>() | ||
} |