Skip to content

Commit d55e54d

Browse files
author
Jakub Bukaj
committed
---
yaml --- r: 160071 b: refs/heads/try c: f3fd09a h: refs/heads/master i: 160069: f8895c3 160067: 34e15fc 160063: 3e5e91f v: v3
1 parent 713572c commit d55e54d

File tree

19 files changed

+308
-138
lines changed

19 files changed

+308
-138
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: e09d98603e608c9e47d4c89f7b4dca87a4b56da3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9c96a79a74f10bed18b031ce0ac4126c56d6cfb3
5-
refs/heads/try: 5416901ccad4550b6f7a6145de5dbbe94b98e309
5+
refs/heads/try: f3fd09a6f57bb9b634a38e672bcd51ef0922dbe1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/guide-pointers.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ pass-by-reference. Basically, languages can make two choices (this is made
133133
up syntax, it's not Rust):
134134

135135
```{notrust,ignore}
136-
fn foo(x) {
136+
func foo(x) {
137137
x = 5
138138
}
139139
140-
fn main() {
140+
func main() {
141141
i = 1
142142
foo(i)
143143
// what is the value of i here?
@@ -153,11 +153,11 @@ So what do pointers have to do with this? Well, since pointers point to a
153153
location in memory...
154154

155155
```{notrust,ignore}
156-
fn foo(&int x) {
156+
func foo(&int x) {
157157
*x = 5
158158
}
159159
160-
fn main() {
160+
func main() {
161161
i = 1
162162
foo(&i)
163163
// what is the value of i here?
@@ -192,13 +192,13 @@ When you combine pointers and functions, it's easy to accidentally invalidate
192192
the memory the pointer is pointing to. For example:
193193

194194
```{notrust,ignore}
195-
fn make_pointer(): &int {
195+
func make_pointer(): &int {
196196
x = 5;
197197
198198
return &x;
199199
}
200200
201-
fn main() {
201+
func main() {
202202
&int i = make_pointer();
203203
*i = 5; // uh oh!
204204
}
@@ -214,11 +214,11 @@ issue. Two pointers are said to alias when they point at the same location
214214
in memory. Like this:
215215

216216
```{notrust,ignore}
217-
fn mutate(&int i, int j) {
217+
func mutate(&int i, int j) {
218218
*i = j;
219219
}
220220
221-
fn main() {
221+
func main() {
222222
x = 5;
223223
y = &x;
224224
z = &x; //y and z are aliased

branches/try/src/doc/po4a.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[type: text] src/doc/guide-tasks.md $lang:doc/l10n/$lang/guide-tasks.md
2020
[type: text] src/doc/guide-testing.md $lang:doc/l10n/$lang/guide-testing.md
2121
[type: text] src/doc/guide-unsafe.md $lang:doc/l10n/$lang/guide-unsafe.md
22-
[type: text] src/doc/guide-unsafe.md $lang:doc/l10n/$lang/guide-crates.md
22+
[type: text] src/doc/guide-crates.md $lang:doc/l10n/$lang/guide-crates.md
2323
[type: text] src/doc/guide.md $lang:doc/l10n/$lang/guide.md
2424
[type: text] src/doc/index.md $lang:doc/l10n/$lang/index.md
2525
[type: text] src/doc/intro.md $lang:doc/l10n/$lang/intro.md

branches/try/src/doc/reference.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,9 +2653,10 @@ An expression may have two roles: it always produces a *value*, and it may have
26532653
value, and has effects during *evaluation*. Many expressions contain
26542654
sub-expressions (operands). The meaning of each kind of expression dictates
26552655
several things:
2656-
* Whether or not to evaluate the sub-expressions when evaluating the
2657-
* expression The order in which to evaluate the sub-expressions How to
2658-
* combine the sub-expressions' values to obtain the value of the expression.
2656+
2657+
* Whether or not to evaluate the sub-expressions when evaluating the expression
2658+
* The order in which to evaluate the sub-expressions
2659+
* How to combine the sub-expressions' values to obtain the value of the expression
26592660

26602661
In this way, the structure of expressions dictates the structure of execution.
26612662
Blocks are just another kind of expression, so blocks, statements, expressions,

branches/try/src/etc/snapshot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def full_snapshot_name(date, rev, platform, hsh):
7575

7676

7777
def get_kernel(triple):
78-
os_name = triple.split('-')[2]
78+
t = triple.split('-')
79+
if len(t) == 2:
80+
os_name = t[1]
81+
else:
82+
os_name = t[2]
7983
if os_name == "windows":
8084
return "winnt"
8185
if os_name == "darwin":

branches/try/src/libcollections/tree/set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,9 @@ impl<T: Ord> TreeSet<T> {
504504
/// # Example
505505
///
506506
/// ```
507-
/// use std::collections::BTreeSet;
507+
/// use std::collections::TreeSet;
508508
///
509-
/// let mut set = BTreeSet::new();
509+
/// let mut set = TreeSet::new();
510510
///
511511
/// assert_eq!(set.insert(2i), true);
512512
/// assert_eq!(set.insert(2i), false);
@@ -522,9 +522,9 @@ impl<T: Ord> TreeSet<T> {
522522
/// # Example
523523
///
524524
/// ```
525-
/// use std::collections::BTreeSet;
525+
/// use std::collections::TreeSet;
526526
///
527-
/// let mut set = BTreeSet::new();
527+
/// let mut set = TreeSet::new();
528528
///
529529
/// set.insert(2i);
530530
/// assert_eq!(set.remove(&2), true);

branches/try/src/libcore/cell.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157

158158
use clone::Clone;
159159
use cmp::PartialEq;
160+
use default::Default;
160161
use kinds::{marker, Copy};
161162
use ops::{Deref, DerefMut, Drop};
162163
use option::{None, Option, Some};
@@ -211,6 +212,13 @@ impl<T:Copy> Clone for Cell<T> {
211212
}
212213
}
213214

215+
#[unstable]
216+
impl<T:Default + Copy> Default for Cell<T> {
217+
fn default() -> Cell<T> {
218+
Cell::new(Default::default())
219+
}
220+
}
221+
214222
#[unstable = "waiting for `PartialEq` trait to become stable"]
215223
impl<T:PartialEq + Copy> PartialEq for Cell<T> {
216224
fn eq(&self, other: &Cell<T>) -> bool {
@@ -337,6 +345,13 @@ impl<T: Clone> Clone for RefCell<T> {
337345
}
338346
}
339347

348+
#[unstable]
349+
impl<T:Default> Default for RefCell<T> {
350+
fn default() -> RefCell<T> {
351+
RefCell::new(Default::default())
352+
}
353+
}
354+
340355
#[unstable = "waiting for `PartialEq` to become stable"]
341356
impl<T: PartialEq> PartialEq for RefCell<T> {
342357
fn eq(&self, other: &RefCell<T>) -> bool {

branches/try/src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
//! a bug.
268268
//!
269269
//! A module that instead returns `Results` is alerting the caller
270-
//! that panics are possible, and providing precise control over how
270+
//! that failure is possible, and providing precise control over how
271271
//! it is handled.
272272
//!
273273
//! Furthermore, panics may not be recoverable at all, depending on

branches/try/src/libcoretest/cell.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use core::cell::*;
12+
use core::default::Default;
1213
use std::mem::drop;
1314

1415
#[test]
@@ -146,3 +147,15 @@ fn as_unsafe_cell() {
146147
unsafe { *r2.as_unsafe_cell().get() = 1u; }
147148
assert_eq!(1u, *r2.borrow());
148149
}
150+
151+
#[test]
152+
fn cell_default() {
153+
let cell: Cell<u32> = Default::default();
154+
assert_eq!(0, cell.get());
155+
}
156+
157+
#[test]
158+
fn refcell_default() {
159+
let cell: RefCell<u64> = Default::default();
160+
assert_eq!(0, *cell.borrow());
161+
}

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,12 @@ pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> Vec<ast_map::PathElem> {
630630
item_path(lookup_item(id, cdata.data()))
631631
}
632632

633-
pub type DecodeInlinedItem<'a> = <'tcx> |cdata: Cmd,
634-
tcx: &ty::ctxt<'tcx>,
635-
path: Vec<ast_map::PathElem>,
636-
par_doc: rbml::Doc|: 'a
637-
-> Result<&'tcx ast::InlinedItem,
638-
Vec<ast_map::PathElem>>;
633+
pub type DecodeInlinedItem<'a> = for<'tcx> |cdata: Cmd,
634+
tcx: &ty::ctxt<'tcx>,
635+
path: Vec<ast_map::PathElem>,
636+
par_doc: rbml::Doc|: 'a
637+
-> Result<&'tcx ast::InlinedItem,
638+
Vec<ast_map::PathElem>>;
639639

640640
pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &ty::ctxt<'tcx>, id: ast::NodeId,
641641
decode_inlined_item: DecodeInlinedItem)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,8 @@ pub fn trans_closure(ccx: &CrateContext,
17871787
abi: Abi,
17881788
has_env: bool,
17891789
is_unboxed_closure: IsUnboxedClosureFlag,
1790-
maybe_load_env: <'blk, 'tcx> |Block<'blk, 'tcx>, ScopeId|
1791-
-> Block<'blk, 'tcx>) {
1790+
maybe_load_env: for<'blk, 'tcx> |Block<'blk, 'tcx>, ScopeId|
1791+
-> Block<'blk, 'tcx>) {
17921792
ccx.stats().n_closures.set(ccx.stats().n_closures.get() + 1);
17931793

17941794
let _icx = push_ctxt("trans_closure");

branches/try/src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type,
528528
fn make_generic_glue(ccx: &CrateContext,
529529
t: ty::t,
530530
llfn: ValueRef,
531-
helper: <'blk, 'tcx> |Block<'blk, 'tcx>, ValueRef, ty::t|
532-
-> Block<'blk, 'tcx>,
531+
helper: for<'blk, 'tcx> |Block<'blk, 'tcx>, ValueRef, ty::t|
532+
-> Block<'blk, 'tcx>,
533533
name: &str)
534534
-> ValueRef {
535535
let _icx = push_ctxt("make_generic_glue");

branches/try/src/librustdoc/html/static/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,9 @@ pre.rust { position: relative; }
584584
height: 1.5em;
585585
}
586586
}
587+
588+
@media print {
589+
nav.sub, .content .out-of-band, .collapse-toggle {
590+
display: none;
591+
}
592+
}

branches/try/src/libserialize/json.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,6 +2315,10 @@ impl ToJson for bool {
23152315
fn to_json(&self) -> Json { Boolean(*self) }
23162316
}
23172317

2318+
impl ToJson for str {
2319+
fn to_json(&self) -> Json { String(self.into_string()) }
2320+
}
2321+
23182322
impl ToJson for string::String {
23192323
fn to_json(&self) -> Json { String((*self).clone()) }
23202324
}
@@ -3714,7 +3718,8 @@ mod tests {
37143718
assert_eq!(f64::NAN.to_json(), Null);
37153719
assert_eq!(true.to_json(), Boolean(true));
37163720
assert_eq!(false.to_json(), Boolean(false));
3717-
assert_eq!("abc".to_string().to_json(), String("abc".to_string()));
3721+
assert_eq!("abc".to_json(), String("abc".into_string()));
3722+
assert_eq!("abc".into_string().to_json(), String("abc".into_string()));
37183723
assert_eq!((1u, 2u).to_json(), list2);
37193724
assert_eq!((1u, 2u, 3u).to_json(), list3);
37203725
assert_eq!([1u, 2].to_json(), list2);

branches/try/src/libstd/io/mod.rs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,16 +1437,6 @@ pub trait Buffer: Reader {
14371437
)
14381438
}
14391439

1440-
/// Create an iterator that reads a line on each iteration until EOF.
1441-
///
1442-
/// # Error
1443-
///
1444-
/// Any error other than `EndOfFile` that is produced by the underlying Reader
1445-
/// is returned by the iterator and should be handled by the caller.
1446-
fn lines<'r>(&'r mut self) -> Lines<'r, Self> {
1447-
Lines { buffer: self }
1448-
}
1449-
14501440
/// Reads a sequence of bytes leading up to a specified delimiter. Once the
14511441
/// specified byte is encountered, reading ceases and the bytes up to and
14521442
/// including the delimiter are returned.
@@ -1522,17 +1512,36 @@ pub trait Buffer: Reader {
15221512
None => Err(standard_error(InvalidInput))
15231513
}
15241514
}
1515+
}
15251516

1517+
/// Extension methods for the Buffer trait which are included in the prelude.
1518+
pub trait BufferPrelude {
15261519
/// Create an iterator that reads a utf8-encoded character on each iteration
15271520
/// until EOF.
15281521
///
15291522
/// # Error
15301523
///
15311524
/// Any error other than `EndOfFile` that is produced by the underlying Reader
15321525
/// is returned by the iterator and should be handled by the caller.
1533-
fn chars<'r>(&'r mut self) -> Chars<'r, Self> {
1526+
fn chars<'r>(&'r mut self) -> Chars<'r, Self>;
1527+
1528+
/// Create an iterator that reads a line on each iteration until EOF.
1529+
///
1530+
/// # Error
1531+
///
1532+
/// Any error other than `EndOfFile` that is produced by the underlying Reader
1533+
/// is returned by the iterator and should be handled by the caller.
1534+
fn lines<'r>(&'r mut self) -> Lines<'r, Self>;
1535+
}
1536+
1537+
impl<T: Buffer> BufferPrelude for T {
1538+
fn chars<'r>(&'r mut self) -> Chars<'r, T> {
15341539
Chars { buffer: self }
15351540
}
1541+
1542+
fn lines<'r>(&'r mut self) -> Lines<'r, T> {
1543+
Lines { buffer: self }
1544+
}
15361545
}
15371546

15381547
/// When seeking, the resulting cursor is offset from a base by the offset given
@@ -2003,4 +2012,8 @@ mod tests {
20032012
assert_eq!(format!("{}", ALL_PERMISSIONS), "0777".to_string());
20042013
assert_eq!(format!("{}", USER_READ | USER_WRITE | OTHER_WRITE), "0602".to_string());
20052014
}
2015+
2016+
fn _ensure_buffer_is_object_safe<T: Buffer>(x: &T) -> &Buffer {
2017+
x as &Buffer
2018+
}
20062019
}

branches/try/src/libstd/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath};
7474
#[doc(no_inline)] pub use ptr::{RawPtr, RawMutPtr};
7575
#[doc(no_inline)] pub use result::{Result, Ok, Err};
76-
#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek};
76+
#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude};
7777
#[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude};
7878
#[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude};
7979
#[doc(no_inline)] pub use to_string::{ToString, IntoStr};

0 commit comments

Comments
 (0)