-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Description
enum List {
Cons(u32,~List),
Nil
}
fn prepend(xs: List, value: u32) -> List {
Cons(value, ~xs );
}
fn main(){
let mut xs = Nil;
xs = prepend(xs,1);
xs = prepend(xs,2);
xs = prepend(xs,3);
}
report error
abc.rs:7:1: 9:2 error: not all control paths return a value
abc.rs:7 fn prepend(xs: List, value: u32) -> List {
abc.rs:8 Cons(value, ~xs );
abc.rs:9 }
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /build/buildd/rust-0.9-0.9/src/libsyntax/diagnostic.rs:75
task '
If you remove the semicolon at the end of "Cons(value, ~xs );"
no error report
This is a bug?
Metadata
Metadata
Assignees
Labels
No labels