-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
ICE - trying to take the sizing type of <core::iter::Iterator + 'static as core::iter::Iterator>::Item, an unsized type #20605
Comments
The following also ICEs on Rust playpen: fn changer<'a>(things: &mut Iterator) {
for item in *things { }
}
fn main() {
} |
I am getting this as well for a function: fn write_ppm16(
out: &mut Writer,
dims: (u16, u16),
pixels: &mut iter::Iterator<Item = RGB16>,
opt_conf: Option<PPMConfig>) -> IoResult<u32> {
// ...
for p in *pixels {
try!(out.write_be_u16(p.r));
try!(out.write_be_u16(p.g));
try!(out.write_be_u16(p.b));
bytes_written += 6;
}
// ...
} Is there a work-around? Error
Version
|
Updated error message is an LLVM assertion:
To workaround the bug, simply don't dereference the iterator, this doesn't crash: fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
for item in things { *item = 0 }
}
fn main() {
} |
FWIW, the new for loops (#20790) report a compiler error in this case, instead of ICEing: fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
for item in *things { *item = 0 }
}
fn main() {
} Output:
|
Code
Error
Version
The text was updated successfully, but these errors were encountered: