Skip to content

Commit 677fe03

Browse files
committed
---
yaml --- r: 65262 b: refs/heads/master c: 2f69bb9 h: refs/heads/master v: v3
1 parent 9fdf555 commit 677fe03

File tree

5 files changed

+8
-100
lines changed

5 files changed

+8
-100
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c6581325ac38ce3f96cb7a0ea0aad35feed173c1
2+
refs/heads/master: 2f69bb9ba9d622ccab77840c08f4562a10b44c29
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/doc/rust.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,10 +2435,11 @@ match x {
24352435
}
24362436
~~~~
24372437

2438-
Patterns that bind variables default to binding to a copy of the matched value. This can be made
2439-
explicit using the ```copy``` keyword, changed to bind to a borrowed pointer by using the ```ref```
2440-
keyword, or to a mutable borrowed pointer using ```ref mut```, or the value can be moved into
2441-
the new binding using ```move```.
2438+
Patterns that bind variables default to binding to a copy or move of the matched value
2439+
(depending on the matched value's type).
2440+
This can be made explicit using the ```copy``` keyword,
2441+
changed to bind to a borrowed pointer by using the ```ref``` keyword,
2442+
or to a mutable borrowed pointer using ```ref mut```.
24422443

24432444
A pattern that's just an identifier,
24442445
like `Nil` in the previous answer,

trunk/src/librustc/middle/lint.rs

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ pub enum lint {
8282
dead_assignment,
8383
unused_mut,
8484
unnecessary_allocation,
85-
86-
missing_struct_doc,
87-
missing_trait_doc,
8885
}
8986

9087
pub fn level_to_str(lv: level) -> &'static str {
@@ -255,20 +252,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
255252
desc: "detects unnecessary allocations that can be eliminated",
256253
default: warn
257254
}),
258-
259-
("missing_struct_doc",
260-
LintSpec {
261-
lint: missing_struct_doc,
262-
desc: "detects missing documentation for structs",
263-
default: allow
264-
}),
265-
266-
("missing_trait_doc",
267-
LintSpec {
268-
lint: missing_trait_doc,
269-
desc: "detects missing documentation for traits",
270-
default: allow
271-
}),
272255
];
273256

274257
/*
@@ -969,58 +952,6 @@ fn lint_unnecessary_allocations(cx: @mut Context) -> visit::vt<()> {
969952
})
970953
}
971954

972-
fn lint_missing_struct_doc(cx: @mut Context) -> visit::vt<()> {
973-
visit::mk_simple_visitor(@visit::SimpleVisitor {
974-
visit_struct_field: |field| {
975-
let mut has_doc = false;
976-
for field.node.attrs.each |attr| {
977-
if attr.node.is_sugared_doc {
978-
has_doc = true;
979-
break;
980-
}
981-
}
982-
if !has_doc {
983-
cx.span_lint(missing_struct_doc, field.span, "missing documentation \
984-
for a field.");
985-
}
986-
},
987-
.. *visit::default_simple_visitor()
988-
})
989-
}
990-
991-
fn lint_missing_trait_doc(cx: @mut Context) -> visit::vt<()> {
992-
visit::mk_simple_visitor(@visit::SimpleVisitor {
993-
visit_trait_method: |method| {
994-
let mut has_doc = false;
995-
let span = match copy *method {
996-
ast::required(m) => {
997-
for m.attrs.each |attr| {
998-
if attr.node.is_sugared_doc {
999-
has_doc = true;
1000-
break;
1001-
}
1002-
}
1003-
m.span
1004-
},
1005-
ast::provided(m) => {
1006-
for m.attrs.each |attr| {
1007-
if attr.node.is_sugared_doc {
1008-
has_doc = true;
1009-
break;
1010-
}
1011-
}
1012-
m.span
1013-
}
1014-
};
1015-
if !has_doc {
1016-
cx.span_lint(missing_trait_doc, span, "missing documentation \
1017-
for a method.");
1018-
}
1019-
},
1020-
.. *visit::default_simple_visitor()
1021-
})
1022-
}
1023-
1024955
pub fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
1025956
let cx = @mut Context {
1026957
dict: @get_lint_dict(),
@@ -1049,8 +980,6 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
1049980
cx.add_lint(lint_unused_mut(cx));
1050981
cx.add_lint(lint_session(cx));
1051982
cx.add_lint(lint_unnecessary_allocations(cx));
1052-
cx.add_lint(lint_missing_struct_doc(cx));
1053-
cx.add_lint(lint_missing_trait_doc(cx));
1054983

1055984
// type inference doesn't like this being declared below, we need to tell it
1056985
// what the type of this first function is...

trunk/src/libstd/cell.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,11 @@ Similar to a mutable option type, but friendlier.
2121
*/
2222

2323
#[mutable]
24-
#[deriving(Clone)]
24+
#[deriving(Clone, DeepClone, Eq)]
2525
pub struct Cell<T> {
2626
priv value: Option<T>
2727
}
2828

29-
impl<T: DeepClone> DeepClone for Cell<T> {
30-
fn deep_clone(&self) -> Cell<T> {
31-
Cell{value: self.value.deep_clone()}
32-
}
33-
}
34-
35-
impl<T:cmp::Eq> cmp::Eq for Cell<T> {
36-
fn eq(&self, other: &Cell<T>) -> bool {
37-
(self.value) == (other.value)
38-
}
39-
fn ne(&self, other: &Cell<T>) -> bool { !self.eq(other) }
40-
}
41-
4229
/// Creates a new full cell with the given value.
4330
pub fn Cell<T>(value: T) -> Cell<T> {
4431
Cell { value: Some(value) }

trunk/src/libstd/option.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,12 @@ use clone::DeepClone;
5454
#[cfg(test)] use str;
5555

5656
/// The option type
57-
#[deriving(Clone, Eq)]
57+
#[deriving(Clone, DeepClone, Eq)]
5858
pub enum Option<T> {
5959
None,
6060
Some(T),
6161
}
6262

63-
impl<T: DeepClone> DeepClone for Option<T> {
64-
fn deep_clone(&self) -> Option<T> {
65-
match *self {
66-
Some(ref x) => Some(x.deep_clone()),
67-
None => None
68-
}
69-
}
70-
}
71-
7263
impl<T:Ord> Ord for Option<T> {
7364
fn lt(&self, other: &Option<T>) -> bool {
7465
match (self, other) {

0 commit comments

Comments
 (0)