Skip to content

Commit cd27b93

Browse files
committed
---
yaml --- r: 128483 b: refs/heads/auto c: a4bbb5b h: refs/heads/master i: 128481: c698486 128479: d15f566 v: v3
1 parent c7ac9e2 commit cd27b93

File tree

11 files changed

+50
-146
lines changed

11 files changed

+50
-146
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: c8835104797335818bc1d5b0df61ce9f5907cd16
16+
refs/heads/auto: a4bbb5bab4ea49bc0f4cb9638f27a7eb68e1bdb6
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/guide.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ note: in expansion of format_args!
517517
<std macros>:1:1: 3:2 note: in expansion of println!
518518
src/hello_world.rs:4:5: 4:42 note: expansion site
519519
error: aborting due to previous error
520-
Could not compile `hello_world`.
520+
Could not execute process `rustc src/hello_world.rs --crate-type bin --out-dir /home/you/projects/hello_world/target -L /home/you/projects/hello_world/target -L /home/you/projects/hello_world/target/deps` (status=101)
521521
```
522522

523523
Rust will not let us use a value that has not been initialized. So why let us
@@ -532,7 +532,7 @@ in the middle of a string." We add a comma, and then `x`, to indicate that we
532532
want `x` to be the value we're interpolating. The comma is used to separate
533533
arguments we pass to functions and macros, if you're passing more than one.
534534

535-
When you just use the curly braces, Rust will attempt to display the
535+
When you just use the double curly braces, Rust will attempt to display the
536536
value in a meaningful way by checking out its type. If you want to specify the
537537
format in a more detailed manner, there are a [wide number of options
538538
available](/std/fmt/index.html). For now, we'll just stick to the default:
@@ -1888,16 +1888,8 @@ fn main() {
18881888

18891889
The first thing we changed was to `use std::rand`, as the docs
18901890
explained. We then added in a `let` expression to create a variable binding
1891-
named `secret_number`, and we printed out its result.
1892-
1893-
Also, you may wonder why we are using `%` on the result of `rand::random()`.
1894-
This operator is called 'modulo', and it returns the remainder of a division.
1895-
By taking the modulo of the result of `rand::random()`, we're limiting the
1896-
values to be between 0 and 99. Then, we add one to the result, making it from 1
1897-
to 100. Using modulo can give you a very, very small bias in the result, but
1898-
for this example, it is not important.
1899-
1900-
Let's try to compile this using `cargo build`:
1891+
named `secret_number`, and we printed out its result. Let's try to compile
1892+
this using `cargo build`:
19011893

19021894
```{notrust,no_run}
19031895
$ cargo build

branches/auto/src/doc/rust.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ sequence (`/**`), are interpreted as a special syntax for `doc`
169169
`#[doc="..."]` around the body of the comment (this includes the comment
170170
characters themselves, ie `/// Foo` turns into `#[doc="/// Foo"]`).
171171

172-
`//!` comments apply to the parent of the comment, rather than the item that
173-
follows. `//!` comments are usually used to display information on the crate
174-
index page.
175-
176172
Non-doc comments are interpreted as a form of whitespace.
177173

178174
## Whitespace

branches/auto/src/libcollections/bitv.rs

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use core::prelude::*;
6666
use core::cmp;
6767
use core::default::Default;
6868
use core::fmt;
69-
use core::iter::{Chain, Enumerate, Repeat, Skip, Take};
69+
use core::iter::Take;
7070
use core::iter;
7171
use core::slice;
7272
use core::uint;
@@ -75,22 +75,25 @@ use std::hash;
7575
use {Mutable, Set, MutableSet, MutableSeq};
7676
use vec::Vec;
7777

78-
type MatchWords<'a> = Chain<MaskWords<'a>, Skip<Take<Enumerate<Repeat<uint>>>>>;
7978
// Take two BitV's, and return iterators of their words, where the shorter one
8079
// has been padded with 0's
81-
fn match_words <'a,'b>(a: &'a Bitv, b: &'b Bitv) -> (MatchWords<'a>, MatchWords<'b>) {
82-
let a_len = a.storage.len();
83-
let b_len = b.storage.len();
84-
85-
// have to uselessly pretend to pad the longer one for type matching
86-
if a_len < b_len {
87-
(a.mask_words(0).chain(Repeat::new(0u).enumerate().take(b_len).skip(a_len)),
88-
b.mask_words(0).chain(Repeat::new(0u).enumerate().take(0).skip(0)))
89-
} else {
90-
(a.mask_words(0).chain(Repeat::new(0u).enumerate().take(0).skip(0)),
91-
b.mask_words(0).chain(Repeat::new(0u).enumerate().take(a_len).skip(b_len)))
92-
}
93-
}
80+
macro_rules! match_words(
81+
($a_expr:expr, $b_expr:expr) => ({
82+
let a = $a_expr;
83+
let b = $b_expr;
84+
let a_len = a.storage.len();
85+
let b_len = b.storage.len();
86+
87+
// have to uselessly pretend to pad the longer one for type matching
88+
if a_len < b_len {
89+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(b_len).skip(a_len)),
90+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)))
91+
} else {
92+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)),
93+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(a_len).skip(b_len)))
94+
}
95+
})
96+
)
9497

9598
static TRUE: bool = true;
9699
static FALSE: bool = false;
@@ -1011,23 +1014,23 @@ impl Extendable<bool> for BitvSet {
10111014
impl PartialOrd for BitvSet {
10121015
#[inline]
10131016
fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> {
1014-
let (a_iter, b_iter) = match_words(self.get_ref(), other.get_ref());
1017+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
10151018
iter::order::partial_cmp(a_iter, b_iter)
10161019
}
10171020
}
10181021

10191022
impl Ord for BitvSet {
10201023
#[inline]
10211024
fn cmp(&self, other: &BitvSet) -> Ordering {
1022-
let (a_iter, b_iter) = match_words(self.get_ref(), other.get_ref());
1025+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
10231026
iter::order::cmp(a_iter, b_iter)
10241027
}
10251028
}
10261029

10271030
impl cmp::PartialEq for BitvSet {
10281031
#[inline]
10291032
fn eq(&self, other: &BitvSet) -> bool {
1030-
let (a_iter, b_iter) = match_words(self.get_ref(), other.get_ref());
1033+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
10311034
iter::order::eq(a_iter, b_iter)
10321035
}
10331036
}
@@ -1188,10 +1191,10 @@ impl BitvSet {
11881191
self_bitv.reserve(other_bitv.capacity());
11891192

11901193
// virtually pad other with 0's for equal lengths
1191-
let mut other_words = {
1192-
let (_, result) = match_words(self_bitv, other_bitv);
1193-
result
1194-
};
1194+
let self_len = self_bitv.storage.len();
1195+
let other_len = other_bitv.storage.len();
1196+
let mut other_words = other_bitv.mask_words(0)
1197+
.chain(iter::Repeat::new(0u).enumerate().take(self_len).skip(other_len));
11951198

11961199
// Apply values found in other
11971200
for (i, w) in other_words {
@@ -1521,7 +1524,7 @@ impl Set<uint> for BitvSet {
15211524

15221525
#[inline]
15231526
fn is_disjoint(&self, other: &BitvSet) -> bool {
1524-
self.intersection(other).next().is_none()
1527+
self.intersection(other).count() > 0
15251528
}
15261529

15271530
#[inline]
@@ -2263,24 +2266,6 @@ mod tests {
22632266
assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 }
22642267
}
22652268

2266-
#[test]
2267-
fn test_bitv_set_is_disjoint() {
2268-
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2269-
let b = BitvSet::from_bitv(from_bytes([0b01000000]));
2270-
let c = BitvSet::new();
2271-
let d = BitvSet::from_bitv(from_bytes([0b00110000]));
2272-
2273-
assert!(!a.is_disjoint(&d));
2274-
assert!(!d.is_disjoint(&a));
2275-
2276-
assert!(a.is_disjoint(&b))
2277-
assert!(a.is_disjoint(&c))
2278-
assert!(b.is_disjoint(&a))
2279-
assert!(b.is_disjoint(&c))
2280-
assert!(c.is_disjoint(&a))
2281-
assert!(c.is_disjoint(&b))
2282-
}
2283-
22842269
#[test]
22852270
fn test_bitv_set_intersect_with() {
22862271
// Explicitly 0'ed bits

branches/auto/src/libcollections/str.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ the string is valid for the `'static` lifetime, otherwise known as the
4444
lifetime of the entire program. As can be inferred from the type, these static
4545
strings are not mutable.
4646
47+
# Mutability
48+
49+
Many languages have immutable strings by default, and Rust has a particular
50+
flavor on this idea. As with the rest of Rust types, strings are immutable by
51+
default. If a string is declared as `mut`, however, it may be mutated. This
52+
works the same way as the rest of Rust's type system in the sense that if
53+
there's a mutable reference to a string, there may only be one mutable reference
54+
to that string. With these guarantees, strings can easily transition between
55+
being mutable/immutable with the same benefits of having mutable strings in
56+
other languages.
57+
4758
# Representation
4859
4960
Rust's string type, `str`, is a sequence of unicode scalar values encoded as a

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,19 +1345,17 @@ checked_impl!(CheckedMul, checked_mul, i16, intrinsics::i16_mul_with_overflow)
13451345
checked_impl!(CheckedMul, checked_mul, i32, intrinsics::i32_mul_with_overflow)
13461346
checked_impl!(CheckedMul, checked_mul, i64, intrinsics::i64_mul_with_overflow)
13471347

1348-
/// Performs division that returns `None` instead of failing on division by zero and instead of
1349-
/// wrapping around on underflow and overflow.
1348+
/// Performs division that returns `None` instead of wrapping around on underflow or overflow.
13501349
pub trait CheckedDiv: Div<Self, Self> {
1351-
/// Divides two numbers, checking for underflow, overflow and division by zero. If any of that
1352-
/// happens, / `None` is returned.
1350+
/// Divides two numbers, checking for underflow or overflow. If underflow or overflow happens,
1351+
/// `None` is returned.
13531352
///
13541353
/// # Example
13551354
///
13561355
/// ```rust
13571356
/// use std::num::CheckedDiv;
13581357
/// assert_eq!((-127i8).checked_div(&-1), Some(127));
13591358
/// assert_eq!((-128i8).checked_div(&-1), None);
1360-
/// assert_eq!((1i8).checked_div(&0), None);
13611359
/// ```
13621360
fn checked_div(&self, v: &Self) -> Option<Self>;
13631361
}

branches/auto/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<T> Option<T> {
244244
}
245245
}
246246

247-
/// Returns the inner `T` of a `Some(T)`.
247+
/// Moves a value out of an option type and returns it, consuming the `Option`.
248248
///
249249
/// # Failure
250250
///

branches/auto/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ enum Searcher {
562562
impl Searcher {
563563
fn new(haystack: &[u8], needle: &[u8]) -> Searcher {
564564
// FIXME: Tune this.
565-
if needle.len() > haystack.len() - 20 {
565+
if needle.len() + 20 > haystack.len() {
566566
Naive(NaiveSearcher::new())
567567
} else {
568568
let searcher = TwoWaySearcher::new(needle);

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ use std::cell::{Cell, RefCell};
8787
use std::rc::Rc;
8888
use std::{i8, i16, i32, i64};
8989
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustCall};
90-
use syntax::abi::{RustIntrinsic, Abi, OsWindows};
90+
use syntax::abi::{RustIntrinsic, Abi};
9191
use syntax::ast_util::{local_def, is_local};
9292
use syntax::attr::AttrMetaMethods;
9393
use syntax::attr;
@@ -2446,13 +2446,6 @@ pub fn create_entry_wrapper(ccx: &CrateContext,
24462446
&ccx.int_type);
24472447

24482448
let llfn = decl_cdecl_fn(ccx, "main", llfty, ty::mk_nil());
2449-
2450-
// FIXME: #16581: Marking a symbol in the executable with `dllexport`
2451-
// linkage forces MinGW's linker to output a `.reloc` section for ASLR
2452-
if ccx.sess().targ_cfg.os == OsWindows {
2453-
unsafe { llvm::LLVMRustSetDLLExportStorageClass(llfn) }
2454-
}
2455-
24562449
let llbb = "top".with_c_str(|buf| {
24572450
unsafe {
24582451
llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)

branches/auto/src/libstd/io/fs.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,10 @@ impl File {
236236
})
237237
}
238238

239-
/// Returns true if the stream has reached the end of the file.
239+
/// Tests whether this stream has reached EOF.
240240
///
241241
/// If true, then this file will no longer continue to return data via
242242
/// `read`.
243-
///
244-
/// Note that the operating system will not return an `EOF` indicator
245-
/// until you have attempted to read past the end of the file, so if
246-
/// you've read _exactly_ the number of bytes in the file, this will
247-
/// return `false`, not `true`.
248243
pub fn eof(&self) -> bool {
249244
self.last_nread == 0
250245
}

branches/auto/src/libtime/lib.rs

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 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
//
@@ -90,30 +90,6 @@ impl Timespec {
9090
}
9191
}
9292

93-
impl Add<Timespec, Timespec> for Timespec {
94-
fn add(&self, other: &Timespec) -> Timespec {
95-
let mut sec = self.sec + other.sec;
96-
let mut nsec = self.nsec + other.nsec;
97-
if nsec >= NSEC_PER_SEC {
98-
nsec -= NSEC_PER_SEC;
99-
sec += 1;
100-
}
101-
Timespec::new(sec, nsec)
102-
}
103-
}
104-
105-
impl Sub<Timespec, Timespec> for Timespec {
106-
fn sub(&self, other: &Timespec) -> Timespec {
107-
let mut sec = self.sec - other.sec;
108-
let mut nsec = self.nsec - other.nsec;
109-
if nsec < 0 {
110-
nsec += NSEC_PER_SEC;
111-
sec -= 1;
112-
}
113-
Timespec::new(sec, nsec)
114-
}
115-
}
116-
11793
/**
11894
* Returns the current time as a `timespec` containing the seconds and
11995
* nanoseconds since 1970-01-01T00:00:00Z.
@@ -1513,46 +1489,6 @@ mod tests {
15131489
assert!(d.gt(c));
15141490
}
15151491

1516-
fn test_timespec_add() {
1517-
let a = Timespec::new(1, 2);
1518-
let b = Timespec::new(2, 3);
1519-
let c = a + b;
1520-
assert_eq!(c.sec, 3);
1521-
assert_eq!(c.nsec, 5);
1522-
1523-
let p = Timespec::new(1, super::NSEC_PER_SEC - 2);
1524-
let q = Timespec::new(2, 2);
1525-
let r = p + q;
1526-
assert_eq!(r.sec, 4);
1527-
assert_eq!(r.nsec, 0);
1528-
1529-
let u = Timespec::new(1, super::NSEC_PER_SEC - 2);
1530-
let v = Timespec::new(2, 3);
1531-
let w = u + v;
1532-
assert_eq!(w.sec, 4);
1533-
assert_eq!(w.nsec, 1);
1534-
}
1535-
1536-
fn test_timespec_sub() {
1537-
let a = Timespec::new(2, 3);
1538-
let b = Timespec::new(1, 2);
1539-
let c = a - b;
1540-
assert_eq!(c.sec, 1);
1541-
assert_eq!(c.nsec, 1);
1542-
1543-
let p = Timespec::new(2, 0);
1544-
let q = Timespec::new(1, 2);
1545-
let r = p - q;
1546-
assert_eq!(r.sec, 0);
1547-
assert_eq!(r.nsec, super::NSEC_PER_SEC - 2);
1548-
1549-
let u = Timespec::new(1, 2);
1550-
let v = Timespec::new(2, 3);
1551-
let w = u - v;
1552-
assert_eq!(w.sec, -2);
1553-
assert_eq!(w.nsec, super::NSEC_PER_SEC - 1);
1554-
}
1555-
15561492
#[test]
15571493
#[ignore(cfg(target_os = "android"))] // FIXME #10958
15581494
fn run_tests() {
@@ -1569,8 +1505,6 @@ mod tests {
15691505
test_ctime();
15701506
test_strftime();
15711507
test_timespec_eq_ord();
1572-
test_timespec_add();
1573-
test_timespec_sub();
15741508
}
15751509

15761510
#[bench]

0 commit comments

Comments
 (0)