Skip to content

Commit 5321b8f

Browse files
committed
---
yaml --- r: 191831 b: refs/heads/snap-stage3 c: 7c333e9 h: refs/heads/master i: 191829: 5c056b4 191827: 6febed7 191823: 9da28bc v: v3
1 parent 2bd01c1 commit 5321b8f

File tree

135 files changed

+5086
-2568
lines changed

Some content is hidden

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

135 files changed

+5086
-2568
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 48df3fb678d0a6a3eb1407410673de7ef8a1ae2f
4+
refs/heads/snap-stage3: 7c333e99bffd4d93a17b0db3495b30e0a8552b5b
55
refs/heads/try: ce76bff75603a754d092456285ff455eb871633d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,22 +1052,22 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
10521052
if *idx >= haystack.len() {
10531053
return false;
10541054
}
1055-
let ch = haystack.char_at(*idx);
1056-
if ch != needle {
1055+
let range = haystack.char_range_at(*idx);
1056+
if range.ch != needle {
10571057
return false;
10581058
}
1059-
*idx += ch.len_utf8();
1059+
*idx = range.next;
10601060
return true;
10611061
}
10621062

10631063
fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
10641064
let mut i = *idx;
10651065
while i < haystack.len() {
1066-
let ch = haystack.char_at(i);
1067-
if ch < '0' || '9' < ch {
1066+
let range = haystack.char_range_at(i);
1067+
if range.ch < '0' || '9' < range.ch {
10681068
break;
10691069
}
1070-
i += ch.len_utf8();
1070+
i = range.next;
10711071
}
10721072
if i == *idx {
10731073
return false;
@@ -1083,9 +1083,9 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
10831083
if haystack_i >= haystack.len() {
10841084
return false;
10851085
}
1086-
let ch = haystack.char_at(haystack_i);
1087-
haystack_i += ch.len_utf8();
1088-
if !scan_char(needle, ch, &mut needle_i) {
1086+
let range = haystack.char_range_at(haystack_i);
1087+
haystack_i = range.next;
1088+
if !scan_char(needle, range.ch, &mut needle_i) {
10891089
return false;
10901090
}
10911091
}

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl BoxAny for Box<Any> {
264264
}
265265
}
266266

267+
#[cfg(not(stage0))]
267268
#[stable(feature = "rust1", since = "1.0.0")]
268269
impl BoxAny for Box<Any+Send> {
269270
#[inline]

branches/snap-stage3/src/liballoc/heap.rs

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

11+
#[cfg(stage0)]
12+
#[cfg(not(test))]
13+
use core::ptr::PtrExt;
14+
1115
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1216

1317
/// Return a pointer to `size` bytes of memory aligned to `align`.

branches/snap-stage3/src/liballoc/rc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ use core::nonzero::NonZero;
159159
use core::ops::{Deref, Drop};
160160
use core::option::Option;
161161
use core::option::Option::{Some, None};
162+
#[cfg(stage0)]
163+
use core::ptr::{self, PtrExt};
164+
#[cfg(not(stage0))]
162165
use core::ptr;
163166
use core::result::Result;
164167
use core::result::Result::{Ok, Err};

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ extern crate alloc;
4242

4343
use std::cell::{Cell, RefCell};
4444
use std::cmp;
45+
use std::intrinsics::{TyDesc, get_tydesc};
4546
use std::intrinsics;
4647
use std::marker;
4748
use std::mem;
49+
#[cfg(stage0)]
50+
use std::num::{Int, UnsignedInt};
4851
use std::ptr;
4952
use std::rc::Rc;
5053
use std::rt::heap::{allocate, deallocate};
@@ -183,25 +186,6 @@ fn un_bitpack_tydesc_ptr(p: usize) -> (*const TyDesc, bool) {
183186
((p & !1) as *const TyDesc, p & 1 == 1)
184187
}
185188

186-
// HACK(eddyb) TyDesc replacement using a trait object vtable.
187-
// This could be replaced in the future with a custom DST layout,
188-
// or `&'static (drop_glue, size, align)` created by a `const fn`.
189-
struct TyDesc {
190-
drop_glue: fn(*const i8),
191-
size: usize,
192-
align: usize
193-
}
194-
195-
unsafe fn get_tydesc<T>() -> *const TyDesc {
196-
use std::raw::TraitObject;
197-
198-
let ptr = &*(1 as *const T);
199-
200-
// Can use any trait that is implemented for all types.
201-
let obj = mem::transmute::<&marker::MarkerTrait, TraitObject>(ptr);
202-
obj.vtable as *const TyDesc
203-
}
204-
205189
impl<'longer_than_self> Arena<'longer_than_self> {
206190
fn chunk_size(&self) -> usize {
207191
self.copy_head.borrow().capacity()

branches/snap-stage3/src/libcollections/btree/node.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ struct MutNodeSlice<'a, K: 'a, V: 'a> {
105105
/// Fails if `target_alignment` is not a power of two.
106106
#[inline]
107107
fn round_up_to_next(unrounded: usize, target_alignment: usize) -> usize {
108+
#[cfg(stage0)]
109+
use core::num::UnsignedInt;
110+
108111
assert!(target_alignment.is_power_of_two());
109112
(unrounded + target_alignment - 1) & !(target_alignment - 1)
110113
}

branches/snap-stage3/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#![feature(unique)]
3636
#![feature(unsafe_no_drop_flag)]
3737
#![feature(step_by)]
38-
#![feature(str_char)]
3938
#![cfg_attr(test, feature(rand, rustc_private, test))]
4039
#![cfg_attr(test, allow(deprecated))] // rand
4140

branches/snap-stage3/src/libcollections/macros.rs

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

11+
#[cfg(stage0)]
12+
/// Creates a `Vec` containing the arguments.
13+
///
14+
/// `vec!` allows `Vec`s to be defined with the same syntax as array expressions.
15+
/// There are two forms of this macro:
16+
///
17+
/// - Create a `Vec` containing a given list of elements:
18+
///
19+
/// ```
20+
/// let v = vec![1, 2, 3];
21+
/// assert_eq!(v[0], 1);
22+
/// assert_eq!(v[1], 2);
23+
/// assert_eq!(v[2], 3);
24+
/// ```
25+
///
26+
/// - Create a `Vec` from a given element and size:
27+
///
28+
/// ```
29+
/// let v = vec![1; 3];
30+
/// assert_eq!(v, [1, 1, 1]);
31+
/// ```
32+
///
33+
/// Note that unlike array expressions this syntax supports all elements
34+
/// which implement `Clone` and the number of elements doesn't have to be
35+
/// a constant.
36+
#[macro_export]
37+
#[stable(feature = "rust1", since = "1.0.0")]
38+
macro_rules! vec {
39+
($elem:expr; $n:expr) => (
40+
$crate::vec::from_elem($elem, $n)
41+
);
42+
($($x:expr),*) => (
43+
<[_] as $crate::slice::SliceExt>::into_vec(
44+
$crate::boxed::Box::new([$($x),*]))
45+
);
46+
($($x:expr,)*) => (vec![$($x),*])
47+
}
48+
49+
#[cfg(not(stage0))]
1150
/// Creates a `Vec` containing the arguments.
1251
///
1352
/// `vec!` allows `Vec`s to be defined with the same syntax as array expressions.
@@ -45,10 +84,11 @@ macro_rules! vec {
4584
($($x:expr,)*) => (vec![$($x),*])
4685
}
4786

48-
// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is
49-
// required for this macro definition, is not available. Instead use the
50-
// `slice::into_vec` function which is only available with cfg(test)
87+
// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is required for this
88+
// macro definition, is not available. Instead use the `slice::into_vec` function which is only
89+
// available with cfg(test)
5190
// NB see the slice::hack module in slice.rs for more information
91+
#[cfg(not(stage0))]
5292
#[cfg(test)]
5393
macro_rules! vec {
5494
($elem:expr; $n:expr) => (

0 commit comments

Comments
 (0)