Closed kmcallister closed 10 years ago
cc me
(Slightly) simpler example:
// euv_ice.rs
#![crate_type="lib"]
pub struct TreeBuilder<H>;
impl<H> Iterator<H> for TreeBuilder<H> {
fn next(&mut self) -> Option<H> { None }
}
impl<H> TreeBuilder<H> {
pub fn process_token(&mut self) {
match self {
_ => for _y in *self {},
}
}
}
extern crate euv_ice;
fn main() {
euv_ice::TreeBuilder::<uint>.process_token();
}
This appears to be related to AST being inlined cross-crate, and the for
internals (cc @pcwalton) since desugaring it to the equivalent loop { match self.next() {
doesn't ICE. It also requires that process_token
is a method, a freestanding function stops the ICE.
Cool, for now I'll go with the workaround of desugaring the for
loop myself.
Extracted from an issue I encountered upgrading html5ever to Rust master.
foo.rs
:bar.rs
:It seems like more or less every part of this code is necessary to hit the bug. Here's the result:
(This has my modifications to give a marginally more useful error message.)
The failure happens when looking up a type parameter
DefId
when handling thety_param
case.What I actually get building
html5ever
is a failure of the preceding assertion regarding crate IDs. I didn't find a small reproducer for that assertion failure, but this bug is likely to be related.