Skip to content

minor cleanup + tutorial improvement #8030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions doc/tutorial-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ impl Iterator<int> for ZeroStream {
## Container iterators

Containers implement iteration over the contained elements by returning an
iterator object. For example, vector slices have four iterators available:
iterator object. For example, vector slices several iterators available:

* `vector.iter()`, for immutable references to the elements
* `vector.mut_iter()`, for mutable references to the elements
* `vector.rev_iter()`, for immutable references to the elements in reverse order
* `vector.mut_rev_iter()`, for mutable references to the elements in reverse order
* `iter()` and `rev_iter()`, for immutable references to the elements
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
* `consume_iter()` and `consume_rev_iter`, to move the elements out by-value

A typical mutable container will implement at least `iter()`, `mut_iter()` and
`consume_iter()` along with the reverse variants if it maintains an order.

### Freezing

Expand Down
26 changes: 0 additions & 26 deletions src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ pub enum lint {
non_camel_case_types,
non_uppercase_statics,
type_limits,
default_methods,
unused_unsafe,

managed_heap_memory,
Expand Down Expand Up @@ -222,13 +221,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
default: warn
}),

("default_methods",
LintSpec {
lint: default_methods,
desc: "allow default methods",
default: allow
}),

("unused_unsafe",
LintSpec {
lint: unused_unsafe,
Expand Down Expand Up @@ -690,23 +682,6 @@ fn lint_type_limits() -> visit::vt<@mut Context> {
})
}

fn check_item_default_methods(cx: &Context, item: &ast::item) {
match item.node {
ast::item_trait(_, _, ref methods) => {
for methods.iter().advance |method| {
match *method {
ast::required(*) => {}
ast::provided(*) => {
cx.span_lint(default_methods, item.span,
"default methods are experimental");
}
}
}
}
_ => {}
}
}

fn check_item_ctypes(cx: &Context, it: &ast::item) {
fn check_ty(cx: &Context, ty: &ast::Ty) {
match ty.node {
Expand Down Expand Up @@ -1143,7 +1118,6 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::Crate) {
check_item_ctypes(cx, it);
check_item_non_camel_case_types(cx, it);
check_item_non_uppercase_statics(cx, it);
check_item_default_methods(cx, it);
check_item_heap(cx, it);

cx.process(Item(it));
Expand Down
1 change: 0 additions & 1 deletion src/libstd/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ and `Eq` to overload the `==` and `!=` operators.
*/

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

/**
* Trait for values that can be compared for equality and inequality.
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ implementing the `Iterator` trait.

*/

#[allow(default_methods)]; // still off by default in stage0

use cmp;
use iter::Times;
use num::{Zero, One};
Expand Down
2 changes: 0 additions & 2 deletions src/rt/rust_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ cleanup_task(cleanup_args *args) {
#endif
}

extern "C" CDECL void upcall_exchange_free(void *ptr);

// This runs on the Rust stack
void task_start_wrapper(spawn_args *a)
{
Expand Down
7 changes: 0 additions & 7 deletions src/test/compile-fail/lint-default-methods.rs

This file was deleted.

4 changes: 1 addition & 3 deletions src/test/run-pass/issue-7712.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

// compile-flags:-Z debug-info

#[allow(default_methods)];

pub trait TraitWithDefaultMethod {
pub fn method(self) {
()
Expand All @@ -24,4 +22,4 @@ impl TraitWithDefaultMethod for MyStruct { }

fn main() {
MyStruct.method();
}
}