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

Bogus associated type HKT syntax somehow compiles with no errors #23543

Closed
theemathas opened this issue Mar 20, 2015 · 4 comments
Closed

Bogus associated type HKT syntax somehow compiles with no errors #23543

theemathas opened this issue Mar 20, 2015 · 4 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@theemathas
Copy link

Code:

pub trait A : Copy {}

struct Foo;

pub trait D {
    fn f<T>(self)
        where T<Bogus = Foo>: A;
}

fn main() {}

playpen

This isn't supposed to compile at all.

Probably a variant of #23544

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 22, 2015
@bombless
Copy link
Contributor

bombless commented Apr 1, 2015

use std::marker::PhantomFn;

trait Trait<T>: PhantomFn<Self, T> {}

impl<T> Trait<T> for () where Trait<T>: Eq {}

fn main() {}

This seems similar (illegal bounds at where clause)

@theemathas
Copy link
Author

This is incorrectly labelled. This should be I-wrong, not I-ICE

@nrc nrc added I-wrong and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Apr 1, 2015
@huonw
Copy link
Member

huonw commented Apr 1, 2015

@bombless I'm not sure that is illegal, since Trait<T> is a valid type (its is a DST): that impl is just conditional on whether the Trait<T> type implements Eq, e.g.

use std::marker::PhantomFn;

trait Trait<T>: PhantomFn<Self, T> {}

impl<T> Trait<T> for () where Trait<T>: Eq {}


fn foo<T, U: Trait<T>>() {}


impl PartialEq for Trait<u16> {
    fn eq(&self, _: &Trait<u16>) -> bool { false }
}
impl Eq for Trait<u16> {}


fn main() {
    foo::<u16, ()>();

    // foo::<u8, ()>();
    // error: the trait `core::cmp::Eq` is not implemented for the type `Trait<u8>`
}

@Stebalien
Copy link
Contributor

Triage: can't reproduce.

tmp.rs:7:17: 7:28 error: associated type bindings are not allowed here [E0229]
tmp.rs:7         where T<Bogus = Foo>: A;
                         ^~~~~~~~~~~
error: aborting due to previous error

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Sep 16, 2015
bors added a commit that referenced this issue Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

7 participants