Closed
Description
Code:
use std::io;
struct Bar<'a> {
writer: Option<&'a mut Writer + 'a>,
}
fn foo<'a>(mut bar: Bar<'a>) {
match bar.writer {
Some(ref mut w) => { w.write([]); },
_ => {},
}
}
fn main() {
foo(Bar {
writer: Some(&mut io::stdout() as &mut Writer),
})
}
Compile, run, result is
task '<main>' has overflowed its stack
Sorry, cannot find smaller example to reproduce the problem.
$ rustc --version
rustc 0.12.0-nightly (136ab3c6b 2014-10-04 00:17:04 +0000)
$ uname -a
Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Similar code, internal compiler error:
use std::io;
struct Bar<'a> {
writer: Option<&'a mut Writer + 'a>,
}
fn baz(_: &mut Writer) {
}
fn foo<'a>(mut bar: Bar<'a>) {
baz(bar.writer.as_mut().unwrap());
}
fn main() {
foo(Bar {
writer: Some(&mut io::stdout() as &mut Writer),
})
}
error: internal compiler error: trying to take the sizing type of std::io::Writer+'a, an unsized type
Metadata
Metadata
Assignees
Labels
No labels