Skip to content

Commit 0012b50

Browse files
committed
auto merge of #8030 : thestinger/rust/iterator, r=huonw
2 parents b1f5b1b + ba41755 commit 0012b50

File tree

7 files changed

+8
-46
lines changed

7 files changed

+8
-46
lines changed

doc/tutorial-container.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ impl Iterator<int> for ZeroStream {
108108
## Container iterators
109109
110110
Containers implement iteration over the contained elements by returning an
111-
iterator object. For example, vector slices have four iterators available:
111+
iterator object. For example, vector slices several iterators available:
112112
113-
* `vector.iter()`, for immutable references to the elements
114-
* `vector.mut_iter()`, for mutable references to the elements
115-
* `vector.rev_iter()`, for immutable references to the elements in reverse order
116-
* `vector.mut_rev_iter()`, for mutable references to the elements in reverse order
113+
* `iter()` and `rev_iter()`, for immutable references to the elements
114+
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
115+
* `consume_iter()` and `consume_rev_iter`, to move the elements out by-value
116+
117+
A typical mutable container will implement at least `iter()`, `mut_iter()` and
118+
`consume_iter()` along with the reverse variants if it maintains an order.
117119
118120
### Freezing
119121

src/librustc/middle/lint.rs

-26
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub enum lint {
7979
non_camel_case_types,
8080
non_uppercase_statics,
8181
type_limits,
82-
default_methods,
8382
unused_unsafe,
8483

8584
managed_heap_memory,
@@ -222,13 +221,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
222221
default: warn
223222
}),
224223

225-
("default_methods",
226-
LintSpec {
227-
lint: default_methods,
228-
desc: "allow default methods",
229-
default: allow
230-
}),
231-
232224
("unused_unsafe",
233225
LintSpec {
234226
lint: unused_unsafe,
@@ -690,23 +682,6 @@ fn lint_type_limits() -> visit::vt<@mut Context> {
690682
})
691683
}
692684

693-
fn check_item_default_methods(cx: &Context, item: &ast::item) {
694-
match item.node {
695-
ast::item_trait(_, _, ref methods) => {
696-
for methods.iter().advance |method| {
697-
match *method {
698-
ast::required(*) => {}
699-
ast::provided(*) => {
700-
cx.span_lint(default_methods, item.span,
701-
"default methods are experimental");
702-
}
703-
}
704-
}
705-
}
706-
_ => {}
707-
}
708-
}
709-
710685
fn check_item_ctypes(cx: &Context, it: &ast::item) {
711686
fn check_ty(cx: &Context, ty: &ast::Ty) {
712687
match ty.node {
@@ -1143,7 +1118,6 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::Crate) {
11431118
check_item_ctypes(cx, it);
11441119
check_item_non_camel_case_types(cx, it);
11451120
check_item_non_uppercase_statics(cx, it);
1146-
check_item_default_methods(cx, it);
11471121
check_item_heap(cx, it);
11481122

11491123
cx.process(Item(it));

src/libstd/cmp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ and `Eq` to overload the `==` and `!=` operators.
2121
*/
2222

2323
#[allow(missing_doc)];
24-
#[allow(default_methods)]; // NOTE: Remove when allowed in stage0
2524

2625
/**
2726
* Trait for values that can be compared for equality and inequality.

src/libstd/iterator.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ implementing the `Iterator` trait.
1717
1818
*/
1919

20-
#[allow(default_methods)]; // still off by default in stage0
21-
2220
use cmp;
2321
use iter::Times;
2422
use num::{Zero, One};

src/rt/rust_task.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ cleanup_task(cleanup_args *args) {
152152
#endif
153153
}
154154

155-
extern "C" CDECL void upcall_exchange_free(void *ptr);
156-
157155
// This runs on the Rust stack
158156
void task_start_wrapper(spawn_args *a)
159157
{

src/test/compile-fail/lint-default-methods.rs

-7
This file was deleted.

src/test/run-pass/issue-7712.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// compile-flags:-Z debug-info
1212

13-
#[allow(default_methods)];
14-
1513
pub trait TraitWithDefaultMethod {
1614
pub fn method(self) {
1715
()
@@ -24,4 +22,4 @@ impl TraitWithDefaultMethod for MyStruct { }
2422

2523
fn main() {
2624
MyStruct.method();
27-
}
25+
}

0 commit comments

Comments
 (0)