Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Normalization of projections in trait bounds on associated types #20775

Copy link
Copy link
@nikomatsakis

Description

@nikomatsakis
Issue body actions

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<A> { }

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<K>
    // which is what `bar` expects.
    bar::<I::F,K>()
}

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

fn main ()
{
}

Metadata

Metadata

Assignees

Labels

A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.