Skip to content

Commit a92397c

Browse files
committed
---
yaml --- r: 211183 b: refs/heads/try c: 04ab4a3 h: refs/heads/master i: 211181: acf5ba1 211179: 5d0dfe8 211175: 61e88e0 211167: 0cf717e v: v3
1 parent 3b9c874 commit a92397c

File tree

15 files changed

+48
-114
lines changed

15 files changed

+48
-114
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: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: cc156c2f3819e8818c66e5f5d0bb143739e3bbb0
5+
refs/heads/try: 04ab4a34719979d7f17b4c0df82ac8dbf08af1ad
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/trpl/installing-rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Some people, and somewhat rightfully so, get very upset when we tell you to
4343
`curl | sh`. Basically, when you do this, you are trusting that the good
4444
people who maintain Rust aren't going to hack your computer and do bad things.
4545
That's a good instinct! If you're one of those people, please check out the
46-
documentation on [building Rust from Source][from-source], or [the official
47-
binary downloads][install-page].
46+
documentation on [building Rust from Source][from source], or [the official
47+
binary downloads][install page].
4848

49-
[from-source]: https://github.com/rust-lang/rust#building-from-source
50-
[install-page]: http://www.rust-lang.org/install.html
49+
[from source]: https://github.com/rust-lang/rust#building-from-source
50+
[install page]: http://www.rust-lang.org/install.html
5151

5252
Oh, we should also mention the officially supported platforms:
5353

branches/try/src/doc/trpl/macros.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ mind.
3030

3131
# Defining a macro
3232

33-
You may have seen the `vec!` macro, used to initialize a [vector][vector] with
34-
any number of elements.
33+
You may have seen the `vec!` macro, used to initialize a [vector][] with any
34+
number of elements.
3535

3636
[vector]: vectors.html
3737

@@ -349,7 +349,7 @@ fn main() {
349349
}
350350
```
351351

352-
This holds for `let` bindings and loop labels, but not for [items][items].
352+
This holds for `let` bindings and loop labels, but not for [items][].
353353
So the following code does compile:
354354

355355
```rust
@@ -470,7 +470,7 @@ which syntactic form it matches.
470470
* `stmt`: a single statement. Example: `let x = 3`.
471471
* `block`: a brace-delimited sequence of statements. Example:
472472
`{ log(error, "hi"); return 12; }`.
473-
* `item`: an [item][item]. Examples: `fn foo() { }`; `struct Bar;`.
473+
* `item`: an [item][]. Examples: `fn foo() { }`; `struct Bar;`.
474474
* `meta`: a "meta item", as found in attributes. Example: `cfg(target_os = "windows")`.
475475
* `tt`: a single token tree.
476476

branches/try/src/doc/trpl/nightly-rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ Some people, and somewhat rightfully so, get very upset when we tell you to
4646
`curl | sh`. Basically, when you do this, you are trusting that the good
4747
people who maintain Rust aren't going to hack your computer and do bad things.
4848
That's a good instinct! If you're one of those people, please check out the
49-
documentation on [building Rust from Source][from-source], or [the official
50-
binary downloads][install-page].
49+
documentation on [building Rust from Source][from source], or [the official
50+
binary downloads][install page].
5151

52-
[from-source]: https://github.com/rust-lang/rust#building-from-source
53-
[install-page]: http://www.rust-lang.org/install.html
52+
[from source]: https://github.com/rust-lang/rust#building-from-source
53+
[install page]: http://www.rust-lang.org/install.html
5454

5555
Oh, we should also mention the officially supported platforms:
5656

@@ -91,9 +91,9 @@ If not, there are a number of places where you can get help. The easiest is
9191
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9292
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9393
(a silly nickname we call ourselves), and we can help you out. Other great
94-
resources include [the user’s forum][users], and [Stack Overflow][stackoverflow].
94+
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
9595

9696
[irc]: irc://irc.mozilla.org/#rust
9797
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
9898
[users]: http://users.rust-lang.org/
99-
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust
99+
[stack overflow]: http://stackoverflow.com/questions/tagged/rust

branches/try/src/doc/trpl/strings.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,6 @@ fn main() {
4949
}
5050
```
5151

52-
This coercion does not happen for functions that accept one of `&str`’s traits
53-
instead of `&str`. For example, [`TcpStream::connect`][connect] has a parameter
54-
of type `ToSocketAddrs`. A `&str` is okay but a `String` must be explicitly
55-
converted using `&*`.
56-
57-
```rust,no_run
58-
use std::net::TcpStream;
59-
60-
TcpStream::connect("192.168.0.1:3000"); // &str parameter
61-
62-
let addr_string = "192.168.0.1:3000".to_string();
63-
TcpStream::connect(&*addr_string); // convert addr_string to &str
64-
```
65-
6652
Viewing a `String` as a `&str` is cheap, but converting the `&str` to a
6753
`String` involves allocating memory. No reason to do that unless you have to!
6854

@@ -141,4 +127,3 @@ This is because `&String` can automatically coerce to a `&str`. This is a
141127
feature called ‘[`Deref` coercions][dc]’.
142128

143129
[dc]: deref-coercions.html
144-
[connect]: ../std/net/struct.TcpStream.html#method.connect

branches/try/src/doc/trpl/the-stack-and-the-heap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ At the end of `bar()`, it calls `baz()`:
454454
| (2<sup>30</sup>) - 1 | | 5 |
455455
| ... | ... | ... |
456456
| 12 | g | 100 |
457-
| 11 | f | 9 |
457+
| 11 | f | 4 |
458458
| 10 | e | 9 |
459459
| 9 | d | (2<sup>30</sup>) - 1 |
460460
| 8 | c | 5 |

branches/try/src/liballoc/boxed.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,20 @@ impl<T : ?Sized> Box<T> {
139139
/// convert pointer back to `Box` with `Box::from_raw` function, because
140140
/// `Box` does not specify, how memory is allocated.
141141
///
142-
/// Function is unsafe, because result of this function is no longer
143-
/// automatically managed that may lead to memory or other resource
144-
/// leak.
145-
///
146142
/// # Examples
147143
/// ```
148144
/// # #![feature(alloc)]
149145
/// use std::boxed;
150146
///
151147
/// let seventeen = Box::new(17u32);
152-
/// let raw = unsafe { boxed::into_raw(seventeen) };
148+
/// let raw = boxed::into_raw(seventeen);
153149
/// let boxed_again = unsafe { Box::from_raw(raw) };
154150
/// ```
155151
#[unstable(feature = "alloc",
156152
reason = "may be renamed")]
157153
#[inline]
158-
pub unsafe fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
159-
mem::transmute(b)
154+
pub fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
155+
unsafe { mem::transmute(b) }
160156
}
161157

162158
#[stable(feature = "rust1", since = "1.0.0")]

branches/try/src/libcore/iter.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,19 +452,20 @@ pub trait Iterator {
452452
Scan{iter: self, f: f, state: initial_state}
453453
}
454454

455-
/// Takes a function that maps each element to a new iterator and yields
456-
/// all the elements of the produced iterators.
457-
///
458-
/// This is useful for unraveling nested structures.
455+
/// Creates an iterator that maps each element to an iterator,
456+
/// and yields the elements of the produced iterators.
459457
///
460458
/// # Examples
461459
///
462460
/// ```
463-
/// let words = ["alpha", "beta", "gamma"];
464-
/// let merged: String = words.iter()
465-
/// .flat_map(|s| s.chars())
466-
/// .collect();
467-
/// assert_eq!(merged, "alphabetagamma");
461+
/// # #![feature(core)]
462+
/// let xs = [2, 3];
463+
/// let ys = [0, 1, 0, 1, 2];
464+
/// let it = xs.iter().flat_map(|&x| (0..).take(x));
465+
/// // Check that `it` has the same elements as `ys`
466+
/// for (i, x) in it.enumerate() {
467+
/// assert_eq!(x, ys[i]);
468+
/// }
468469
/// ```
469470
#[inline]
470471
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1067,7 +1068,7 @@ pub trait Iterator {
10671068
/// # #![feature(core)]
10681069
///
10691070
/// let a = [1, 2, 3, 4, 5];
1070-
/// let it = a.iter();
1071+
/// let mut it = a.iter().cloned();
10711072
/// assert_eq!(it.sum::<i32>(), 15);
10721073
/// ```
10731074
#[unstable(feature="core")]

branches/try/src/librustc_trans/trans/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
785785
if !global.is_null() && llvm::LLVMIsGlobalConstant(global) == llvm::True {
786786
let val = llvm::LLVMGetInitializer(global);
787787
if !val.is_null() {
788-
return to_arg_ty(cx, val, t);
788+
return from_arg_ty(cx, val, t);
789789
}
790790
}
791791
}
@@ -807,7 +807,7 @@ pub fn load_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
807807
llvm::LLVMSetAlignment(val, align);
808808
}
809809

810-
to_arg_ty(cx, val, t)
810+
from_arg_ty(cx, val, t)
811811
}
812812

813813
/// Helper for storing values in memory. Does the necessary conversion if the in-memory type
@@ -817,21 +817,21 @@ pub fn store_ty<'blk, 'tcx>(cx: Block<'blk, 'tcx>, v: ValueRef, dst: ValueRef, t
817817
return;
818818
}
819819

820-
let store = Store(cx, from_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t));
820+
let store = Store(cx, to_arg_ty(cx, v, t), to_arg_ty_ptr(cx, dst, t));
821821
unsafe {
822822
llvm::LLVMSetAlignment(store, type_of::align_of(cx.ccx(), t));
823823
}
824824
}
825825

826-
pub fn from_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef {
826+
pub fn to_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef {
827827
if ty::type_is_bool(ty) {
828828
ZExt(bcx, val, Type::i8(bcx.ccx()))
829829
} else {
830830
val
831831
}
832832
}
833833

834-
pub fn to_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef {
834+
pub fn from_arg_ty(bcx: Block, val: ValueRef, ty: Ty) -> ValueRef {
835835
if ty::type_is_bool(ty) {
836836
Trunc(bcx, val, Type::i1(bcx.ccx()))
837837
} else {

branches/try/src/librustc_trans/trans/expr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,9 +2180,7 @@ fn auto_ref<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
21802180
// Construct the resulting datum, using what was the "by ref"
21812181
// ValueRef of type `referent_ty` to be the "by value" ValueRef
21822182
// of type `&referent_ty`.
2183-
// Pointers to DST types are non-immediate, and therefore still use ByRef.
2184-
let kind = if type_is_sized(bcx.tcx(), referent_ty) { ByValue } else { ByRef };
2185-
DatumBlock::new(bcx, Datum::new(llref, ptr_ty, RvalueExpr(Rvalue::new(kind))))
2183+
DatumBlock::new(bcx, Datum::new(llref, ptr_ty, RvalueExpr(Rvalue::new(ByValue))))
21862184
}
21872185

21882186
fn deref_multiple<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,

branches/try/src/librustc_trans/trans/intrinsic.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
223223
let val = if datum.kind.is_by_ref() {
224224
load_ty(bcx, datum.val, datum.ty)
225225
} else {
226-
from_arg_ty(bcx, datum.val, datum.ty)
226+
datum.val
227227
};
228228

229229
let cast_val = BitCast(bcx, val, llret_ty);
@@ -490,12 +490,12 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
490490
unsafe {
491491
llvm::LLVMSetAlignment(load, type_of::align_of(ccx, tp_ty));
492492
}
493-
to_arg_ty(bcx, load, tp_ty)
493+
from_arg_ty(bcx, load, tp_ty)
494494
},
495495
(_, "volatile_store") => {
496496
let tp_ty = *substs.types.get(FnSpace, 0);
497497
let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty);
498-
let val = from_arg_ty(bcx, llargs[1], tp_ty);
498+
let val = to_arg_ty(bcx, llargs[1], tp_ty);
499499
let store = VolatileStore(bcx, val, ptr);
500500
unsafe {
501501
llvm::LLVMSetAlignment(store, type_of::align_of(ccx, tp_ty));
@@ -777,8 +777,8 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
777777

778778
let tp_ty = *substs.types.get(FnSpace, 0);
779779
let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty);
780-
let cmp = from_arg_ty(bcx, llargs[1], tp_ty);
781-
let src = from_arg_ty(bcx, llargs[2], tp_ty);
780+
let cmp = to_arg_ty(bcx, llargs[1], tp_ty);
781+
let src = to_arg_ty(bcx, llargs[2], tp_ty);
782782
let res = AtomicCmpXchg(bcx, ptr, cmp, src, order,
783783
strongest_failure_ordering);
784784
ExtractValue(bcx, res, 0)
@@ -787,12 +787,12 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
787787
"load" => {
788788
let tp_ty = *substs.types.get(FnSpace, 0);
789789
let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty);
790-
to_arg_ty(bcx, AtomicLoad(bcx, ptr, order), tp_ty)
790+
from_arg_ty(bcx, AtomicLoad(bcx, ptr, order), tp_ty)
791791
}
792792
"store" => {
793793
let tp_ty = *substs.types.get(FnSpace, 0);
794794
let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty);
795-
let val = from_arg_ty(bcx, llargs[1], tp_ty);
795+
let val = to_arg_ty(bcx, llargs[1], tp_ty);
796796
AtomicStore(bcx, val, ptr, order);
797797
C_nil(ccx)
798798
}
@@ -826,7 +826,7 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
826826

827827
let tp_ty = *substs.types.get(FnSpace, 0);
828828
let ptr = to_arg_ty_ptr(bcx, llargs[0], tp_ty);
829-
let val = from_arg_ty(bcx, llargs[1], tp_ty);
829+
let val = to_arg_ty(bcx, llargs[1], tp_ty);
830830
AtomicRMW(bcx, atom_op, ptr, val, order)
831831
}
832832
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ pub trait Write {
307307
/// any wrapped object.
308308
///
309309
/// Calls to `write` are not guaranteed to block waiting for data to be
310-
/// written, and a write which would otherwise block can be indicated through
310+
/// written, and a write which would otherwise block can indicated through
311311
/// an `Err` variant.
312312
///
313313
/// If the return value is `Ok(n)` then it must be guaranteed that

branches/try/src/libstd/path.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ mod platform {
258258
/// Path prefixes (Windows only).
259259
///
260260
/// Windows uses a variety of path styles, including references to drive
261-
/// volumes (like `C:`), network shared folders (like `\\server\share`) and
261+
/// volumes (like `C:`), network shared (like `\\server\share`) and
262262
/// others. In addition, some path prefixes are "verbatim", in which case
263263
/// `/` is *not* treated as a separator and essentially no normalization is
264264
/// performed.
@@ -312,14 +312,14 @@ impl<'a> Prefix<'a> {
312312

313313
}
314314

315-
/// Determines if the prefix is verbatim, i.e. begins with `\\?\`.
315+
/// Determines if the prefix is verbatim, i.e. begins `\\?\`.
316316
#[inline]
317317
#[stable(feature = "rust1", since = "1.0.0")]
318318
pub fn is_verbatim(&self) -> bool {
319319
use self::Prefix::*;
320320
match *self {
321321
Verbatim(_) | VerbatimDisk(_) | VerbatimUNC(_, _) => true,
322-
_ => false,
322+
_ => false
323323
}
324324
}
325325

branches/try/src/test/run-pass/issue-24589.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

branches/try/src/test/run-pass/issue-25746-bool-transmute.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)