-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encode optimized MIR of generators when emitting metadata
- Loading branch information
Showing
3 changed files
with
38 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
11 changes: 11 additions & 0 deletions
11
src/test/ui/generator/auxiliary/metadata-sufficient-for-layout.rs
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,11 @@ | ||
// compile-flags: --emit metadata | ||
#![feature(generators, generator_trait)] | ||
|
||
use std::marker::Unpin; | ||
use std::ops::Generator; | ||
|
||
pub fn g() -> impl Generator<(), Yield = (), Return = ()> { | ||
|| { | ||
yield; | ||
} | ||
} |
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,23 @@ | ||
// Check that the layout of a generator is available when auxiliary crate | ||
// is compiled with --emit metadata. | ||
// | ||
// Regression test for #80998. | ||
// | ||
// aux-build:metadata-sufficient-for-layout.rs | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
#![feature(generator_trait)] | ||
|
||
extern crate metadata_sufficient_for_layout; | ||
|
||
use std::ops::Generator; | ||
|
||
type F = impl Generator<(), Yield = (), Return = ()>; | ||
|
||
// Static queries the layout of the generator. | ||
static A: Option<F> = None; | ||
|
||
fn f() -> F { metadata_sufficient_for_layout::g() } | ||
|
||
fn main() {} |