Skip to content

Commit 9a31480

Browse files
committed
---
yaml --- r: 133699 b: refs/heads/auto c: 7caf2ab h: refs/heads/master i: 133697: 221308e 133695: c0276cf v: v3
1 parent 3f0f3d8 commit 9a31480

File tree

153 files changed

+3118
-5738
lines changed

Some content is hidden

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

153 files changed

+3118
-5738
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: 828e075abd8ee2f8c16f6cb1b93c0d99307e704d
16+
refs/heads/auto: 7caf2ab802d7cf62662b6dd63ffe81672d45f1ad
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
6060

6161
DEPS_core :=
62-
DEPS_rlibc := core
62+
DEPS_rlibc :=
6363
DEPS_unicode := core
6464
DEPS_alloc := core libc native:jemalloc
6565
DEPS_debug := std

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,11 @@ fn start(_argc: int, _argv: *const *const u8) -> int {
461461
0
462462
}
463463
464-
// These functions and traits are used by the compiler, but not
464+
// These functions are invoked by the compiler, but not
465465
// for a bare-bones hello world. These are normally
466466
// provided by libstd.
467467
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
468468
#[lang = "eh_personality"] extern fn eh_personality() {}
469-
#[lang = "sized"] trait Sized { }
470469
# // fn main() {} tricked you, rustdoc!
471470
```
472471

@@ -489,14 +488,13 @@ pub extern fn main(argc: int, argv: *const *const u8) -> int {
489488
490489
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
491490
#[lang = "eh_personality"] extern fn eh_personality() {}
492-
#[lang = "sized"] trait Sized { }
493491
# // fn main() {} tricked you, rustdoc!
494492
```
495493

496494

497495
The compiler currently makes a few assumptions about symbols which are available
498496
in the executable to call. Normally these functions are provided by the standard
499-
xlibrary, but without it you must define your own.
497+
library, but without it you must define your own.
500498

501499
The first of these two functions, `stack_exhausted`, is invoked whenever stack
502500
overflow is detected. This function has a number of restrictions about how it
@@ -510,12 +508,6 @@ mechanisms of the compiler. This is often mapped to GCC's personality function
510508
information), but crates which do not trigger failure can be assured that this
511509
function is never called.
512510

513-
The final item in the example is a trait called `Sized`. This a trait
514-
that represents data of a known static size: it is integral to the
515-
Rust type system, and so the compiler expects the standard library to
516-
provide it. Since you are not using the standard library, you have to
517-
provide it yourself.
518-
519511
## Using libcore
520512

521513
> **Note**: the core library's structure is unstable, and it is recommended to
@@ -694,7 +686,6 @@ fn main(argc: int, argv: *const *const u8) -> int {
694686
695687
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
696688
#[lang = "eh_personality"] extern fn eh_personality() {}
697-
#[lang = "sized"] trait Sized {}
698689
```
699690

700691
Note the use of `abort`: the `exchange_malloc` lang item is assumed to

branches/auto/src/doc/guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Save the file, and then type this into your terminal window:
152152

153153
```{bash}
154154
$ rustc main.rs
155-
$ ./main # or main.exe on Windows
155+
$ ./hello_world # or hello_world.exe on Windows
156156
Hello, world!
157157
```
158158

@@ -164,7 +164,7 @@ fn main() {
164164
}
165165
```
166166

167-
These lines define a **function** in Rust. The `main` function is special:
167+
These two lines define a **function** in Rust. The `main` function is special:
168168
it's the beginning of every Rust program. The first line says "I'm declaring a
169169
function named `main`, which takes no arguments and returns nothing." If there
170170
were arguments, they would go inside the parentheses (`(` and `)`), and because
@@ -232,10 +232,10 @@ main.exe main.rs
232232
```
233233

234234
There are now two files: our source code, with the `.rs` extension, and the
235-
executable (`main.exe` on Windows, `main` everywhere else)
235+
executable (`hello_world.exe` on Windows, `hello_world` everywhere else)
236236

237237
```{bash}
238-
$ ./main # or main.exe on Windows
238+
$ ./hello_world # or hello_world.exe on Windows
239239
```
240240

241241
This prints out our `Hello, world!` text to our terminal.

branches/auto/src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,7 @@ There are two varieties of pointer in Rust:
36983698
they exist to support interoperability with foreign code,
36993699
and writing performance-critical or low-level functions.
37003700

3701-
The standard library contains addtional 'smart pointer' types beyond references
3701+
The standard library contains additional 'smart pointer' types beyond references
37023702
and raw pointers.
37033703

37043704
### Function types

branches/auto/src/liballoc/heap.rs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// FIXME: #13994: port to the sized deallocation API when available
1112
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
13+
// and `nonnull`
1214

13-
#[cfg(stage0, not(test))] use core::raw;
15+
#[cfg(not(test))] use core::raw;
1416
#[cfg(stage0, not(test))] use util;
1517

1618
/// Returns a pointer to `size` bytes of memory.
@@ -86,19 +88,18 @@ pub fn stats_print() {
8688
imp::stats_print();
8789
}
8890

89-
/// An arbitrary non-null address to represent zero-size allocations.
90-
///
91-
/// This preserves the non-null invariant for types like `Box<T>`. The address may overlap with
92-
/// non-zero-size memory allocations.
93-
pub static EMPTY: *mut () = 0x1 as *mut ();
91+
// The compiler never calls `exchange_free` on Box<ZeroSizeType>, so zero-size
92+
// allocations can point to this `static`. It would be incorrect to use a null
93+
// pointer, due to enums assuming types like unique pointers are never null.
94+
pub static mut EMPTY: uint = 12345;
9495

9596
/// The allocator for unique pointers.
9697
#[cfg(not(test))]
9798
#[lang="exchange_malloc"]
9899
#[inline]
99100
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
100101
if size == 0 {
101-
EMPTY as *mut u8
102+
&EMPTY as *const uint as *mut u8
102103
} else {
103104
allocate(size, align)
104105
}
@@ -111,6 +112,7 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
111112
deallocate(ptr, size, align);
112113
}
113114

115+
// FIXME: #7496
114116
#[cfg(stage0, not(test))]
115117
#[lang="closure_exchange_malloc"]
116118
#[inline]
@@ -126,6 +128,21 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
126128
alloc as *mut u8
127129
}
128130

131+
// FIXME: #7496
132+
#[cfg(not(stage0), not(test))]
133+
#[lang="closure_exchange_malloc"]
134+
#[inline]
135+
#[allow(deprecated)]
136+
unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
137+
align: uint) -> *mut u8 {
138+
let p = allocate(size, align);
139+
140+
let alloc = p as *mut raw::Box<()>;
141+
(*alloc).drop_glue = drop_glue;
142+
143+
alloc as *mut u8
144+
}
145+
129146
// The minimum alignment guaranteed by the architecture. This value is used to
130147
// add fast paths for low alignment values. In practice, the alignment is a
131148
// constant at the call site and the branch will be optimized out.
@@ -238,6 +255,7 @@ mod imp {
238255
#[cfg(not(jemalloc), unix)]
239256
mod imp {
240257
use core::cmp;
258+
use core::mem;
241259
use core::ptr;
242260
use libc;
243261
use libc_heap;

branches/auto/src/libcollections/enum_set.rs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,15 @@
1414
//! representation to hold C-like enum variants.
1515
1616
use core::prelude::*;
17-
use core::fmt;
1817

19-
#[deriving(Clone, PartialEq, Eq, Hash)]
18+
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
2019
/// A specialized `Set` implementation to use enum types.
2120
pub struct EnumSet<E> {
2221
// We must maintain the invariant that no bits are set
2322
// for which no variant exists
2423
bits: uint
2524
}
2625

27-
impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
28-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
29-
try!(write!(fmt, "{{"));
30-
let mut first = true;
31-
for e in self.iter() {
32-
if !first {
33-
try!(write!(fmt, ", "));
34-
}
35-
try!(write!(fmt, "{}", e));
36-
first = false;
37-
}
38-
write!(fmt, "}}")
39-
}
40-
}
41-
4226
/// An interface for casting C-like enum to uint and back.
4327
pub trait CLike {
4428
/// Converts a C-like enum to a `uint`.
@@ -181,16 +165,6 @@ mod test {
181165
assert!(e.is_empty());
182166
}
183167

184-
#[test]
185-
fn test_show() {
186-
let mut e = EnumSet::empty();
187-
assert_eq!("{}", e.to_string().as_slice());
188-
e.add(A);
189-
assert_eq!("{A}", e.to_string().as_slice());
190-
e.add(C);
191-
assert_eq!("{A, C}", e.to_string().as_slice());
192-
}
193-
194168
///////////////////////////////////////////////////////////////////////////
195169
// intersect
196170

branches/auto/src/libcollections/vec.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
use core::prelude::*;
1616

17-
use alloc::heap::{EMPTY, allocate, reallocate, deallocate};
17+
use alloc::heap::{allocate, reallocate, deallocate};
1818
use core::cmp::max;
1919
use core::default::Default;
2020
use core::fmt;
@@ -28,6 +28,10 @@ use {Mutable, MutableSeq};
2828
use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector};
2929
use slice::{Items, MutItems};
3030

31+
32+
#[doc(hidden)]
33+
pub static PTR_MARKER: u8 = 0;
34+
3135
/// An owned, growable vector.
3236
///
3337
/// # Examples
@@ -120,7 +124,7 @@ impl<T> Vec<T> {
120124
// non-null value which is fine since we never call deallocate on the ptr
121125
// if cap is 0. The reason for this is because the pointer of a slice
122126
// being NULL would break the null pointer optimization for enums.
123-
Vec { len: 0, cap: 0, ptr: EMPTY as *mut T }
127+
Vec { len: 0, cap: 0, ptr: &PTR_MARKER as *const _ as *mut T }
124128
}
125129

126130
/// Constructs a new, empty `Vec` with the specified capacity.
@@ -153,7 +157,7 @@ impl<T> Vec<T> {
153157
#[inline]
154158
pub fn with_capacity(capacity: uint) -> Vec<T> {
155159
if mem::size_of::<T>() == 0 {
156-
Vec { len: 0, cap: uint::MAX, ptr: EMPTY as *mut T }
160+
Vec { len: 0, cap: uint::MAX, ptr: &PTR_MARKER as *const _ as *mut T }
157161
} else if capacity == 0 {
158162
Vec::new()
159163
} else {
@@ -1660,8 +1664,6 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
16601664
}
16611665
}
16621666

1663-
impl<T> ExactSize<T> for MoveItems<T> {}
1664-
16651667
#[unsafe_destructor]
16661668
impl<T> Drop for MoveItems<T> {
16671669
fn drop(&mut self) {

branches/auto/src/librlibc/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@
3535
// LLVM to optimize these function calls to themselves!
3636
#![no_builtins]
3737

38-
#[phase(plugin, link)] extern crate core;
39-
4038
#[cfg(test)] extern crate native;
4139
#[cfg(test)] extern crate test;
4240
#[cfg(test)] extern crate debug;
4341

4442
#[cfg(test)] #[phase(plugin, link)] extern crate std;
43+
#[cfg(test)] #[phase(plugin, link)] extern crate core;
4544

4645
// Require the offset intrinsics for LLVM to properly optimize the
4746
// implementations below. If pointer arithmetic is done through integers the

branches/auto/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ pub mod middle {
108108
pub mod save;
109109
pub mod stability;
110110
pub mod subst;
111-
pub mod traits;
112111
pub mod trans;
113112
pub mod ty;
114113
pub mod ty_fold;

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,17 +1470,17 @@ impl LintPass for Stability {
14701470
def_id
14711471
}
14721472
typeck::MethodParam(typeck::MethodParam {
1473-
trait_ref: ref trait_ref,
1473+
trait_id: trait_id,
14741474
method_num: index,
14751475
..
1476-
}) |
1477-
typeck::MethodObject(typeck::MethodObject {
1478-
trait_ref: ref trait_ref,
1476+
})
1477+
| typeck::MethodObject(typeck::MethodObject {
1478+
trait_id: trait_id,
14791479
method_num: index,
14801480
..
14811481
}) => {
14821482
match ty::trait_item(cx.tcx,
1483-
trait_ref.def_id,
1483+
trait_id,
14841484
index) {
14851485
ty::MethodTraitItem(method) => {
14861486
method.def_id

branches/auto/src/librustc/metadata/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,9 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
140140
tag_table_unboxed_closures = 0x54,
141141
tag_table_upvar_borrow_map = 0x55,
142142
tag_table_capture_modes = 0x56,
143-
tag_table_object_cast_map = 0x57,
144143
}
145144
static first_astencode_tag: uint = tag_ast as uint;
146-
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
145+
static last_astencode_tag: uint = tag_table_capture_modes as uint;
147146
impl astencode_tag {
148147
pub fn from_uint(value : uint) -> Option<astencode_tag> {
149148
let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;

0 commit comments

Comments
 (0)