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.

25 lines
644 B
Rust
Raw Normal View History

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