rust/tests/ui/coherence/orphan-check-projections-covering.rs
2024-10-15 13:26:59 +02:00

23 lines
632 B
Rust

// Projections cover type parameters if they normalize to a (local) type that covers them.
// This ensures that we don't perform an overly strict check on
// projections like in closed PR #100555 which did a syntactic
// check for type parameters in projections without normalizing
// first which would've lead to real-word regressions.
//@ check-pass
//@ aux-crate:foreign=parametrized-trait.rs
//@ edition:2021
trait Project { type Output; }
impl<T> Project for Wrapper<T> {
type Output = Local;
}
struct Wrapper<T>(T);
struct Local;
impl<T> foreign::Trait1<Local, T> for <Wrapper<T> as Project>::Output {}
fn main() {}