Skip to content

Instantly share code, notes, and snippets.

@linuxfood
Created December 30, 2011 03:53
Show Gist options
  • Save linuxfood/1537715 to your computer and use it in GitHub Desktop.
Save linuxfood/1537715 to your computer and use it in GitHub Desktop.
Rust typing error?
use std;
// uniq mut vec of mut f64
type umvomf64 = ~mutable [ mutable f64 ];
fn mk_umvomf64() -> umvomf64 {
ret ~mutable [ mutable ];
}
fn main() {
let cnt = 10u;
let my_umvomf64 = [ vec::init_elt_mut(mk_umvomf64(), cnt) ];
let my_stuff = mk_umvomf64();
*my_stuff += [ mutable 1.03_f64 ];
// test_type_error.rs:15:20: 15:28 error: mismatched types: expected `[mutable umvomf64]` but found `[umvomf64]` (types differ)
// test_type_error.rs:15 my_umvomf64[2] <- [my_stuff];
^
// rust: upcall fail 'explicit failure', ../src/comp/driver/session.rs:75
my_umvomf64[2] <- [my_stuff];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment