Skip to content

Commit 3bcf57f

Browse files
committed
---
yaml --- r: 67510 b: refs/heads/master c: 5f59c46 h: refs/heads/master v: v3
1 parent c4e36dd commit 3bcf57f

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
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: 1b018dd9bacab613c9627e2cc2c3491cb86042ee
2+
refs/heads/master: 5f59c46e0f5605a0cc90ebdb26b4d258a8f7b43a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/libextra/rc.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ impl<T> Rc<T> {
5353
}
5454

5555
impl<T: Send> Rc<T> {
56-
pub fn from_owned(value: T) -> Rc<T> {
56+
pub fn from_send(value: T) -> Rc<T> {
5757
unsafe { Rc::new(value) }
5858
}
5959
}
6060

6161
impl<T: Freeze> Rc<T> {
62-
pub fn from_const(value: T) -> Rc<T> {
62+
pub fn from_freeze(value: T) -> Rc<T> {
6363
unsafe { Rc::new(value) }
6464
}
6565
}
@@ -111,7 +111,7 @@ mod test_rc {
111111

112112
#[test]
113113
fn test_clone() {
114-
let x = Rc::from_owned(Cell::new(5));
114+
let x = Rc::from_send(Cell::new(5));
115115
let y = x.clone();
116116
do x.borrow().with_mut_ref |inner| {
117117
*inner = 20;
@@ -121,7 +121,7 @@ mod test_rc {
121121

122122
#[test]
123123
fn test_deep_clone() {
124-
let x = Rc::from_owned(Cell::new(5));
124+
let x = Rc::from_send(Cell::new(5));
125125
let y = x.deep_clone();
126126
do x.borrow().with_mut_ref |inner| {
127127
*inner = 20;
@@ -131,21 +131,21 @@ mod test_rc {
131131

132132
#[test]
133133
fn test_simple() {
134-
let x = Rc::from_const(5);
134+
let x = Rc::from_freeze(5);
135135
assert_eq!(*x.borrow(), 5);
136136
}
137137

138138
#[test]
139139
fn test_simple_clone() {
140-
let x = Rc::from_const(5);
140+
let x = Rc::from_freeze(5);
141141
let y = x.clone();
142142
assert_eq!(*x.borrow(), 5);
143143
assert_eq!(*y.borrow(), 5);
144144
}
145145

146146
#[test]
147147
fn test_destructor() {
148-
let x = Rc::from_owned(~5);
148+
let x = Rc::from_send(~5);
149149
assert_eq!(**x.borrow(), 5);
150150
}
151151
}
@@ -178,13 +178,13 @@ impl<T> RcMut<T> {
178178
}
179179

180180
impl<T: Send> RcMut<T> {
181-
pub fn from_owned(value: T) -> RcMut<T> {
181+
pub fn from_send(value: T) -> RcMut<T> {
182182
unsafe { RcMut::new(value) }
183183
}
184184
}
185185

186186
impl<T: Freeze> RcMut<T> {
187-
pub fn from_const(value: T) -> RcMut<T> {
187+
pub fn from_freeze(value: T) -> RcMut<T> {
188188
unsafe { RcMut::new(value) }
189189
}
190190
}
@@ -258,7 +258,7 @@ mod test_rc_mut {
258258

259259
#[test]
260260
fn test_clone() {
261-
let x = RcMut::from_owned(5);
261+
let x = RcMut::from_send(5);
262262
let y = x.clone();
263263
do x.with_mut_borrow |value| {
264264
*value = 20;
@@ -270,7 +270,7 @@ mod test_rc_mut {
270270

271271
#[test]
272272
fn test_deep_clone() {
273-
let x = RcMut::from_const(5);
273+
let x = RcMut::from_freeze(5);
274274
let y = x.deep_clone();
275275
do x.with_mut_borrow |value| {
276276
*value = 20;
@@ -282,7 +282,7 @@ mod test_rc_mut {
282282

283283
#[test]
284284
fn borrow_many() {
285-
let x = RcMut::from_owned(5);
285+
let x = RcMut::from_send(5);
286286
let y = x.clone();
287287

288288
do x.with_borrow |a| {
@@ -298,7 +298,7 @@ mod test_rc_mut {
298298

299299
#[test]
300300
fn modify() {
301-
let x = RcMut::from_const(5);
301+
let x = RcMut::from_freeze(5);
302302
let y = x.clone();
303303

304304
do y.with_mut_borrow |a| {
@@ -313,22 +313,22 @@ mod test_rc_mut {
313313

314314
#[test]
315315
fn release_immutable() {
316-
let x = RcMut::from_owned(5);
316+
let x = RcMut::from_send(5);
317317
do x.with_borrow |_| {}
318318
do x.with_mut_borrow |_| {}
319319
}
320320

321321
#[test]
322322
fn release_mutable() {
323-
let x = RcMut::from_const(5);
323+
let x = RcMut::from_freeze(5);
324324
do x.with_mut_borrow |_| {}
325325
do x.with_borrow |_| {}
326326
}
327327

328328
#[test]
329329
#[should_fail]
330330
fn frozen() {
331-
let x = RcMut::from_owned(5);
331+
let x = RcMut::from_send(5);
332332
let y = x.clone();
333333

334334
do x.with_borrow |_| {
@@ -340,7 +340,7 @@ mod test_rc_mut {
340340
#[test]
341341
#[should_fail]
342342
fn mutable_dupe() {
343-
let x = RcMut::from_const(5);
343+
let x = RcMut::from_freeze(5);
344344
let y = x.clone();
345345

346346
do x.with_mut_borrow |_| {
@@ -352,7 +352,7 @@ mod test_rc_mut {
352352
#[test]
353353
#[should_fail]
354354
fn mutable_freeze() {
355-
let x = RcMut::from_owned(5);
355+
let x = RcMut::from_send(5);
356356
let y = x.clone();
357357

358358
do x.with_mut_borrow |_| {
@@ -364,7 +364,7 @@ mod test_rc_mut {
364364
#[test]
365365
#[should_fail]
366366
fn restore_freeze() {
367-
let x = RcMut::from_const(5);
367+
let x = RcMut::from_freeze(5);
368368
let y = x.clone();
369369

370370
do x.with_borrow |_| {

trunk/src/librustc/middle/trans/base.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,13 +2258,15 @@ pub fn register_fn_full(ccx: @mut CrateContext,
22582258
node_type: ty::t)
22592259
-> ValueRef {
22602260
let llfty = type_of_fn_from_ty(ccx, node_type);
2261-
register_fn_fuller(ccx, sp, sym, node_id, lib::llvm::CCallConv, llfty)
2261+
register_fn_fuller(ccx, sp, sym, node_id, node_type,
2262+
lib::llvm::CCallConv, llfty)
22622263
}
22632264

22642265
pub fn register_fn_fuller(ccx: @mut CrateContext,
22652266
sp: span,
22662267
sym: ~str,
22672268
node_id: ast::NodeId,
2269+
_node_type: ty::t,
22682270
cc: lib::llvm::CallConv,
22692271
fn_ty: Type)
22702272
-> ValueRef {

trunk/src/librustc/middle/trans/foreign.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,17 @@ pub fn register_foreign_fn(ccx: @mut CrateContext,
11541154
-> ValueRef {
11551155
let _icx = push_ctxt("foreign::register_foreign_fn");
11561156

1157+
let t = ty::node_id_to_type(ccx.tcx, node_id);
11571158
let sym = Cell::new(sym);
11581159

11591160
let tys = shim_types(ccx, node_id);
11601161
do tys.fn_ty.decl_fn |fnty| {
1161-
register_fn_fuller(ccx, sp, sym.take(), node_id, lib::llvm::CCallConv, fnty)
1162+
register_fn_fuller(ccx,
1163+
sp,
1164+
sym.take(),
1165+
node_id,
1166+
t,
1167+
lib::llvm::CCallConv,
1168+
fnty)
11621169
}
11631170
}

trunk/src/test/compile-fail/rcmut-not-const-and-not-owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn o<T: Send>(_: &T) {}
1414
fn c<T: Freeze>(_: &T) {}
1515

1616
fn main() {
17-
let x = extra::rc::RcMut::from_owned(0);
17+
let x = extra::rc::RcMut::from_send(0);
1818
o(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Send`
1919
c(&x); //~ ERROR instantiating a type parameter with an incompatible type `extra::rc::RcMut<int>`, which does not fulfill `Freeze`
2020
}

0 commit comments

Comments
 (0)