rust/tests/ui/coherence/coherence-with-coroutine.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
663 B
Rust
Raw Normal View History

// Test that encountering closures during coherence does not cause issues.
2023-10-19 21:46:28 +00:00
#![feature(type_alias_impl_trait, coroutines)]
#![cfg_attr(specialized, feature(specialization))]
#![allow(incomplete_features)]
//@ revisions: stock specialized
//@ [specialized]check-pass
2023-10-19 16:06:43 +00:00
type OpaqueCoroutine = impl Sized;
fn defining_use() -> OpaqueCoroutine {
#[coroutine]
|| {
for i in 0..10 {
yield i;
}
}
}
struct Wrapper<T>(T);
trait Trait {}
2023-10-19 16:06:43 +00:00
impl Trait for Wrapper<OpaqueCoroutine> {}
impl<T: Sync> Trait for Wrapper<T> {}
2023-10-19 16:06:43 +00:00
//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
fn main() {}