Skip to content

Commit b16e6ad

Browse files
committed
---
yaml --- r: 183038 b: refs/heads/beta c: 425f232 h: refs/heads/master v: v3
1 parent 47efc66 commit b16e6ad

File tree

308 files changed

+2855
-1789
lines changed

Some content is hidden

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

308 files changed

+2855
-1789
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: f6414b0187bfc6e5b563a17c85a9f790d6257551
34+
refs/heads/beta: 425f2328d0d6d2848a399424ab26dde4800edcf9
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/COPYRIGHT

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ The following third party packages are included, and carry
2323
their own copyright notices and license terms:
2424

2525
* Two header files that are part of the Valgrind
26-
package. These files are found at src/rt/vg/valgrind.h and
27-
src/rt/vg/memcheck.h, within this distribution. These files
26+
package. These files are found at src/rt/valgrind/valgrind.h and
27+
src/rt/valgrind/memcheck.h, within this distribution. These files
2828
are redistributed under the following terms, as noted in
2929
them:
3030

31-
for src/rt/vg/valgrind.h:
31+
for src/rt/valgrind/valgrind.h:
3232

3333
This file is part of Valgrind, a dynamic binary
3434
instrumentation framework.
@@ -74,7 +74,7 @@ their own copyright notices and license terms:
7474
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
7575
OF SUCH DAMAGE.
7676

77-
for src/rt/vg/memcheck.h:
77+
for src/rt/valgrind/memcheck.h:
7878

7979
This file is part of MemCheck, a heavyweight Valgrind
8080
tool for detecting memory errors.
@@ -120,18 +120,6 @@ their own copyright notices and license terms:
120120
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
121121
OF SUCH DAMAGE.
122122

123-
* The auxiliary file src/etc/pkg/modpath.iss contains a
124-
library routine compiled, by Inno Setup, into the Windows
125-
installer binary. This file is licensed under the LGPL,
126-
version 3, but, in our legal interpretation, this does not
127-
affect the aggregate "collected work" license of the Rust
128-
distribution (MIT/ASL2) nor any other components of it. We
129-
believe that the terms governing distribution of the
130-
binary Windows installer built from modpath.iss are
131-
therefore LGPL, but not the terms governing distribution
132-
of any of the files installed by such an installer (such
133-
as the Rust compiler or runtime libraries themselves).
134-
135123
* The src/rt/miniz.c file, carrying an implementation of
136124
RFC1950/RFC1951 DEFLATE, by Rich Geldreich
137125
<[email protected]>. All uses of this file are

branches/beta/src/doc/intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ Let's see an example. This Rust code will not compile:
424424
use std::thread::Thread;
425425
426426
fn main() {
427-
let mut numbers = vec![1is, 2, 3];
427+
let mut numbers = vec![1, 2, 3];
428428
429429
for i in 0..3 {
430430
Thread::spawn(move || {
@@ -478,7 +478,7 @@ use std::thread::Thread;
478478
use std::sync::{Arc,Mutex};
479479
480480
fn main() {
481-
let numbers = Arc::new(Mutex::new(vec![1is, 2, 3]));
481+
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));
482482
483483
for i in 0us..3 {
484484
let number = numbers.clone();
@@ -539,7 +539,7 @@ safety check that makes this an error about moved values:
539539
use std::thread::Thread;
540540
541541
fn main() {
542-
let vec = vec![1is, 2, 3];
542+
let vec = vec![1, 2, 3];
543543
544544
for i in 0us..3 {
545545
Thread::spawn(move || {

branches/beta/src/doc/reference.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ cases mentioned in [Number literals](#number-literals) below.
268268
##### Suffixes
269269
| Integer | Floating-point |
270270
|---------|----------------|
271-
| `is` (`isize`), `us` (`usize`), `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64` | `f32`, `f64` |
271+
| `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `is` (`isize`), `us` (`usize`) | `f32`, `f64` |
272272

273273
#### Character and string literals
274274

@@ -468,27 +468,29 @@ Like any literal, an integer literal may be followed (immediately,
468468
without any spaces) by an _integer suffix_, which forcibly sets the
469469
type of the literal. There are 10 valid values for an integer suffix:
470470

471-
* The `is` and `us` suffixes give the literal type `isize` or `usize`,
472-
respectively.
473471
* Each of the signed and unsigned machine types `u8`, `i8`,
474472
`u16`, `i16`, `u32`, `i32`, `u64` and `i64`
475473
give the literal the corresponding machine type.
474+
* The `is` and `us` suffixes give the literal type `isize` or `usize`,
475+
respectively.
476476

477477
The type of an _unsuffixed_ integer literal is determined by type inference.
478478
If an integer type can be _uniquely_ determined from the surrounding program
479479
context, the unsuffixed integer literal has that type. If the program context
480-
underconstrains the type, it is considered a static type error; if the program
481-
context overconstrains the type, it is also considered a static type error.
480+
underconstrains the type, it defaults to the signed 32-bit integer `i32`; if
481+
the program context overconstrains the type, it is considered a static type
482+
error.
482483

483484
Examples of integer literals of various forms:
484485

485486
```
486-
123is; // type isize
487-
123us; // type usize
488-
123_us; // type usize
487+
123i32; // type i32
488+
123u32; // type u32
489+
123_u32; // type u32
489490
0xff_u8; // type u8
490491
0o70_i16; // type i16
491492
0b1111_1111_1001_0000_i32; // type i32
493+
0us; // type usize
492494
```
493495

494496
##### Floating-point literals
@@ -1135,8 +1137,8 @@ used as a type name.
11351137

11361138
When a generic function is referenced, its type is instantiated based on the
11371139
context of the reference. For example, calling the `iter` function defined
1138-
above on `[1, 2]` will instantiate type parameter `T` with `isize`, and require
1139-
the closure parameter to have type `fn(isize)`.
1140+
above on `[1, 2]` will instantiate type parameter `T` with `i32`, and require
1141+
the closure parameter to have type `fn(i32)`.
11401142

11411143
The type parameters can also be explicitly supplied in a trailing
11421144
[path](#paths) component after the function name. This might be necessary if
@@ -2747,9 +2749,9 @@ constant expression that can be evaluated at compile time, such as a
27472749
[literal](#literals) or a [static item](#static-items).
27482750

27492751
```
2750-
[1is, 2, 3, 4];
2752+
[1, 2, 3, 4];
27512753
["a", "b", "c", "d"];
2752-
[0is; 128]; // array with 128 zeros
2754+
[0; 128]; // array with 128 zeros
27532755
[0u8, 0u8, 0u8, 0u8];
27542756
```
27552757

@@ -2922,7 +2924,7 @@ moves](#moved-and-copied-types) its right-hand operand to its left-hand
29222924
operand.
29232925

29242926
```
2925-
# let mut x = 0is;
2927+
# let mut x = 0;
29262928
# let y = 0;
29272929
29282930
x = y;
@@ -3308,11 +3310,11 @@ fn main() {
33083310
```
33093311

33103312
Patterns can also dereference pointers by using the `&`, `&mut` and `box`
3311-
symbols, as appropriate. For example, these two matches on `x: &isize` are
3313+
symbols, as appropriate. For example, these two matches on `x: &i32` are
33123314
equivalent:
33133315

33143316
```
3315-
# let x = &3is;
3317+
# let x = &3;
33163318
let y = match *x { 0 => "zero", _ => "some" };
33173319
let z = match x { &0 => "zero", _ => "some" };
33183320
@@ -3333,7 +3335,7 @@ Multiple match patterns may be joined with the `|` operator. A range of values
33333335
may be specified with `...`. For example:
33343336

33353337
```
3336-
# let x = 2is;
3338+
# let x = 2;
33373339
33383340
let message = match x {
33393341
0 | 1 => "not many",
@@ -3674,16 +3676,16 @@ The type of a closure mapping an input of type `A` to an output of type `B` is
36743676
An example of creating and calling a closure:
36753677

36763678
```rust
3677-
let captured_var = 10is;
3679+
let captured_var = 10;
36783680

36793681
let closure_no_args = |&:| println!("captured_var={}", captured_var);
36803682

3681-
let closure_args = |&: arg: isize| -> isize {
3683+
let closure_args = |&: arg: i32| -> i32 {
36823684
println!("captured_var={}, arg={}", captured_var, arg);
36833685
arg // Note lack of semicolon after 'arg'
36843686
};
36853687

3686-
fn call_closure<F: Fn(), G: Fn(isize) -> isize>(c1: F, c2: G) {
3688+
fn call_closure<F: Fn(), G: Fn(i32) -> i32>(c1: F, c2: G) {
36873689
c1();
36883690
c2(2);
36893691
}
@@ -3715,7 +3717,7 @@ trait Printable {
37153717
fn stringify(&self) -> String;
37163718
}
37173719
3718-
impl Printable for isize {
3720+
impl Printable for i32 {
37193721
fn stringify(&self) -> String { self.to_string() }
37203722
}
37213723
@@ -3724,7 +3726,7 @@ fn print(a: Box<Printable>) {
37243726
}
37253727
37263728
fn main() {
3727-
print(Box::new(10is) as Box<Printable>);
3729+
print(Box::new(10) as Box<Printable>);
37283730
}
37293731
```
37303732

branches/beta/src/liballoc/arc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//!
4040
//! let five = Arc::new(5);
4141
//!
42-
//! for _ in 0u..10 {
42+
//! for _ in 0..10 {
4343
//! let five = five.clone();
4444
//!
4545
//! Thread::spawn(move || {
@@ -56,7 +56,7 @@
5656
//!
5757
//! let five = Arc::new(Mutex::new(5));
5858
//!
59-
//! for _ in 0u..10 {
59+
//! for _ in 0..10 {
6060
//! let five = five.clone();
6161
//!
6262
//! Thread::spawn(move || {
@@ -101,7 +101,7 @@ use heap::deallocate;
101101
/// let numbers: Vec<_> = (0..100u32).map(|i| i as f32).collect();
102102
/// let shared_numbers = Arc::new(numbers);
103103
///
104-
/// for _ in 0u..10 {
104+
/// for _ in 0..10 {
105105
/// let child_numbers = shared_numbers.clone();
106106
///
107107
/// Thread::spawn(move || {
@@ -661,7 +661,7 @@ mod tests {
661661

662662
#[test]
663663
fn test_cowarc_clone_make_unique() {
664-
let mut cow0 = Arc::new(75u);
664+
let mut cow0 = Arc::new(75);
665665
let mut cow1 = cow0.clone();
666666
let mut cow2 = cow1.clone();
667667

@@ -685,7 +685,7 @@ mod tests {
685685

686686
#[test]
687687
fn test_cowarc_clone_unique2() {
688-
let mut cow0 = Arc::new(75u);
688+
let mut cow0 = Arc::new(75);
689689
let cow1 = cow0.clone();
690690
let cow2 = cow1.clone();
691691

@@ -708,7 +708,7 @@ mod tests {
708708

709709
#[test]
710710
fn test_cowarc_clone_weak() {
711-
let mut cow0 = Arc::new(75u);
711+
let mut cow0 = Arc::new(75);
712712
let cow1_weak = cow0.downgrade();
713713

714714
assert!(75 == *cow0);

branches/beta/src/liballoc/boxed.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,52 @@ impl<T> Box<T> {
102102
}
103103
}
104104

105+
impl<T : ?Sized> Box<T> {
106+
/// Constructs a box from the raw pointer.
107+
///
108+
/// After this function call, pointer is owned by resulting box.
109+
/// In particular, it means that `Box` destructor calls destructor
110+
/// of `T` and releases memory. Since the way `Box` allocates and
111+
/// releases memory is unspecified, so the only valid pointer to
112+
/// pass to this function is the one taken from another `Box` with
113+
/// `box::into_raw` function.
114+
///
115+
/// Function is unsafe, because improper use of this function may
116+
/// lead to memory problems like double-free, for example if the
117+
/// function is called twice on the same raw pointer.
118+
#[unstable(feature = "alloc",
119+
reason = "may be renamed or moved out of Box scope")]
120+
pub unsafe fn from_raw(raw: *mut T) -> Self {
121+
mem::transmute(raw)
122+
}
123+
}
124+
125+
/// Consumes the `Box`, returning the wrapped raw pointer.
126+
///
127+
/// After call to this function, caller is responsible for the memory
128+
/// previously managed by `Box`, in particular caller should properly
129+
/// destroy `T` and release memory. The proper way to do it is to
130+
/// convert pointer back to `Box` with `Box::from_raw` function, because
131+
/// `Box` does not specify, how memory is allocated.
132+
///
133+
/// Function is unsafe, because result of this function is no longer
134+
/// automatically managed that may lead to memory or other resource
135+
/// leak.
136+
///
137+
/// # Example
138+
/// ```
139+
/// use std::boxed;
140+
///
141+
/// let seventeen = Box::new(17u32);
142+
/// let raw = unsafe { boxed::into_raw(seventeen) };
143+
/// let boxed_again = unsafe { Box::from_raw(raw) };
144+
/// ```
145+
#[unstable(feature = "alloc",
146+
reason = "may be renamed")]
147+
pub unsafe fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
148+
mem::transmute(b)
149+
}
150+
105151
#[stable(feature = "rust1", since = "1.0.0")]
106152
impl<T: Default> Default for Box<T> {
107153
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)