Skip to content

Commit 13b3043

Browse files
author
Oliver Schneider
committed
---
yaml --- r: 190006 b: refs/heads/master c: 85080fa h: refs/heads/master v: v3
1 parent cf11821 commit 13b3043

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6584ae54917a74d8bf83c1047f273d5210d2a015
2+
refs/heads/master: 85080fa81d3ae6770eb228a982670746e55bf4d9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 270a677d4d698916f5ad103f0afc3c070b8dbeb4
55
refs/heads/try: 1c28ab65017d74fc13d003f7c7a73d1a48e5406f

trunk/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl<'a> MyWriter for &'a mut [u8] {
2626

2727
let write_len = buf.len();
2828
unsafe {
29-
*self = slice::from_raw_parts(
30-
self.as_ptr().offset(write_len as int),
29+
*self = slice::from_raw_parts_mut(
30+
self.as_mut_ptr().offset(write_len as isize),
3131
self.len() - write_len
3232
);
3333
}

trunk/src/test/run-pass/unsized3.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,32 @@
1515

1616
use std::mem;
1717
use std::raw;
18+
use std::slice;
1819

1920
struct Foo<T> {
2021
f: [T],
2122
}
2223

2324
struct Bar {
24-
f1: uint,
25-
f2: [uint],
25+
f1: usize,
26+
f2: [usize],
2627
}
2728

2829
struct Baz {
29-
f1: uint,
30+
f1: usize,
3031
f2: str,
3132
}
3233

3334
trait Tr {
34-
fn foo(&self) -> uint;
35+
fn foo(&self) -> usize;
3536
}
3637

3738
struct St {
38-
f: uint
39+
f: usize
3940
}
4041

4142
impl Tr for St {
42-
fn foo(&self) -> uint {
43+
fn foo(&self) -> usize {
4344
self.f
4445
}
4546
}
@@ -67,18 +68,18 @@ pub fn main() {
6768
}
6869

6970
let data: Box<Foo_<i32>> = box Foo_{f: [1, 2, 3] };
70-
let x: &Foo<i32> = slice::from_raw_parts(&*data, 3);
71+
let x: &Foo<i32> = mem::transmute(slice::from_raw_parts(&*data, 3));
7172
assert!(x.f.len() == 3);
7273
assert!(x.f[0] == 1);
7374

7475
struct Baz_ {
75-
f1: uint,
76+
f1: usize,
7677
f2: [u8; 5],
7778
}
7879

7980
let data: Box<_> = box Baz_ {
8081
f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] };
81-
let x: &Baz = slice::from_raw_parts(&*data, 5);
82+
let x: &Baz = mem::transmute(slice::from_raw_parts(&*data, 5));
8283
assert!(x.f1 == 42);
8384
let chs: Vec<char> = x.f2.chars().collect();
8485
assert!(chs.len() == 5);

0 commit comments

Comments
 (0)