@@ -53,13 +53,13 @@ impl<T> Rc<T> {
53
53
}
54
54
55
55
impl < T : Send > Rc < T > {
56
- pub fn from_owned ( value : T ) -> Rc < T > {
56
+ pub fn from_send ( value : T ) -> Rc < T > {
57
57
unsafe { Rc :: new ( value) }
58
58
}
59
59
}
60
60
61
61
impl < T : Freeze > Rc < T > {
62
- pub fn from_const ( value : T ) -> Rc < T > {
62
+ pub fn from_freeze ( value : T ) -> Rc < T > {
63
63
unsafe { Rc :: new ( value) }
64
64
}
65
65
}
@@ -111,7 +111,7 @@ mod test_rc {
111
111
112
112
#[ test]
113
113
fn test_clone( ) {
114
- let x = Rc :: from_owned ( Cell :: new ( 5 ) ) ;
114
+ let x = Rc :: from_send ( Cell :: new ( 5 ) ) ;
115
115
let y = x. clone ( ) ;
116
116
do x. borrow ( ) . with_mut_ref |inner| {
117
117
* inner = 20 ;
@@ -121,7 +121,7 @@ mod test_rc {
121
121
122
122
#[ test]
123
123
fn test_deep_clone( ) {
124
- let x = Rc :: from_owned ( Cell :: new ( 5 ) ) ;
124
+ let x = Rc :: from_send ( Cell :: new ( 5 ) ) ;
125
125
let y = x. deep_clone ( ) ;
126
126
do x. borrow ( ) . with_mut_ref |inner| {
127
127
* inner = 20 ;
@@ -131,21 +131,21 @@ mod test_rc {
131
131
132
132
#[ test]
133
133
fn test_simple ( ) {
134
- let x = Rc :: from_const ( 5 ) ;
134
+ let x = Rc :: from_freeze ( 5 ) ;
135
135
assert_eq ! ( * x. borrow( ) , 5 ) ;
136
136
}
137
137
138
138
#[ test]
139
139
fn test_simple_clone ( ) {
140
- let x = Rc :: from_const ( 5 ) ;
140
+ let x = Rc :: from_freeze ( 5 ) ;
141
141
let y = x. clone ( ) ;
142
142
assert_eq ! ( * x. borrow( ) , 5 ) ;
143
143
assert_eq ! ( * y. borrow( ) , 5 ) ;
144
144
}
145
145
146
146
#[ test]
147
147
fn test_destructor ( ) {
148
- let x = Rc :: from_owned ( ~5 ) ;
148
+ let x = Rc :: from_send ( ~5 ) ;
149
149
assert_eq ! ( * * x. borrow( ) , 5 ) ;
150
150
}
151
151
}
@@ -178,13 +178,13 @@ impl<T> RcMut<T> {
178
178
}
179
179
180
180
impl < T : Send > RcMut < T > {
181
- pub fn from_owned ( value : T ) -> RcMut < T > {
181
+ pub fn from_send ( value : T ) -> RcMut < T > {
182
182
unsafe { RcMut :: new ( value) }
183
183
}
184
184
}
185
185
186
186
impl < T : Freeze > RcMut < T > {
187
- pub fn from_const ( value : T ) -> RcMut < T > {
187
+ pub fn from_freeze ( value : T ) -> RcMut < T > {
188
188
unsafe { RcMut :: new ( value) }
189
189
}
190
190
}
@@ -258,7 +258,7 @@ mod test_rc_mut {
258
258
259
259
#[ test]
260
260
fn test_clone ( ) {
261
- let x = RcMut :: from_owned ( 5 ) ;
261
+ let x = RcMut :: from_send ( 5 ) ;
262
262
let y = x. clone ( ) ;
263
263
do x. with_mut_borrow |value| {
264
264
* value = 20 ;
@@ -270,7 +270,7 @@ mod test_rc_mut {
270
270
271
271
#[ test]
272
272
fn test_deep_clone ( ) {
273
- let x = RcMut :: from_const ( 5 ) ;
273
+ let x = RcMut :: from_freeze ( 5 ) ;
274
274
let y = x. deep_clone ( ) ;
275
275
do x. with_mut_borrow |value| {
276
276
* value = 20 ;
@@ -282,7 +282,7 @@ mod test_rc_mut {
282
282
283
283
#[ test]
284
284
fn borrow_many ( ) {
285
- let x = RcMut :: from_owned ( 5 ) ;
285
+ let x = RcMut :: from_send ( 5 ) ;
286
286
let y = x. clone ( ) ;
287
287
288
288
do x. with_borrow |a| {
@@ -298,7 +298,7 @@ mod test_rc_mut {
298
298
299
299
#[ test]
300
300
fn modify ( ) {
301
- let x = RcMut :: from_const ( 5 ) ;
301
+ let x = RcMut :: from_freeze ( 5 ) ;
302
302
let y = x. clone ( ) ;
303
303
304
304
do y. with_mut_borrow |a| {
@@ -313,22 +313,22 @@ mod test_rc_mut {
313
313
314
314
#[ test]
315
315
fn release_immutable ( ) {
316
- let x = RcMut :: from_owned ( 5 ) ;
316
+ let x = RcMut :: from_send ( 5 ) ;
317
317
do x. with_borrow |_| { }
318
318
do x. with_mut_borrow |_| { }
319
319
}
320
320
321
321
#[ test]
322
322
fn release_mutable ( ) {
323
- let x = RcMut :: from_const ( 5 ) ;
323
+ let x = RcMut :: from_freeze ( 5 ) ;
324
324
do x. with_mut_borrow |_| { }
325
325
do x. with_borrow |_| { }
326
326
}
327
327
328
328
#[ test]
329
329
#[ should_fail]
330
330
fn frozen ( ) {
331
- let x = RcMut :: from_owned ( 5 ) ;
331
+ let x = RcMut :: from_send ( 5 ) ;
332
332
let y = x. clone ( ) ;
333
333
334
334
do x. with_borrow |_| {
@@ -340,7 +340,7 @@ mod test_rc_mut {
340
340
#[ test]
341
341
#[ should_fail]
342
342
fn mutable_dupe ( ) {
343
- let x = RcMut :: from_const ( 5 ) ;
343
+ let x = RcMut :: from_freeze ( 5 ) ;
344
344
let y = x. clone ( ) ;
345
345
346
346
do x. with_mut_borrow |_| {
@@ -352,7 +352,7 @@ mod test_rc_mut {
352
352
#[ test]
353
353
#[ should_fail]
354
354
fn mutable_freeze ( ) {
355
- let x = RcMut :: from_owned ( 5 ) ;
355
+ let x = RcMut :: from_send ( 5 ) ;
356
356
let y = x. clone ( ) ;
357
357
358
358
do x. with_mut_borrow |_| {
@@ -364,7 +364,7 @@ mod test_rc_mut {
364
364
#[ test]
365
365
#[ should_fail]
366
366
fn restore_freeze ( ) {
367
- let x = RcMut :: from_const ( 5 ) ;
367
+ let x = RcMut :: from_freeze ( 5 ) ;
368
368
let y = x. clone ( ) ;
369
369
370
370
do x. with_borrow |_| {
0 commit comments