Skip to content

Commit 3e2ed18

Browse files
committed
RIMOV: fix issue-3563-3 test
1 parent bb64235 commit 3e2ed18

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/test/run-pass/issue-3563-3.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct AsciiArt
5151
width: uint,
5252
height: uint,
5353
priv fill: char,
54-
priv lines: ~[~[mut char]],
54+
priv lines: ~[~[char]],
5555

5656
// This struct can be quite large so we'll disable copying: developers need
5757
// to either pass these structs around via borrowed pointers or move them.
@@ -65,14 +65,14 @@ fn AsciiArt(width: uint, height: uint, fill: char) -> AsciiArt
6565
{
6666
// Use an anonymous function to build a vector of vectors containing
6767
// blank characters for each position in our canvas.
68-
let lines = do vec::build_sized(height)
68+
let mut lines = do vec::build_sized(height)
6969
|push|
7070
{
7171
for height.times
7272
{
7373
let mut line = ~[];
7474
vec::grow_set(&mut line, width-1, &'.', '.');
75-
push(vec::cast_to_mut(line));
75+
push(line);
7676
}
7777
};
7878

@@ -84,7 +84,7 @@ fn AsciiArt(width: uint, height: uint, fill: char) -> AsciiArt
8484
// Methods particular to the AsciiArt struct.
8585
impl AsciiArt
8686
{
87-
fn add_pt(x: int, y: int)
87+
fn add_pt(&mut self, x: int, y: int)
8888
{
8989
if x >= 0 && x < self.width as int
9090
{
@@ -99,7 +99,7 @@ impl AsciiArt
9999
// element is:
100100
// 1) potentially large
101101
// 2) needs to be modified
102-
let row = &self.lines[v];
102+
let row = &mut self.lines[v];
103103
row[h] = self.fill;
104104
}
105105
}
@@ -125,12 +125,12 @@ impl AsciiArt : ToStr
125125
#[allow(default_methods)]
126126
trait Canvas
127127
{
128-
fn add_point(shape: Point);
129-
fn add_rect(shape: Rect);
128+
fn add_point(&mut self, shape: Point);
129+
fn add_rect(&mut self, shape: Rect);
130130

131131
// Unlike interfaces traits support default implementations.
132132
// Got an ICE as soon as I added this method.
133-
fn add_points(shapes: &[Point])
133+
fn add_points(&mut self, shapes: &[Point])
134134
{
135135
for shapes.each |pt| {self.add_point(*pt)};
136136
}
@@ -141,12 +141,12 @@ trait Canvas
141141
// and code can use them polymorphically via the Canvas trait.
142142
impl AsciiArt : Canvas
143143
{
144-
fn add_point(shape: Point)
144+
fn add_point(&mut self, shape: Point)
145145
{
146146
self.add_pt(shape.x, shape.y);
147147
}
148148

149-
fn add_rect(shape: Rect)
149+
fn add_rect(&mut self, shape: Rect)
150150
{
151151
// Add the top and bottom lines.
152152
for int::range(shape.top_left.x, shape.top_left.x + shape.size.width)
@@ -188,7 +188,7 @@ fn test_ascii_art_ctor()
188188

189189
fn test_add_pt()
190190
{
191-
let art = AsciiArt(3, 3, '*');
191+
let mut art = AsciiArt(3, 3, '*');
192192
art.add_pt(0, 0);
193193
art.add_pt(0, -10);
194194
art.add_pt(1, 2);
@@ -198,7 +198,7 @@ fn test_add_pt()
198198

199199
fn test_shapes()
200200
{
201-
let art = AsciiArt(4, 4, '*');
201+
let mut art = AsciiArt(4, 4, '*');
202202
art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}});
203203
art.add_point(Point {x: 2, y: 2});
204204
assert check_strs(art.to_str(), "****\n*..*\n*.**\n****");

0 commit comments

Comments
 (0)