Skip to content

Commit 6ed6b9b

Browse files
committed
---
yaml --- r: 161278 b: refs/heads/snap-stage3 c: dd4c7c0 h: refs/heads/master v: v3
1 parent 1bfedc6 commit 6ed6b9b

File tree

33 files changed

+175
-341
lines changed

33 files changed

+175
-341
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: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2264049577e1d64a2a863a9b9f2b7d94f6b90e15
4+
refs/heads/snap-stage3: dd4c7c00d85a82d3ddda1b453ba2ce649a4d1b41
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/reference.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,20 +1689,7 @@ methods in such an implementation can only be used as direct calls on the
16891689
values of the type that the implementation targets. In such an implementation,
16901690
the trait type and `for` after `impl` are omitted. Such implementations are
16911691
limited to nominal types (enums, structs), and the implementation must appear
1692-
in the same module or a sub-module as the `self` type:
1693-
1694-
```
1695-
struct Point {x: int, y: int}
1696-
1697-
impl Point {
1698-
fn log(&self) {
1699-
println!("Point is at ({}, {})", self.x, self.y);
1700-
}
1701-
}
1702-
1703-
let my_point = Point {x: 10, y:11};
1704-
my_point.log();
1705-
```
1692+
in the same module or a sub-module as the `self` type.
17061693

17071694
When a trait _is_ specified in an `impl`, all methods declared as part of the
17081695
trait must be implemented, with matching types and type parameter counts.

branches/snap-stage3/src/etc/emacs/rust-mode.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
(modify-syntax-entry ?\" "\"" table)
3232
(modify-syntax-entry ?\\ "\\" table)
3333

34+
;; _ is a word-char
35+
(modify-syntax-entry ?_ "w" table)
36+
3437
;; Comments
3538
(modify-syntax-entry ?/ ". 124b" table)
3639
(modify-syntax-entry ?* ". 23" table)
@@ -394,7 +397,7 @@ This is written mainly to be used as `beginning-of-defun-function' for Rust.
394397
Don't move to the beginning of the line. `beginning-of-defun',
395398
which calls this, does that afterwards."
396399
(interactive "p")
397-
(re-search-backward (concat "^\\(" rust-top-item-beg-re "\\)\\_>")
400+
(re-search-backward (concat "^\\(" rust-top-item-beg-re "\\)\\b")
398401
nil 'move (or arg 1)))
399402

400403
(defun rust-end-of-defun ()

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,18 +1248,14 @@ pub struct MoveItems<T> {
12481248
impl<T> MoveItems<T> {
12491249
#[inline]
12501250
/// Drops all items that have not yet been moved and returns the empty vector.
1251-
pub fn into_inner(mut self) -> Vec<T> {
1251+
pub fn unwrap(mut self) -> Vec<T> {
12521252
unsafe {
12531253
for _x in self { }
12541254
let MoveItems { allocation, cap, ptr: _ptr, end: _end } = self;
12551255
mem::forget(self);
12561256
Vec { ptr: allocation, cap: cap, len: 0 }
12571257
}
12581258
}
1259-
1260-
/// Deprecated, use into_inner() instead
1261-
#[deprecated = "renamed to into_inner()"]
1262-
pub fn unwrap(self) -> Vec<T> { self.into_inner() }
12631259
}
12641260

12651261
impl<T> Iterator<T> for MoveItems<T> {

branches/snap-stage3/src/libcore/cell.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,15 @@ impl<T> RefCell<T> {
256256
}
257257

258258
/// Consumes the `RefCell`, returning the wrapped value.
259-
#[unstable = "recently renamed per RFC 430"]
260-
pub fn into_inner(self) -> T {
259+
#[unstable = "may be renamed, depending on global conventions"]
260+
pub fn unwrap(self) -> T {
261261
// Since this function takes `self` (the `RefCell`) by value, the
262262
// compiler statically verifies that it is not currently borrowed.
263263
// Therefore the following assertion is just a `debug_assert!`.
264264
debug_assert!(self.borrow.get() == UNUSED);
265-
unsafe { self.value.into_inner() }
265+
unsafe{self.value.unwrap()}
266266
}
267267

268-
/// Deprecated, use into_inner() instead
269-
#[deprecated = "renamed to into_inner()"]
270-
pub fn unwrap(self) -> T { self.into_inner() }
271-
272268
/// Attempts to immutably borrow the wrapped value.
273269
///
274270
/// The borrow lasts until the returned `Ref` exits scope. Multiple
@@ -522,9 +518,5 @@ impl<T> UnsafeCell<T> {
522518
#[inline]
523519
#[unstable = "conventions around the name `unwrap` are still under \
524520
development"]
525-
pub unsafe fn into_inner(self) -> T { self.value }
526-
527-
/// Deprecated, use into_inner() instead
528-
#[deprecated = "renamed to into_inner()"]
529-
pub unsafe fn unwrap(self) -> T { self.into_inner() }
521+
pub unsafe fn unwrap(self) -> T { self.value }
530522
}

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,21 +1104,6 @@ macro_rules! iterator {
11041104
}
11051105
}
11061106

1107-
macro_rules! make_slice {
1108-
($t: ty -> $result: ty: $start: expr, $end: expr) => {{
1109-
let diff = $end as uint - $start as uint;
1110-
let len = if mem::size_of::<T>() == 0 {
1111-
diff
1112-
} else {
1113-
diff / mem::size_of::<$t>()
1114-
};
1115-
unsafe {
1116-
transmute::<_, $result>(RawSlice { data: $start as *const T, len: len })
1117-
}
1118-
}}
1119-
}
1120-
1121-
11221107
/// Immutable slice iterator
11231108
#[experimental = "needs review"]
11241109
pub struct Items<'a, T: 'a> {
@@ -1127,36 +1112,6 @@ pub struct Items<'a, T: 'a> {
11271112
marker: marker::ContravariantLifetime<'a>
11281113
}
11291114

1130-
#[experimental]
1131-
impl<'a, T> ops::Slice<uint, [T]> for Items<'a, T> {
1132-
fn as_slice_(&self) -> &[T] {
1133-
self.as_slice()
1134-
}
1135-
fn slice_from_or_fail<'b>(&'b self, from: &uint) -> &'b [T] {
1136-
use ops::Slice;
1137-
self.as_slice().slice_from_or_fail(from)
1138-
}
1139-
fn slice_to_or_fail<'b>(&'b self, to: &uint) -> &'b [T] {
1140-
use ops::Slice;
1141-
self.as_slice().slice_to_or_fail(to)
1142-
}
1143-
fn slice_or_fail<'b>(&'b self, from: &uint, to: &uint) -> &'b [T] {
1144-
use ops::Slice;
1145-
self.as_slice().slice_or_fail(from, to)
1146-
}
1147-
}
1148-
1149-
impl<'a, T> Items<'a, T> {
1150-
/// View the underlying data as a subslice of the original data.
1151-
///
1152-
/// This has the same lifetime as the original slice, and so the
1153-
/// iterator can continue to be used while this exists.
1154-
#[experimental]
1155-
pub fn as_slice(&self) -> &'a [T] {
1156-
make_slice!(T -> &'a [T]: self.ptr, self.end)
1157-
}
1158-
}
1159-
11601115
iterator!{struct Items -> *const T, &'a T}
11611116

11621117
#[experimental = "needs review"]
@@ -1201,57 +1156,6 @@ pub struct MutItems<'a, T: 'a> {
12011156
marker2: marker::NoCopy
12021157
}
12031158

1204-
#[experimental]
1205-
impl<'a, T> ops::Slice<uint, [T]> for MutItems<'a, T> {
1206-
fn as_slice_<'b>(&'b self) -> &'b [T] {
1207-
make_slice!(T -> &'b [T]: self.ptr, self.end)
1208-
}
1209-
fn slice_from_or_fail<'b>(&'b self, from: &uint) -> &'b [T] {
1210-
use ops::Slice;
1211-
self.as_slice_().slice_from_or_fail(from)
1212-
}
1213-
fn slice_to_or_fail<'b>(&'b self, to: &uint) -> &'b [T] {
1214-
use ops::Slice;
1215-
self.as_slice_().slice_to_or_fail(to)
1216-
}
1217-
fn slice_or_fail<'b>(&'b self, from: &uint, to: &uint) -> &'b [T] {
1218-
use ops::Slice;
1219-
self.as_slice_().slice_or_fail(from, to)
1220-
}
1221-
}
1222-
1223-
#[experimental]
1224-
impl<'a, T> ops::SliceMut<uint, [T]> for MutItems<'a, T> {
1225-
fn as_mut_slice_<'b>(&'b mut self) -> &'b mut [T] {
1226-
make_slice!(T -> &'b mut [T]: self.ptr, self.end)
1227-
}
1228-
fn slice_from_or_fail_mut<'b>(&'b mut self, from: &uint) -> &'b mut [T] {
1229-
use ops::SliceMut;
1230-
self.as_mut_slice_().slice_from_or_fail_mut(from)
1231-
}
1232-
fn slice_to_or_fail_mut<'b>(&'b mut self, to: &uint) -> &'b mut [T] {
1233-
use ops::SliceMut;
1234-
self.as_mut_slice_().slice_to_or_fail_mut(to)
1235-
}
1236-
fn slice_or_fail_mut<'b>(&'b mut self, from: &uint, to: &uint) -> &'b mut [T] {
1237-
use ops::SliceMut;
1238-
self.as_mut_slice_().slice_or_fail_mut(from, to)
1239-
}
1240-
}
1241-
1242-
impl<'a, T> MutItems<'a, T> {
1243-
/// View the underlying data as a subslice of the original data.
1244-
///
1245-
/// To avoid creating `&mut` references that alias, this is forced
1246-
/// to consume the iterator. Consider using the `Slice` and
1247-
/// `SliceMut` implementations for obtaining slices with more
1248-
/// restricted lifetimes that do not consume the iterator.
1249-
#[experimental]
1250-
pub fn into_slice(self) -> &'a mut [T] {
1251-
make_slice!(T -> &'a mut [T]: self.ptr, self.end)
1252-
}
1253-
}
1254-
12551159
iterator!{struct MutItems -> *mut T, &'a mut T}
12561160

12571161
#[experimental = "needs review"]

branches/snap-stage3/src/libcore/str.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,19 +1277,14 @@ pub mod traits {
12771277
}
12781278

12791279
/// Any string that can be represented as a slice
1280-
pub trait Str for Sized? {
1280+
pub trait Str {
12811281
/// Work with `self` as a slice.
12821282
fn as_slice<'a>(&'a self) -> &'a str;
12831283
}
12841284

1285-
impl Str for str {
1285+
impl<'a> Str for &'a str {
12861286
#[inline]
1287-
fn as_slice<'a>(&'a self) -> &'a str { self }
1288-
}
1289-
1290-
impl<'a, Sized? S> Str for &'a S where S: Str {
1291-
#[inline]
1292-
fn as_slice(&self) -> &str { Str::as_slice(*self) }
1287+
fn as_slice<'a>(&'a self) -> &'a str { *self }
12931288
}
12941289

12951290
/// Methods for string slices

branches/snap-stage3/src/libcoretest/slice.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,3 @@ fn binary_search_not_found() {
3333
let b = [1i, 2, 4, 5, 6, 8];
3434
assert!(b.binary_search(|v| v.cmp(&9)) == NotFound(6));
3535
}
36-
37-
#[test]
38-
fn iterator_to_slice() {
39-
macro_rules! test {
40-
($data: expr) => {{
41-
let data: &mut [_] = &mut $data;
42-
let other_data: &mut [_] = &mut $data;
43-
44-
{
45-
let mut iter = data.iter();
46-
assert_eq!(iter[], other_data[]);
47-
48-
iter.next();
49-
assert_eq!(iter[], other_data[1..]);
50-
51-
iter.next_back();
52-
assert_eq!(iter[], other_data[1..2]);
53-
54-
let s = iter.as_slice();
55-
iter.next();
56-
assert_eq!(s, other_data[1..2]);
57-
}
58-
{
59-
let mut iter = data.iter_mut();
60-
assert_eq!(iter[], other_data[]);
61-
// mutability:
62-
assert!(iter[mut] == other_data);
63-
64-
iter.next();
65-
assert_eq!(iter[], other_data[1..]);
66-
assert!(iter[mut] == other_data[mut 1..]);
67-
68-
iter.next_back();
69-
70-
assert_eq!(iter[], other_data[1..2]);
71-
assert!(iter[mut] == other_data[mut 1..2]);
72-
73-
let s = iter.into_slice();
74-
assert!(s == other_data[mut 1..2]);
75-
}
76-
}}
77-
}
78-
79-
// try types of a variety of sizes
80-
test!([(1u64, 1u64, 1u8), (2, 2, 2), (3, 3, 3)]);
81-
test!([1u64,2,3]);
82-
test!([1u8,2,3]);
83-
test!([(),(),()]);
84-
}

branches/snap-stage3/src/librustc/lint/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,5 +827,5 @@ pub fn check_crate(tcx: &ty::ctxt,
827827
}
828828

829829
tcx.sess.abort_if_errors();
830-
*tcx.node_lint_levels.borrow_mut() = cx.node_levels.into_inner();
830+
*tcx.node_lint_levels.borrow_mut() = cx.node_levels.unwrap();
831831
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ pub unsafe extern "C" fn rust_llvm_string_write_impl(sr: RustStringRef,
21482148
pub fn build_string(f: |RustStringRef|) -> Option<String> {
21492149
let mut buf = RefCell::new(Vec::new());
21502150
f(&mut buf as RustStringRepr as RustStringRef);
2151-
String::from_utf8(buf.into_inner()).ok()
2151+
String::from_utf8(buf.unwrap()).ok()
21522152
}
21532153

21542154
pub unsafe fn twine_to_string(tr: TwineRef) -> String {

branches/snap-stage3/src/librustc_trans/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ fn run_work_multithreaded(sess: &Session,
899899

900900
let mut panicked = false;
901901
for future in futures.into_iter() {
902-
match future.into_inner() {
902+
match future.unwrap() {
903903
Ok(()) => {},
904904
Err(_) => {
905905
panicked = true;

branches/snap-stage3/src/librustc_trans/save/recorder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a> FmtStrs<'a> {
171171

172172
let pairs = fields.iter().zip(values);
173173
let mut strs = pairs.map(|(f, v)| format!(",{},\"{}\"", f, escape(
174-
if *f == "qualname" && v.len() > 0 {
174+
if *f == "qualname" {
175175
let mut n = self.krate.clone();
176176
n.push_str("::");
177177
n.push_str(v);

branches/snap-stage3/src/librustc_trans/save/span_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ impl<'a> SpanUtils<'a> {
293293
if ts.tok == token::Eof {
294294
return None
295295
} else {
296+
println!("found keyword: {} at {}", ts, ts.sp);
296297
return self.make_sub_span(span, Some(ts.sp));
297298
}
298299
}

branches/snap-stage3/src/librustdoc/clean/mod.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ pub enum ItemEnum {
336336
ForeignStaticItem(Static),
337337
MacroItem(Macro),
338338
PrimitiveItem(PrimitiveType),
339-
AssociatedTypeItem,
339+
AssociatedTypeItem(TyParam),
340340
}
341341

342342
#[deriving(Clone, Encodable, Decodable)]
@@ -982,6 +982,8 @@ impl Clean<Type> for ast::PolyTraitRef {
982982
}
983983
}
984984

985+
/// An item belonging to a trait, whether a method or associated. Could be named
986+
/// TraitItem except that's already taken by an exported enum variant.
985987
#[deriving(Clone, Encodable, Decodable)]
986988
pub enum TraitMethod {
987989
RequiredMethod(Item),
@@ -1002,6 +1004,12 @@ impl TraitMethod {
10021004
_ => false,
10031005
}
10041006
}
1007+
pub fn is_type(&self) -> bool {
1008+
match self {
1009+
&TypeTraitItem(..) => true,
1010+
_ => false,
1011+
}
1012+
}
10051013
pub fn item<'a>(&'a self) -> &'a Item {
10061014
match *self {
10071015
RequiredMethod(ref item) => item,
@@ -2211,7 +2219,7 @@ impl Clean<Item> for ast::AssociatedType {
22112219
source: self.ty_param.span.clean(cx),
22122220
name: Some(self.ty_param.ident.clean(cx)),
22132221
attrs: self.attrs.clean(cx),
2214-
inner: AssociatedTypeItem,
2222+
inner: AssociatedTypeItem(self.ty_param.clean(cx)),
22152223
visibility: None,
22162224
def_id: ast_util::local_def(self.ty_param.id),
22172225
stability: None,
@@ -2225,7 +2233,17 @@ impl Clean<Item> for ty::AssociatedType {
22252233
source: DUMMY_SP.clean(cx),
22262234
name: Some(self.name.clean(cx)),
22272235
attrs: Vec::new(),
2228-
inner: AssociatedTypeItem,
2236+
// FIXME(#18048): this is wrong, but cross-crate associated types are broken
2237+
// anyway, for the time being.
2238+
inner: AssociatedTypeItem(TyParam {
2239+
name: self.name.clean(cx),
2240+
did: ast::DefId {
2241+
krate: 0,
2242+
node: ast::DUMMY_NODE_ID
2243+
},
2244+
bounds: vec![],
2245+
default: None
2246+
}),
22292247
visibility: None,
22302248
def_id: self.def_id,
22312249
stability: None,

0 commit comments

Comments
 (0)