Skip to content

Commit 7f36585

Browse files
committed
---
yaml --- r: 56359 b: refs/heads/auto c: a6dd7dc h: refs/heads/master i: 56357: 10f5be1 56355: 04b08d5 56351: 5808155 v: v3
1 parent adda18e commit 7f36585

Some content is hidden

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

73 files changed

+902
-743
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: bf4f088eaccfe24d4c30e7bf52e4c2bd20b9ff47
17+
refs/heads/auto: a6dd7dc1f2e1057719179e861a5a5ae55d6a8335
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/doc/rust.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,10 +1467,10 @@ A complete list of the built-in language items follows:
14671467
: Elements can be subtracted.
14681468
`mul`
14691469
: Elements can be multiplied.
1470-
`div`
1471-
: Elements can be divided.
1472-
`mod`
1473-
: Elements have a modulo operation.
1470+
`quot`
1471+
: Elements have a quotient operation.
1472+
`rem`
1473+
: Elements have a remainder operation.
14741474
`neg`
14751475
: Elements can be negated arithmetically.
14761476
`not`
@@ -1856,11 +1856,11 @@ The default meaning of the operators on standard types is given here.
18561856
: Multiplication.
18571857
Calls the `mul` method on the `core::ops::Mul` trait.
18581858
`/`
1859-
: Division.
1860-
Calls the `div` method on the `core::ops::Div` trait.
1859+
: Quotient.
1860+
Calls the `quot` method on the `core::ops::Quot` trait.
18611861
`%`
1862-
: Modulo (a.k.a. "remainder").
1863-
Calls the `modulo` method on the `core::ops::Modulo` trait.
1862+
: Remainder.
1863+
Calls the `rem` method on the `core::ops::Rem` trait.
18641864

18651865
#### Bitwise operators
18661866

branches/auto/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ The nil type, written `()`, has a single value, also written `()`.
362362
## Operators
363363

364364
Rust's set of operators contains very few surprises. Arithmetic is done with
365-
`*`, `/`, `%`, `+`, and `-` (multiply, divide, take remainder, add, and subtract). `-` is
365+
`*`, `/`, `%`, `+`, and `-` (multiply, quotient, remainder, add, and subtract). `-` is
366366
also a unary prefix operator that negates numbers. As in C, the bitwise operators
367367
`>>`, `<<`, `&`, `|`, and `^` are also supported.
368368

branches/auto/src/etc/kate/rust.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
<item> Add </item>
5858
<item> Sub </item>
5959
<item> Mul </item>
60-
<item> Div </item>
61-
<item> Modulo </item>
60+
<item> Quot </item>
61+
<item> Rem </item>
6262
<item> Neg </item>
6363
<item> BitAnd </item>
6464
<item> BitOr </item>

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
4646

4747
syn keyword rustTrait Const Copy Send Owned " inherent traits
4848
syn keyword rustTrait Eq Ord Num Ptr
49-
syn keyword rustTrait Drop Add Sub Mul Div Modulo Neg BitAnd BitOr
49+
syn keyword rustTrait Drop Add Sub Mul Quot Rem Neg BitAnd BitOr
5050
syn keyword rustTrait BitXor Shl Shr Index
5151

5252
syn keyword rustSelf self

branches/auto/src/libcore/at_vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub mod rustrt {
4141
pub fn capacity<T>(v: @[T]) -> uint {
4242
unsafe {
4343
let repr: **raw::VecRepr =
44-
::cast::reinterpret_cast(&addr_of(&v));
44+
::cast::transmute(addr_of(&v));
4545
(**repr).unboxed.alloc / sys::size_of::<T>()
4646
}
4747
}
@@ -208,7 +208,7 @@ pub mod raw {
208208
*/
209209
#[inline(always)]
210210
pub unsafe fn set_len<T>(v: @[T], new_len: uint) {
211-
let repr: **mut VecRepr = ::cast::reinterpret_cast(&addr_of(&v));
211+
let repr: **mut VecRepr = ::cast::transmute(addr_of(&v));
212212
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
213213
}
214214

@@ -226,7 +226,7 @@ pub mod raw {
226226

227227
#[inline(always)] // really pretty please
228228
pub unsafe fn push_fast<T>(v: &mut @[T], initval: T) {
229-
let repr: **mut VecRepr = ::cast::reinterpret_cast(&v);
229+
let repr: **mut VecRepr = ::cast::transmute(v);
230230
let fill = (**repr).unboxed.fill;
231231
(**repr).unboxed.fill += sys::size_of::<T>();
232232
let p = addr_of(&((**repr).unboxed.data));
@@ -322,4 +322,4 @@ mod test {
322322
assert!(from_slice([@"abc", @"123"]) == @[@"abc", @"123"]);
323323
assert!(from_slice([@[42]]) == @[@[42]]);
324324
}
325-
}
325+
}

branches/auto/src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Similar to a mutable option type, but friendlier.
2020
*/
2121

2222
pub struct Cell<T> {
23-
value: Option<T>
23+
priv value: Option<T>
2424
}
2525

2626
impl<T:cmp::Eq> cmp::Eq for Cell<T> {

branches/auto/src/libcore/char.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -234,21 +234,6 @@ pub fn escape_default(c: char) -> ~str {
234234
}
235235
}
236236

237-
/// Returns the amount of bytes this character would need if encoded in utf8
238-
pub fn len_utf8_bytes(c: char) -> uint {
239-
static max_one_b: uint = 128u;
240-
static max_two_b: uint = 2048u;
241-
static max_three_b: uint = 65536u;
242-
static max_four_b: uint = 2097152u;
243-
244-
let code = c as uint;
245-
if code < max_one_b { 1u }
246-
else if code < max_two_b { 2u }
247-
else if code < max_three_b { 3u }
248-
else if code < max_four_b { 4u }
249-
else { fail!(~"invalid character!") }
250-
}
251-
252237
/**
253238
* Compare two chars
254239
*
@@ -349,6 +334,7 @@ fn test_escape_default() {
349334
assert_eq!(escape_default('\U0001d4b6'), ~"\\U0001d4b6");
350335
}
351336
337+
352338
#[test]
353339
fn test_escape_unicode() {
354340
assert_eq!(escape_unicode('\x00'), ~"\\x00");

branches/auto/src/libcore/core.rc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ they contained the following prologue:
7575

7676
pub use kinds::{Const, Copy, Owned, Durable};
7777
pub use ops::{Drop};
78+
#[cfg(stage0)]
7879
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
80+
#[cfg(stage1)]
81+
#[cfg(stage2)]
82+
#[cfg(stage3)]
83+
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
7984
pub use ops::{BitAnd, BitOr, BitXor};
8085
pub use ops::{Shl, Shr, Index};
8186

@@ -159,9 +164,6 @@ pub mod vec;
159164
pub mod at_vec;
160165
pub mod str;
161166

162-
#[path = "str/ascii.rs"]
163-
pub mod ascii;
164-
165167
pub mod ptr;
166168
pub mod owned;
167169
pub mod managed;

branches/auto/src/libcore/gc.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,19 @@ pub mod rustrt {
7373
pub unsafe fn rust_gc_metadata() -> *Word;
7474

7575
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
76+
pub unsafe fn rust_get_c_stack() -> *StackSegment;
7677
}
7778
}
7879

7980
unsafe fn bump<T, U>(ptr: *T, count: uint) -> *U {
80-
return cast::reinterpret_cast(&ptr::offset(ptr, count));
81+
return cast::transmute(ptr::offset(ptr, count));
8182
}
8283

8384
unsafe fn align_to_pointer<T>(ptr: *T) -> *T {
8485
let align = sys::min_align_of::<*T>();
85-
let ptr: uint = cast::reinterpret_cast(&ptr);
86+
let ptr: uint = cast::transmute(ptr);
8687
let ptr = (ptr + (align - 1)) & -align;
87-
return cast::reinterpret_cast(&ptr);
88+
return cast::transmute(ptr);
8889
}
8990

9091
unsafe fn get_safe_point_count() -> uint {
@@ -129,8 +130,8 @@ type Visitor<'self> = &'self fn(root: **Word, tydesc: *Word) -> bool;
129130
// Walks the list of roots for the given safe point, and calls visitor
130131
// on each root.
131132
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
132-
let fp_bytes: *u8 = cast::reinterpret_cast(&fp);
133-
let sp_meta: *u32 = cast::reinterpret_cast(&sp.sp_meta);
133+
let fp_bytes: *u8 = cast::transmute(fp);
134+
let sp_meta: *u32 = cast::transmute(sp.sp_meta);
134135

135136
let num_stack_roots = *sp_meta as uint;
136137
let num_reg_roots = *ptr::offset(sp_meta, 1) as uint;
@@ -171,9 +172,9 @@ unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
171172

172173
// Is fp contained in segment?
173174
unsafe fn is_frame_in_segment(fp: *Word, segment: *StackSegment) -> bool {
174-
let begin: Word = cast::reinterpret_cast(&segment);
175-
let end: Word = cast::reinterpret_cast(&(*segment).end);
176-
let frame: Word = cast::reinterpret_cast(&fp);
175+
let begin: Word = cast::transmute(segment);
176+
let end: Word = cast::transmute((*segment).end);
177+
let frame: Word = cast::transmute(fp);
177178

178179
return begin <= frame && frame <= end;
179180
}
@@ -339,7 +340,7 @@ pub fn cleanup_stack_for_failure() {
339340
// own stack roots on the stack anyway.
340341
let sentinel_box = ~0;
341342
let sentinel: **Word = if expect_sentinel() {
342-
cast::reinterpret_cast(&ptr::addr_of(&sentinel_box))
343+
cast::transmute(ptr::addr_of(&sentinel_box))
343344
} else {
344345
ptr::null()
345346
};

branches/auto/src/libcore/num/f32.rs

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ use option::Option;
1616
use from_str;
1717
use to_str;
1818

19-
#[cfg(notest)] use cmp;
20-
#[cfg(notest)] use ops;
19+
#[cfg(notest)] use cmp::{Eq, Ord};
20+
#[cfg(stage0,notest)]
21+
use ops::{Add, Sub, Mul, Div, Modulo, Neg};
22+
#[cfg(stage1,notest)]
23+
#[cfg(stage2,notest)]
24+
#[cfg(stage3,notest)]
25+
use ops::{Add, Sub, Mul, Quot, Rem, Neg};
2126

2227
pub use cmath::c_float_targ_consts::*;
2328

@@ -131,7 +136,7 @@ pub fn sub(x: f32, y: f32) -> f32 { return x - y; }
131136
pub fn mul(x: f32, y: f32) -> f32 { return x * y; }
132137

133138
#[inline(always)]
134-
pub fn div(x: f32, y: f32) -> f32 { return x / y; }
139+
pub fn quot(x: f32, y: f32) -> f32 { return x / y; }
135140

136141
#[inline(always)]
137142
pub fn rem(x: f32, y: f32) -> f32 { return x % y; }
@@ -265,15 +270,15 @@ pub fn logarithm(n: f32, b: f32) -> f32 {
265270
}
266271

267272
#[cfg(notest)]
268-
impl cmp::Eq for f32 {
273+
impl Eq for f32 {
269274
#[inline(always)]
270275
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
271276
#[inline(always)]
272277
fn ne(&self, other: &f32) -> bool { (*self) != (*other) }
273278
}
274279

275280
#[cfg(notest)]
276-
impl cmp::Ord for f32 {
281+
impl Ord for f32 {
277282
#[inline(always)]
278283
fn lt(&self, other: &f32) -> bool { (*self) < (*other) }
279284
#[inline(always)]
@@ -295,33 +300,41 @@ impl num::One for f32 {
295300
}
296301

297302
#[cfg(notest)]
298-
impl ops::Add<f32,f32> for f32 {
299-
#[inline(always)]
303+
impl Add<f32,f32> for f32 {
300304
fn add(&self, other: &f32) -> f32 { *self + *other }
301305
}
302306
#[cfg(notest)]
303-
impl ops::Sub<f32,f32> for f32 {
304-
#[inline(always)]
307+
impl Sub<f32,f32> for f32 {
305308
fn sub(&self, other: &f32) -> f32 { *self - *other }
306309
}
307310
#[cfg(notest)]
308-
impl ops::Mul<f32,f32> for f32 {
309-
#[inline(always)]
311+
impl Mul<f32,f32> for f32 {
310312
fn mul(&self, other: &f32) -> f32 { *self * *other }
311313
}
312-
#[cfg(notest)]
313-
impl ops::Div<f32,f32> for f32 {
314-
#[inline(always)]
314+
#[cfg(stage0,notest)]
315+
impl Div<f32,f32> for f32 {
315316
fn div(&self, other: &f32) -> f32 { *self / *other }
316317
}
317-
#[cfg(notest)]
318-
impl ops::Modulo<f32,f32> for f32 {
318+
#[cfg(stage1,notest)]
319+
#[cfg(stage2,notest)]
320+
#[cfg(stage3,notest)]
321+
impl Quot<f32,f32> for f32 {
319322
#[inline(always)]
323+
fn quot(&self, other: &f32) -> f32 { *self / *other }
324+
}
325+
#[cfg(stage0,notest)]
326+
impl Modulo<f32,f32> for f32 {
320327
fn modulo(&self, other: &f32) -> f32 { *self % *other }
321328
}
322-
#[cfg(notest)]
323-
impl ops::Neg<f32> for f32 {
329+
#[cfg(stage1,notest)]
330+
#[cfg(stage2,notest)]
331+
#[cfg(stage3,notest)]
332+
impl Rem<f32,f32> for f32 {
324333
#[inline(always)]
334+
fn rem(&self, other: &f32) -> f32 { *self % *other }
335+
}
336+
#[cfg(notest)]
337+
impl Neg<f32> for f32 {
325338
fn neg(&self) -> f32 { -*self }
326339
}
327340

0 commit comments

Comments
 (0)