Normalization of projections in trait bounds on associated types · Issue #20775 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@nikomatsakis

Description

@nikomatsakis

Related to #20765 we should do more normalization in order for this test to pass:

// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms.

// Test where the bounds in the trait use projections rather than the // canonical form.

trait Foo { type T; }

trait Bar<A:Foo<T=B>,B> { type F : Baz<A::T>; }

trait Baz { }

fn foo<I:Bar<J,K>,J,K>() { // Based on trait, we can conclude that // I::F : Baz<J::T> // and // J::T == K // hence // I::F : Baz // which is what bar expects. bar::<I::F,K>() }

fn bar<IF, K>() where IF : Baz { }

fn main () { }