rust/tests/ui/type-alias-impl-trait/constrain_in_projection.rs

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

29 lines
544 B
Rust
Raw Normal View History

2024-05-23 15:46:56 +00:00
//! Check that projections will constrain opaque types while looking for
//! matching impls.
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next]check-pass
2024-05-23 15:46:56 +00:00
#![feature(type_alias_impl_trait)]
struct Foo;
type Bar = impl Sized;
trait Trait<T> {
type Assoc: Default;
}
impl Trait<()> for Foo {
type Assoc = u32;
}
fn bop(_: Bar) {
let x = <Foo as Trait<Bar>>::Assoc::default();
//[current]~^ `Foo: Trait<Bar>` is not satisfied
2024-05-23 15:46:56 +00:00
}
fn main() {}