mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Update Rust.
This commit is contained in:
parent
3644d0272c
commit
eaedeb07cb
184 changed files with 643 additions and 657 deletions
|
@ -47,7 +47,7 @@ macro_rules! lazy_init(
|
|||
static mut s: *$T = 0 as *$T;
|
||||
static mut ONCE: ::sync::one::Once = ::sync::one::ONCE_INIT;
|
||||
ONCE.doit(|| {
|
||||
s = ::std::cast::transmute::<~$T, *$T>(~($e));
|
||||
s = ::std::cast::transmute::<Box<$T>, *$T>(box () ($e));
|
||||
});
|
||||
&*s
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ mod tests {
|
|||
|
||||
lazy_init! {
|
||||
static ref NUMBER: uint = times_two(3);
|
||||
static ref VEC: [~uint, ..3] = [~1, ~2, ~3];
|
||||
static ref OWNED_STRING: ~str = ~"hello";
|
||||
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
|
||||
static ref OWNED_STRING: ~str = "hello".to_owned();
|
||||
static ref HASHMAP: collections::HashMap<uint, &'static str> = {
|
||||
let mut m = collections::HashMap::new();
|
||||
m.insert(0u, "abc");
|
||||
|
@ -82,11 +82,11 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
assert_eq!(*OWNED_STRING, ~"hello");
|
||||
assert_eq!(*OWNED_STRING, "hello".to_owned());
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert!(HASHMAP.find(&1).is_some());
|
||||
assert!(HASHMAP.find(&3).is_none());
|
||||
assert_eq!(VEC.as_slice(), &[~1, ~2, ~3]);
|
||||
assert_eq!(VEC.as_slice(), &[box 1, box 2, box 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue