Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associated item projections across crate boundaries slightly broken #29205

Open
ebfull opened this issue Oct 21, 2015 · 5 comments
Open

Associated item projections across crate boundaries slightly broken #29205

ebfull opened this issue Oct 21, 2015 · 5 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) A-coherence Area: Coherence A-trait-system Area: Trait system C-bug Category: This is a bug. P-medium Medium priority T-lang Relevant to the language team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@ebfull
Copy link
Contributor

ebfull commented Oct 21, 2015

pub trait Foo<T> { }
pub trait Mirror {
        type Dual;
}

pub struct Eps;

pub struct A<T, U>(T, U);
impl<T, U: Mirror> Mirror for A<T, U> { type Dual = B<T, U::Dual>; }
pub struct B<T, U>(T, U);
impl<T, U: Mirror> Mirror for B<T, U> { type Dual = A<T, U::Dual>; }

impl Mirror for Eps { type Dual = Eps; }
extern crate whatever;
use whatever::*;

struct Dummy;

impl Foo<A<Eps, B<Eps, Eps>>> for Dummy {}

// doesn't work, causes "conflicting implementations for trait `whatever::Foo`"
// impl Foo<<A<Eps, B<Eps, Eps>> as Mirror>::Dual> for Dummy {}

// works just fine
// impl Foo<B<Eps, A<Eps, Eps>>> for Dummy {}

This despite the fact that <A<Eps, B<Eps, Eps>> as Mirror>::Dual and B<Eps, A<Eps, Eps>> are the same type. It works just fine when they're in the same crate.

@apasel422 apasel422 added the A-trait-system Area: Trait system label Oct 26, 2015
@brson brson added A-associated-items Area: Associated items (types, constants & functions) T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Mar 23, 2017
@brson
Copy link
Contributor

brson commented Mar 23, 2017

Needs repro.

@brson
Copy link
Contributor

brson commented Mar 23, 2017

Is this a bug? P-?

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Apr 28, 2017

I agree this is a bug. I think it falls under the general category of "failure to normalize" that I expect to basically go away as part of the "chalk overhaul" (rust-lang/rust-roadmap-2017#8).

@nikomatsakis
Copy link
Contributor

triage: P-medium

@rust-highfive rust-highfive added the P-medium Medium priority label Apr 28, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 24, 2017
@e00E
Copy link
Contributor

e00E commented Jun 19, 2020

This bug report is still correct with rustc 1.44.1. I am commenting because the contribution guidelines say it is helpful to check whether old bug reports are still correct.

@fmease fmease added T-types Relevant to the types team, which will review and decide on the PR/issue. A-coherence Area: Coherence labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-coherence Area: Coherence A-trait-system Area: Trait system C-bug Category: This is a bug. P-medium Medium priority T-lang Relevant to the language team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants