-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Associated types: ICE "get_unique_type_id_of_type() - unexpected type" #20797
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
Comments
I just ran into this as well with a smaller example: struct Peekable<I> where I: Iterator {
_iter: I,
_next: Option<<I as Iterator>::Item>,
}
fn main() {
let mut iter = Vec::<i32>::new().into_iter();
let next = iter.next();
let _v = Peekable {
_iter: iter,
_next : next,
};
} With this error:
|
bors should not have closed this issue, as I mentioned in #20960, my original example still causes an ICE even after that pull request was merged. |
No luck yet.
|
I'll take a closer look at this asap. |
@nikomatsakis / @michaelwoerister: I just ran into this other error as well. Here's my reduced test case: trait DeclaredTrait {
type Type;
}
impl DeclaredTrait for i32 {
type Type = i32;
}
struct Struct<B: DeclaredTrait> {
b: B,
b1: B::Type,
}
fn main() {
let e = Struct {
b: 0,
b1: 0,
};
} Errors with:
|
@nikomatsakis Is it expected behaviour that there are still If |
@michaelwoerister: not sure if you've talked to @nikomatsakis outside of github, but he told me yesterday that |
@erickt That answers my question then |
@michaelwoerister: chatting with @nikomatsakis just now in IRC and he says he believes he has already fixed it in his #20797 PR. |
er, what @erickt said :) |
All the better then |
@nikomatsakis, I just tried my example with master@865e61c7 merged with your assoc-type-ice-hunt-take-1@2479dfcb, and still get an ICE. |
@kinghajj not sure what to say, it certainly works for me. |
(Using a slightly modified version of ee2bfae) |
I've started building the latest rustc master, I'll get back when I can with my result. I'm sure you guys are right, though, and thanks for all your support! |
I was about to give some bad news, but bluss's command gave me an insight. I'm using rustc 1.0.0-dev (ed530d7 2015-01-16 22:41:16 +0000), and while |
Add |
@kinghajj We don't have your cargo project, so we can't try reproduce. |
I ran into an ICE which looks like #21292, so I am posting the details here.
Backtrace:
The code that ICEs is here: https://github.com/ruud-v-a/image/tree/ice-8903c21d6. |
Here is a debugging output trace of compiling the initial example:
The problem is the @nikomatsakis, I'm assuming you are the one to make this call: Should I normalize in |
@bluss |
(Ah, I no doubt wasn't running with |
@michaelwoerister you can and should normalize in the debuginfo pass, basically at the same times when you apply substitutes (e.g., when you extract the field out of a struct definition and monomorphize it by substituting the values for the struct's type parameters) |
cc me, I started hitting this issue as well. Rust version: rustc 1.0.0-nightly (29bd9a0 2015-01-20 23:03:09 +0000) |
I'm going to re-open this issue, I think that the regression test failed to cover the use of |
…r=alexcrichton This should fix issue rust-lang#20797 (but I don't want to close it automatically). As the actual fix is very small this would be a perfect candidate for a rollup.
cc me, started getting this after a large refactor. |
I'm very happy to report that my example now compiles without error using |
I thought that my example in #20368 was sufficient to cover one of my desired uses of associated types, but, while that example does now successfully compile, the module I really wanted to improve still fails with yet another ICE. Here's the module in full:
Here's the error and backtrace:
The text was updated successfully, but these errors were encountered: