Skip to content

Commit c3e12cd

Browse files
committed
---
yaml --- r: 140634 b: refs/heads/try2 c: 5617916 h: refs/heads/master v: v3
1 parent 4435475 commit c3e12cd

File tree

214 files changed

+2053
-1631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+2053
-1631
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0c02d0f92ecabb9486482c3e4d660e736346803b
8+
refs/heads/try2: 5617916726186290710dade90057683904a5f215
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial-ffi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub struct Unique<T> {
157157
priv ptr: *mut T
158158
}
159159
160-
pub impl<'self, T: Owned> Unique<T> {
160+
pub impl<T: Owned> Unique<T> {
161161
fn new(value: T) -> Unique<T> {
162162
unsafe {
163163
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
@@ -168,14 +168,14 @@ pub impl<'self, T: Owned> Unique<T> {
168168
}
169169
}
170170
171-
// the 'self lifetime results in the same semantics as `&*x` with ~T
172-
fn borrow(&self) -> &'self T {
173-
unsafe { cast::transmute(self.ptr) }
171+
// the 'r lifetime results in the same semantics as `&*x` with ~T
172+
fn borrow<'r>(&'r self) -> &'r T {
173+
unsafe { cast::copy_lifetime(self, &*self.ptr) }
174174
}
175175
176-
// the 'self lifetime results in the same semantics as `&mut *x` with ~T
177-
fn borrow_mut(&mut self) -> &'self mut T {
178-
unsafe { cast::transmute(self.ptr) }
176+
// the 'r lifetime results in the same semantics as `&mut *x` with ~T
177+
fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
178+
unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }
179179
}
180180
}
181181

branches/try2/src/libcore/at_vec.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub mod rustrt {
2929
#[abi = "cdecl"]
3030
#[link_name = "rustrt"]
3131
pub extern {
32-
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
33-
++v: **vec::raw::VecRepr,
34-
++n: libc::size_t);
32+
pub unsafe fn vec_reserve_shared_actual(t: *sys::TypeDesc,
33+
v: **vec::raw::VecRepr,
34+
n: libc::size_t);
3535
}
3636
}
3737

@@ -60,7 +60,7 @@ pub fn capacity<T>(v: @[T]) -> uint {
6060
pub fn build_sized<A>(size: uint, builder: &fn(push: &fn(v: A))) -> @[A] {
6161
let mut vec: @[A] = @[];
6262
unsafe { raw::reserve(&mut vec, size); }
63-
builder(|+x| unsafe { raw::push(&mut vec, x) });
63+
builder(|x| unsafe { raw::push(&mut vec, x) });
6464
return unsafe { transmute(vec) };
6565
}
6666

@@ -102,7 +102,7 @@ pub fn build_sized_opt<A>(size: Option<uint>,
102102
#[inline(always)]
103103
pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
104104
do build_sized(lhs.len() + rhs.len()) |push| {
105-
for vec::each(lhs) |x| { push(*x); }
105+
for lhs.each |x| { push(*x); }
106106
for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
107107
}
108108
}
@@ -111,7 +111,7 @@ pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
111111
/// Apply a function to each element of a vector and return the results
112112
pub fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
113113
do build_sized(v.len()) |push| {
114-
for vec::each(v) |elem| {
114+
for v.each |elem| {
115115
push(f(elem));
116116
}
117117
}
@@ -166,7 +166,7 @@ pub fn from_slice<T:Copy>(v: &[T]) -> @[T] {
166166
from_fn(v.len(), |i| v[i])
167167
}
168168

169-
#[cfg(notest)]
169+
#[cfg(not(test))]
170170
pub mod traits {
171171
use at_vec::append;
172172
use kinds::Copy;

branches/try2/src/libcore/bool.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Boolean logic
1212
13-
#[cfg(notest)]
13+
#[cfg(not(test))]
1414
use cmp::{Eq, Ord, TotalOrd, Ordering};
1515
use option::{None, Option, Some};
1616
use from_str::FromStr;
@@ -75,7 +75,7 @@ pub fn all_values(blk: &fn(v: bool)) {
7575
#[inline(always)]
7676
pub fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
7777

78-
#[cfg(notest)]
78+
#[cfg(not(test))]
7979
impl Ord for bool {
8080
#[inline(always)]
8181
fn lt(&self, other: &bool) -> bool { to_bit(*self) < to_bit(*other) }
@@ -87,13 +87,13 @@ impl Ord for bool {
8787
fn ge(&self, other: &bool) -> bool { to_bit(*self) >= to_bit(*other) }
8888
}
8989

90-
#[cfg(notest)]
90+
#[cfg(not(test))]
9191
impl TotalOrd for bool {
9292
#[inline(always)]
9393
fn cmp(&self, other: &bool) -> Ordering { to_bit(*self).cmp(&to_bit(*other)) }
9494
}
9595

96-
#[cfg(notest)]
96+
#[cfg(not(test))]
9797
impl Eq for bool {
9898
#[inline(always)]
9999
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }

branches/try2/src/libcore/cast.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod rusti {
1717
#[abi = "rust-intrinsic"]
1818
#[link_name = "rusti"]
1919
pub extern "rust-intrinsic" {
20-
fn forget<T>(+x: T);
20+
fn forget<T>(x: T);
2121

2222
fn transmute<T,U>(e: T) -> U;
2323
}
@@ -108,6 +108,12 @@ pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
108108
transmute_region(ptr)
109109
}
110110

111+
/// Transforms lifetime of the second pointer to match the first.
112+
#[inline(always)]
113+
pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
114+
transmute_mut_region(ptr)
115+
}
116+
111117
/// Transforms lifetime of the second pointer to match the first.
112118
#[inline(always)]
113119
pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {

branches/try2/src/libcore/char.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
//! Utilities for manipulating the char type
1212
13-
#[cfg(notest)]
13+
#[cfg(not(test))]
1414
use cmp::Ord;
1515
use option::{None, Option, Some};
1616
use str;
1717
use u32;
1818
use uint;
1919
use unicode::{derived_property, general_category};
2020

21-
#[cfg(notest)] use cmp::Eq;
21+
#[cfg(not(test))] use cmp::Eq;
2222

2323
/*
2424
Lu Uppercase_Letter an uppercase letter
@@ -244,15 +244,15 @@ pub fn len_utf8_bytes(c: char) -> uint {
244244
else { fail!(~"invalid character!") }
245245
}
246246
247-
#[cfg(notest)]
247+
#[cfg(not(test))]
248248
impl Eq for char {
249249
#[inline(always)]
250250
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
251251
#[inline(always)]
252252
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
253253
}
254254
255-
#[cfg(notest)]
255+
#[cfg(not(test))]
256256
impl Ord for char {
257257
#[inline(always)]
258258
fn lt(&self, other: &char) -> bool { *self < *other }

branches/try2/src/libcore/cleanup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
18-
#[cfg(notest)] use unstable::lang::clear_task_borrow_list;
18+
#[cfg(not(test))] use unstable::lang::clear_task_borrow_list;
1919

20-
#[cfg(notest)] use ptr::to_unsafe_ptr;
20+
#[cfg(not(test))] use ptr::to_unsafe_ptr;
2121

2222
/**
2323
* Runtime structures
@@ -164,7 +164,7 @@ fn debug_mem() -> bool {
164164
}
165165

166166
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
167-
#[cfg(notest)]
167+
#[cfg(not(test))]
168168
#[lang="annihilate"]
169169
pub unsafe fn annihilate() {
170170
use unstable::lang::local_free;

0 commit comments

Comments
 (0)