-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract expected return type from
-> impl Future
obligation
- Loading branch information
1 parent
c8e5851
commit f7ed53c
Showing
3 changed files
with
158 additions
and
3 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
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,25 @@ | ||
// Check that we apply unsizing coercions based on the return type. | ||
// | ||
// Also serves as a regression test for #60424. | ||
// | ||
// edition:2018 | ||
// check-pass | ||
|
||
#![allow(warnings)] | ||
|
||
use std::fmt::Debug; | ||
|
||
const TMP: u32 = 22; | ||
|
||
// Coerce from `Box<"asdf">` to `Box<dyn Debug>`. | ||
fn raw_pointer_coercion() { | ||
fn sync_example() -> *const u32 { | ||
&TMP | ||
} | ||
|
||
async fn async_example() -> *const u32 { | ||
&TMP | ||
} | ||
} | ||
|
||
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,34 @@ | ||
// Check that we apply unsizing coercions based on the return type. | ||
// | ||
// Also serves as a regression test for #60424. | ||
// | ||
// edition:2018 | ||
// check-pass | ||
|
||
#![allow(warnings)] | ||
|
||
use std::fmt::Debug; | ||
|
||
// Coerce from `Box<"asdf">` to `Box<dyn Debug>`. | ||
fn unsize_trait_coercion() { | ||
fn sync_example() -> Box<dyn Debug> { | ||
Box::new("asdf") | ||
} | ||
|
||
async fn async_example() -> Box<dyn Debug> { | ||
Box::new("asdf") | ||
} | ||
} | ||
|
||
// Coerce from `Box<[u32; N]>` to `Box<[32]>`. | ||
fn unsize_slice_coercion() { | ||
fn sync_example() -> Box<[u32]> { | ||
Box::new([0]) | ||
} | ||
|
||
async fn async_example() -> Box<[u32]> { | ||
Box::new([0]) | ||
} | ||
} | ||
|
||
fn main() {} |