diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-01-14 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-01-14 00:00:00 +0000 |
| commit | ea4cbff264371ed28c3642991d87c59f369e4e70 (patch) | |
| tree | ab430b1abbd20a44261002d5659ac5768ed655ec /src | |
| parent | c7b0ddbffebee1cb06f184e815ca637706c53053 (diff) | |
Encode optimized MIR of generators when emitting metadata
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/generator/auxiliary/metadata-sufficient-for-layout.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/generator/metadata-sufficient-for-layout.rs | 23 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/generator/auxiliary/metadata-sufficient-for-layout.rs b/src/test/ui/generator/auxiliary/metadata-sufficient-for-layout.rs new file mode 100644 index 00000000000..207c2735f88 --- /dev/null +++ b/src/test/ui/generator/auxiliary/metadata-sufficient-for-layout.rs @@ -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; + } +} diff --git a/src/test/ui/generator/metadata-sufficient-for-layout.rs b/src/test/ui/generator/metadata-sufficient-for-layout.rs new file mode 100644 index 00000000000..9c82359a0be --- /dev/null +++ b/src/test/ui/generator/metadata-sufficient-for-layout.rs @@ -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() {} |
