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

"Internal error looking up definition" using a type alias with a where clause #20222

Closed
pythonesque opened this issue Dec 25, 2014 · 5 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pythonesque
Copy link
Contributor

I guess this just hasn't been implemented yet?

#![feature(associated_types)]

trait Foo {}

pub type Bar<T> where T: Foo = T;

fn main() {}
src/hkt.rs:5:26: 5:29 error: internal error looking up a definition
src/hkt.rs:5 pub type Bar<T> where T: Foo = T;
                                      ^~~
@ftxqxd
Copy link
Contributor

ftxqxd commented Dec 27, 2014

Bounds aren’t supported on type aliases so I guess this is just a bug with the error message.

@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-diagnostics Area: Messages for errors, warnings, and lints labels Jan 16, 2015
@tamird
Copy link
Contributor

tamird commented Apr 21, 2015

Seems to work now.

trait Foo {}

pub type Bar<T> where T: Foo = T;

fn main() {}

compiles without error.

@steveklabnik
Copy link
Member

Agreed!

@ftxqxd
Copy link
Contributor

ftxqxd commented Apr 22, 2015

It compiles without error, but it should probably give a warning, like the equivalent version without a where clause:

// This version gives a warning:
type Foo<T: Copy> = T; // warning: trait bounds are not (yet) enforced in type definitions

// But this equivalent version doesn’t:
type Bar<T> where T: Copy = T; // no warning

fn main() {
    let _: Bar<Box<i32>> = Box::new(1); // compiles
}

@tamird
Copy link
Contributor

tamird commented Apr 22, 2015

@P1start I mentioned this on #21903 - I think this should probably be a compile error until the enforcement is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants