Skip to content

Commit 3ced456

Browse files
committed
---
yaml --- r: 152941 b: refs/heads/try2 c: 96fdf4d h: refs/heads/master i: 152939: 99eac5b v: v3
1 parent 4967740 commit 3ced456

File tree

251 files changed

+1930
-2331
lines changed

Some content is hidden

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

251 files changed

+1930
-2331
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b569c77148e8e839b38b678c7c167efc643d2721
8+
refs/heads/try2: 96fdf4dae5537c25de3b37822319680b2c07c13b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,6 @@ documentation.
5858
3. Read the [tutorial].
5959
4. Enjoy!
6060

61-
### Building on Windows
62-
63-
To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/msys2/):
64-
65-
1. Grab the latest MSYS2 installer and go through the installer.
66-
2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
67-
tools we need.
68-
69-
$ pacman -S mingw-w64-i686-toolchain
70-
$ pacman -S base-devel
71-
72-
3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
73-
4. From there just navigate to where you have Rust's source code, configure and build it:
74-
75-
$ ./configure --build=i686-pc-mingw32
76-
$ make && make install
77-
7861
[repo]: https://github.com/rust-lang/rust
7962
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
8063
[tutorial]: http://doc.rust-lang.org/tutorial.html

branches/try2/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub mod common;
4242
pub mod errors;
4343

4444
#[start]
45-
fn start(argc: int, argv: *const *const u8) -> int {
45+
fn start(argc: int, argv: **u8) -> int {
4646
green::start(argc, argv, rustuv::event_loop, main)
4747
}
4848

branches/try2/src/doc/guide-ffi.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ use libc::{c_int, size_t};
5050
5151
#[link(name = "snappy")]
5252
extern {
53-
fn snappy_compress(input: *const u8,
53+
fn snappy_compress(input: *u8,
5454
input_length: size_t,
5555
compressed: *mut u8,
5656
compressed_length: *mut size_t) -> c_int;
57-
fn snappy_uncompress(compressed: *const u8,
57+
fn snappy_uncompress(compressed: *u8,
5858
compressed_length: size_t,
5959
uncompressed: *mut u8,
6060
uncompressed_length: *mut size_t) -> c_int;
6161
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
62-
fn snappy_uncompressed_length(compressed: *const u8,
62+
fn snappy_uncompressed_length(compressed: *u8,
6363
compressed_length: size_t,
6464
result: *mut size_t) -> c_int;
65-
fn snappy_validate_compressed_buffer(compressed: *const u8,
65+
fn snappy_validate_compressed_buffer(compressed: *u8,
6666
compressed_length: size_t) -> c_int;
6767
}
6868
# fn main() {}
@@ -82,7 +82,7 @@ the allocated memory. The length is less than or equal to the capacity.
8282
~~~~
8383
# extern crate libc;
8484
# use libc::{c_int, size_t};
85-
# unsafe fn snappy_validate_compressed_buffer(_: *const u8, _: size_t) -> c_int { 0 }
85+
# unsafe fn snappy_validate_compressed_buffer(_: *u8, _: size_t) -> c_int { 0 }
8686
# fn main() {}
8787
pub fn validate_compressed_buffer(src: &[u8]) -> bool {
8888
unsafe {
@@ -106,7 +106,7 @@ the true length after compression for setting the length.
106106
~~~~
107107
# extern crate libc;
108108
# use libc::{size_t, c_int};
109-
# unsafe fn snappy_compress(a: *const u8, b: size_t, c: *mut u8,
109+
# unsafe fn snappy_compress(a: *u8, b: size_t, c: *mut u8,
110110
# d: *mut size_t) -> c_int { 0 }
111111
# unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }
112112
# fn main() {}
@@ -132,11 +132,11 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ
132132
~~~~
133133
# extern crate libc;
134134
# use libc::{size_t, c_int};
135-
# unsafe fn snappy_uncompress(compressed: *const u8,
135+
# unsafe fn snappy_uncompress(compressed: *u8,
136136
# compressed_length: size_t,
137137
# uncompressed: *mut u8,
138138
# uncompressed_length: *mut size_t) -> c_int { 0 }
139-
# unsafe fn snappy_uncompressed_length(compressed: *const u8,
139+
# unsafe fn snappy_uncompressed_length(compressed: *u8,
140140
# compressed_length: size_t,
141141
# result: *mut size_t) -> c_int { 0 }
142142
# fn main() {}
@@ -418,7 +418,7 @@ Unsafe functions, on the other hand, advertise it to the world. An unsafe functi
418418
this:
419419
420420
~~~~
421-
unsafe fn kaboom(ptr: *const int) -> int { *ptr }
421+
unsafe fn kaboom(ptr: *int) -> int { *ptr }
422422
~~~~
423423
424424
This function can only be called from an `unsafe` block or another `unsafe` function.
@@ -453,7 +453,7 @@ use std::ptr;
453453
454454
#[link(name = "readline")]
455455
extern {
456-
static mut rl_prompt: *const libc::c_char;
456+
static mut rl_prompt: *libc::c_char;
457457
}
458458
459459
fn main() {
@@ -478,7 +478,7 @@ extern crate libc;
478478
#[link(name = "kernel32")]
479479
#[allow(non_snake_case_functions)]
480480
extern "stdcall" {
481-
fn SetEnvironmentVariableA(n: *const u8, v: *const u8) -> libc::c_int;
481+
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
482482
}
483483
# fn main() { }
484484
~~~~

branches/try2/src/doc/guide-runtime.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ extern crate green;
245245
extern crate rustuv;
246246
247247
#[start]
248-
fn start(argc: int, argv: *const *const u8) -> int {
248+
fn start(argc: int, argv: **u8) -> int {
249249
green::start(argc, argv, rustuv::event_loop, main)
250250
}
251251
@@ -261,9 +261,7 @@ inside of an OS thread.
261261
extern crate native;
262262
263263
#[start]
264-
fn start(argc: int, argv: *const *const u8) -> int {
265-
native::start(argc, argv, main)
266-
}
264+
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
267265
268266
fn main() {}
269267
~~~

branches/try2/src/doc/guide-unsafe.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ let ref_2: &mut u8 = unsafe { mem::transmute(&mut *ref_1) };
7979
## Raw pointers
8080

8181
Rust offers two additional pointer types "raw pointers", written as
82-
`*const T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
82+
`*T` and `*mut T`. They're an approximation of C's `const T*` and `T*`
8383
respectively; indeed, one of their most common uses is for FFI,
8484
interfacing with external C libraries.
8585

@@ -100,7 +100,7 @@ offered by the Rust language and libraries. For example, they
100100
- lack any form of lifetimes, unlike `&`, and so the compiler cannot
101101
reason about dangling pointers; and
102102
- have no guarantees about aliasing or mutability other than mutation
103-
not being allowed directly through a `*const T`.
103+
not being allowed directly through a `*T`.
104104

105105
Fortunately, they come with a redeeming feature: the weaker guarantees
106106
mean weaker restrictions. The missing restrictions make raw pointers
@@ -131,13 +131,13 @@ unsafe, and neither is converting to an integer.
131131

132132
At runtime, a raw pointer `*` and a reference pointing to the same
133133
piece of data have an identical representation. In fact, an `&T`
134-
reference will implicitly coerce to an `*const T` raw pointer in safe code
134+
reference will implicitly coerce to an `*T` raw pointer in safe code
135135
and similarly for the `mut` variants (both coercions can be performed
136-
explicitly with, respectively, `value as *const T` and `value as *mut T`).
136+
explicitly with, respectively, `value as *T` and `value as *mut T`).
137137

138-
Going the opposite direction, from `*const` to a reference `&`, is not
138+
Going the opposite direction, from `*` to a reference `&`, is not
139139
safe. A `&T` is always valid, and so, at a minimum, the raw pointer
140-
`*const T` has to be a valid to a valid instance of type `T`. Furthermore,
140+
`*T` has to be a valid to a valid instance of type `T`. Furthermore,
141141
the resulting pointer must satisfy the aliasing and mutability laws of
142142
references. The compiler assumes these properties are true for any
143143
references, no matter how they are created, and so any conversion from
@@ -149,7 +149,7 @@ The recommended method for the conversion is
149149
```
150150
let i: u32 = 1;
151151
// explicit cast
152-
let p_imm: *const u32 = &i as *const u32;
152+
let p_imm: *u32 = &i as *u32;
153153
let mut m: u32 = 2;
154154
// implicit coercion
155155
let p_mut: *mut u32 = &mut m;
@@ -256,7 +256,7 @@ impl<T: Send> Drop for Unique<T> {
256256
// Copy the object out from the pointer onto the stack,
257257
// where it is covered by normal Rust destructor semantics
258258
// and cleans itself up, if necessary
259-
ptr::read(self.ptr as *const T);
259+
ptr::read(self.ptr as *T);
260260
261261
// clean-up our allocation
262262
free(self.ptr as *mut c_void)
@@ -457,7 +457,7 @@ extern crate libc;
457457
458458
// Entry point for this program
459459
#[start]
460-
fn start(_argc: int, _argv: *const *const u8) -> int {
460+
fn start(_argc: int, _argv: **u8) -> int {
461461
0
462462
}
463463
@@ -482,7 +482,7 @@ compiler's name mangling too:
482482
extern crate libc;
483483
484484
#[no_mangle] // ensure that this symbol is called `main` in the output
485-
pub extern fn main(argc: int, argv: *const *const u8) -> int {
485+
pub extern fn main(argc: int, argv: **u8) -> int {
486486
0
487487
}
488488
@@ -540,8 +540,8 @@ use core::mem;
540540
use core::raw::Slice;
541541
542542
#[no_mangle]
543-
pub extern fn dot_product(a: *const u32, a_len: u32,
544-
b: *const u32, b_len: u32) -> u32 {
543+
pub extern fn dot_product(a: *u32, a_len: u32,
544+
b: *u32, b_len: u32) -> u32 {
545545
// Convert the provided arrays into Rust slices.
546546
// The core::raw module guarantees that the Slice
547547
// structure has the same memory layout as a &[T]
@@ -573,7 +573,7 @@ extern fn begin_unwind(args: &core::fmt::Arguments,
573573
574574
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
575575
#[lang = "eh_personality"] extern fn eh_personality() {}
576-
# #[start] fn start(argc: int, argv: *const *const u8) -> int { 0 }
576+
# #[start] fn start(argc: int, argv: **u8) -> int { 0 }
577577
# fn main() {}
578578
```
579579

@@ -595,7 +595,7 @@ standard library itself.
595595
> parts of the language may never be full specified and so details may
596596
> differ wildly between implementations (and even versions of `rustc`
597597
> itself).
598-
>
598+
>
599599
> Furthermore, this is just an overview; the best form of
600600
> documentation for specific instances of these features are their
601601
> definitions and uses in `std`.
@@ -627,7 +627,7 @@ via a declaration like
627627
extern "rust-intrinsic" {
628628
fn transmute<T, U>(x: T) -> U;
629629
630-
fn offset<T>(dst: *const T, offset: int) -> *const T;
630+
fn offset<T>(dst: *T, offset: int) -> *T;
631631
}
632632
```
633633

@@ -677,7 +677,7 @@ unsafe fn deallocate(ptr: *mut u8, _size: uint, _align: uint) {
677677
}
678678
679679
#[start]
680-
fn main(argc: int, argv: *const *const u8) -> int {
680+
fn main(argc: int, argv: **u8) -> int {
681681
let x = box 1;
682682
683683
0

branches/try2/src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ extern crate libc;
16141614
use libc::{c_char, FILE};
16151615
16161616
extern {
1617-
fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
1617+
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
16181618
}
16191619
# fn main() {}
16201620
~~~~

branches/try2/src/liballoc/heap.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub static mut EMPTY: uint = 12345;
9999
#[inline]
100100
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
101101
if size == 0 {
102-
&EMPTY as *const uint as *mut u8
102+
&EMPTY as *uint as *mut u8
103103
} else {
104104
allocate(size, align)
105105
}
@@ -144,10 +144,9 @@ mod imp {
144144
flags: c_int) -> size_t;
145145
fn je_dallocx(ptr: *mut c_void, flags: c_int);
146146
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
147-
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,
148-
*const c_char)>,
147+
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void, *c_char)>,
149148
cbopaque: *mut c_void,
150-
opts: *const c_char);
149+
opts: *c_char);
151150
}
152151

153152
// -lpthread needs to occur after -ljemalloc, the earlier argument isn't enough
@@ -227,7 +226,7 @@ mod imp {
227226
// a block of memory, so we special case everything under `*uint` to
228227
// just pass it to malloc, which is guaranteed to align to at least the
229228
// size of `*uint`.
230-
if align < mem::size_of::<uint>() {
229+
if align < mem::size_of::<*uint>() {
231230
libc_heap::malloc_raw(size)
232231
} else {
233232
let mut out = 0 as *mut libc::c_void;
@@ -245,7 +244,7 @@ mod imp {
245244
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
246245
old_size: uint) -> *mut u8 {
247246
let new_ptr = allocate(size, align);
248-
ptr::copy_memory(new_ptr, ptr as *const u8, old_size);
247+
ptr::copy_memory(new_ptr, ptr as *u8, old_size);
249248
deallocate(ptr, old_size, align);
250249
return new_ptr;
251250
}

branches/try2/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
#![no_std]
7272
#![feature(lang_items, phase, unsafe_destructor)]
73+
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
7374

7475
#[phase(plugin, link)]
7576
extern crate core;

branches/try2/src/liballoc/owned.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
1616
use core::default::Default;
1717
use core::fmt;
1818
use core::intrinsics;
19-
use core::kinds::Send;
2019
use core::mem;
2120
use core::raw::TraitObject;
2221
use core::result::{Ok, Err, Result};
@@ -37,7 +36,7 @@ pub static HEAP: () = ();
3736

3837
/// A type that represents a uniquely-owned value.
3938
#[lang="owned_box"]
40-
pub struct Box<T>(*mut T);
39+
pub struct Box<T>(*T);
4140

4241
impl<T: Default> Default for Box<T> {
4342
fn default() -> Box<T> { box Default::default() }
@@ -107,34 +106,6 @@ impl AnyOwnExt for Box<Any> {
107106
}
108107
}
109108

110-
/// Extension methods for an owning `Any+Send` trait object
111-
pub trait AnySendOwnExt {
112-
/// Returns the boxed value if it is of type `T`, or
113-
/// `Err(Self)` if it isn't.
114-
fn move_send<T: 'static>(self) -> Result<Box<T>, Self>;
115-
}
116-
117-
impl AnySendOwnExt for Box<Any+Send> {
118-
#[inline]
119-
fn move_send<T: 'static>(self) -> Result<Box<T>, Box<Any+Send>> {
120-
if self.is::<T>() {
121-
unsafe {
122-
// Get the raw representation of the trait object
123-
let to: TraitObject =
124-
*mem::transmute::<&Box<Any+Send>, &TraitObject>(&self);
125-
126-
// Prevent destructor on self being run
127-
intrinsics::forget(self);
128-
129-
// Extract the data pointer
130-
Ok(mem::transmute(to.data))
131-
}
132-
} else {
133-
Err(self)
134-
}
135-
}
136-
}
137-
138109
impl<T: fmt::Show> fmt::Show for Box<T> {
139110
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
140111
(**self).fmt(f)

0 commit comments

Comments
 (0)