Skip to content

Commit a69f0ae

Browse files
committed
---
yaml --- r: 69205 b: refs/heads/auto c: 3d6c0bc h: refs/heads/master i: 69203: 41a9de5 v: v3
1 parent 865ebb3 commit a69f0ae

File tree

15 files changed

+65
-53
lines changed

15 files changed

+65
-53
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 49014c82688a21e1157877280d449e055ce39b6b
17+
refs/heads/auto: 3d6c0bc05640b9cc62db9fe287903cb709056dcb
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/doc/tutorial.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ types.
499499
> items.
500500
501501
~~~~
502-
use std::float;
503-
use std::num::atan;
502+
# use std::float;
503+
# use std::num::atan;
504504
fn angle(vector: (float, float)) -> float {
505505
let pi = float::consts::pi;
506506
match vector {
@@ -555,7 +555,7 @@ while cake_amount > 0 {
555555
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
556556

557557
~~~~
558-
use std::int;
558+
# use std::int;
559559
let mut x = 5;
560560
loop {
561561
x += x - 3;
@@ -701,7 +701,7 @@ get at their contents. All variant constructors can be used as
701701
patterns, as in this definition of `area`:
702702

703703
~~~~
704-
use std::float;
704+
# use std::float;
705705
# struct Point {x: float, y: float}
706706
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
707707
fn area(sh: Shape) -> float {
@@ -733,7 +733,7 @@ fn point_from_direction(dir: Direction) -> Point {
733733
Enum variants may also be structs. For example:
734734

735735
~~~~
736-
use std::float;
736+
# use std::float;
737737
# struct Point { x: float, y: float }
738738
# fn square(x: float) -> float { x * x }
739739
enum Shape {
@@ -1599,8 +1599,7 @@ lists back to back. Since that is so unsightly, empty argument lists
15991599
may be omitted from `do` expressions.
16001600

16011601
~~~~
1602-
use std::task::spawn;
1603-
1602+
# use std::task::spawn;
16041603
do spawn {
16051604
debug!("Kablam!");
16061605
}
@@ -1729,7 +1728,7 @@ impl Circle {
17291728
To call such a method, just prefix it with the type name and a double colon:
17301729

17311730
~~~~
1732-
use std::float::consts::pi;
1731+
# use std::float::consts::pi;
17331732
struct Circle { radius: float }
17341733
impl Circle {
17351734
fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }
@@ -1775,7 +1774,7 @@ illegal to copy and pass by value.
17751774
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
17761775

17771776
~~~~
1778-
use std::hashmap::HashMap;
1777+
# use std::hashmap::HashMap;
17791778
type Set<T> = HashMap<T, ()>;
17801779
17811780
struct Stack<T> {
@@ -2001,7 +2000,7 @@ name and a double colon. The compiler uses type inference to decide which
20012000
implementation to use.
20022001

20032002
~~~~
2004-
use std::float::consts::pi;
2003+
# use std::float::consts::pi;
20052004
trait Shape { fn new(area: float) -> Self; }
20062005
struct Circle { radius: float }
20072006
struct Square { length: float }
@@ -2157,7 +2156,7 @@ trait Circle : Shape { fn radius(&self) -> float; }
21572156
Now, we can implement `Circle` on a type only if we also implement `Shape`.
21582157

21592158
~~~~
2160-
use std::float::consts::pi;
2159+
# use std::float::consts::pi;
21612160
# trait Shape { fn area(&self) -> float; }
21622161
# trait Circle : Shape { fn radius(&self) -> float; }
21632162
# struct Point { x: float, y: float }
@@ -2192,7 +2191,7 @@ fn radius_times_area<T: Circle>(c: T) -> float {
21922191
Likewise, supertrait methods may also be called on trait objects.
21932192

21942193
~~~ {.xfail-test}
2195-
use std::float::consts::pi;
2194+
# use std::float::consts::pi;
21962195
# trait Shape { fn area(&self) -> float; }
21972196
# trait Circle : Shape { fn radius(&self) -> float; }
21982197
# struct Point { x: float, y: float }

branches/auto/src/etc/extract-tests.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
if not re.search(r"\bextern mod extra\b", block):
6161
block = "extern mod extra;\n" + block
6262
block = """#[ forbid(ctypes) ];
63-
#[ forbid(deprecated_pattern) ];
64-
#[ forbid(implicit_copies) ];
65-
#[ forbid(non_implicitly_copyable_typarams) ];
6663
#[ forbid(path_statement) ];
6764
#[ forbid(type_limits) ];
6865
#[ forbid(unrecognized_lint) ];

branches/auto/src/etc/zsh/_rust

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ _rustc_opts_switches=(
3333
)
3434
_rustc_opts_lint=(
3535
'path-statement[path statements with no effect]'
36-
'deprecated-pattern[warn about deprecated uses of pattern bindings]'
37-
'non-implicitly-copyable-typarams[passing non implicitly copyable types as copy type params]'
3836
'missing-trait-doc[detects missing documentation for traits]'
3937
'missing-struct-doc[detects missing documentation for structs]'
4038
'ctypes[proper use of core::libc types in foreign modules]'
41-
'implicit-copies[implicit copies of non implicitly copyable data]'
4239
"unused-mut[detect mut variables which don't need to be mutable]"
4340
'unused-imports[imports that are never used]'
4441
'heap-memory[use of any (~ type or @ type) heap memory]'

branches/auto/src/librustc/middle/lint.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ pub enum lint {
7575
unnecessary_qualification,
7676
while_true,
7777
path_statement,
78-
implicit_copies,
7978
unrecognized_lint,
80-
deprecated_pattern,
8179
non_camel_case_types,
8280
non_uppercase_statics,
8381
type_limits,
@@ -182,20 +180,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
182180
default: warn
183181
}),
184182

185-
("implicit_copies",
186-
LintSpec {
187-
lint: implicit_copies,
188-
desc: "implicit copies of non implicitly copyable data",
189-
default: warn
190-
}),
191-
192-
("deprecated_pattern",
193-
LintSpec {
194-
lint: deprecated_pattern,
195-
desc: "warn about deprecated uses of pattern bindings",
196-
default: allow
197-
}),
198-
199183
("non_camel_case_types",
200184
LintSpec {
201185
lint: non_camel_case_types,

branches/auto/src/librustc/rustc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#[license = "MIT/ASL2"];
1818
#[crate_type = "lib"];
1919

20-
#[deny(deprecated_pattern)];
21-
2220
extern mod extra;
2321
extern mod syntax;
2422

branches/auto/src/libstd/result.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ pub fn unwrap_err<T, U>(res: Result<T, U>) -> U {
396396
}
397397

398398
#[cfg(test)]
399-
#[allow(non_implicitly_copyable_typarams)]
400399
mod tests {
401400
use result::{Err, Ok, Result, chain, get, get_err};
402401
use result;

branches/auto/src/libstd/str.rs

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use cast;
2222
use char;
2323
use char::Char;
2424
use clone::Clone;
25-
use container::Container;
25+
use container::{Container, Mutable};
2626
use iter::Times;
2727
use iterator::{Iterator, IteratorUtil, FilterIterator, AdditiveIterator, MapIterator};
2828
use libc;
@@ -1214,6 +1214,31 @@ impl<'self> Container for &'self str {
12141214
}
12151215
}
12161216
1217+
impl Container for ~str {
1218+
#[inline]
1219+
fn len(&self) -> uint { self.as_slice().len() }
1220+
#[inline]
1221+
fn is_empty(&self) -> bool { self.len() == 0 }
1222+
}
1223+
1224+
impl Container for @str {
1225+
#[inline]
1226+
fn len(&self) -> uint { self.as_slice().len() }
1227+
#[inline]
1228+
fn is_empty(&self) -> bool { self.len() == 0 }
1229+
}
1230+
1231+
impl Mutable for ~str {
1232+
/// Remove all content, make the string empty
1233+
#[inline]
1234+
fn clear(&mut self) {
1235+
unsafe {
1236+
raw::set_len(self, 0)
1237+
}
1238+
}
1239+
}
1240+
1241+
12171242
#[allow(missing_doc)]
12181243
pub trait StrSlice<'self> {
12191244
fn contains<'a>(&self, needle: &'a str) -> bool;
@@ -2502,6 +2527,18 @@ mod tests {
25022527
assert_eq!(~"华ประเทศไทย中", data);
25032528
}
25042529
2530+
#[test]
2531+
fn test_clear() {
2532+
let mut empty = ~"";
2533+
empty.clear();
2534+
assert_eq!("", empty.as_slice());
2535+
let mut data = ~"ประเทศไทย中";
2536+
data.clear();
2537+
assert_eq!("", data.as_slice());
2538+
data.push_char('华');
2539+
assert_eq!("", data.as_slice());
2540+
}
2541+
25052542
#[test]
25062543
fn test_split_within() {
25072544
fn t(s: &str, i: uint, u: &[~str]) {
@@ -3494,4 +3531,17 @@ mod tests {
34943531
t::<@str>();
34953532
t::<~str>();
34963533
}
3534+
3535+
#[test]
3536+
fn test_str_container() {
3537+
fn sum_len<S: Container>(v: &[S]) -> uint {
3538+
v.iter().transform(|x| x.len()).sum()
3539+
}
3540+
3541+
let s = ~"01234";
3542+
assert_eq!(5, sum_len(["012", "", "34"]));
3543+
assert_eq!(5, sum_len([@"01", @"2", @"34", @""]));
3544+
assert_eq!(5, sum_len([~"01", ~"2", ~"34", ~""]));
3545+
assert_eq!(5, sum_len([s.as_slice()]));
3546+
}
34973547
}

branches/auto/src/libstd/tuple.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ mod tests {
384384
}
385385
386386
#[test]
387-
#[allow(non_implicitly_copyable_typarams)]
388387
fn test_tuple() {
389388
assert_eq!((948, 4039.48).first(), 948);
390389
assert_eq!((34.5, ~"foo").second(), ~"foo");

branches/auto/src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,13 @@ pub fn print_foreign_item(s: @ps, item: &ast::foreign_item) {
457457
match item.node {
458458
ast::foreign_item_fn(ref decl, purity, ref generics) => {
459459
print_fn(s, decl, Some(purity), AbiSet::Rust(), item.ident, generics, None,
460-
ast::inherited);
460+
item.vis);
461461
end(s); // end head-ibox
462462
word(s.s, ";");
463463
end(s); // end the outer fn box
464464
}
465465
ast::foreign_item_static(ref t, m) => {
466-
head(s, "static");
466+
head(s, visibility_qualified(item.vis, "static"));
467467
if m {
468468
word_space(s, "mut");
469469
}

branches/auto/src/libsyntax/syntax.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#[license = "MIT/ASL2"];
2121
#[crate_type = "lib"];
2222

23-
#[deny(deprecated_pattern)];
24-
2523
extern mod extra;
2624

2725
pub mod util {

branches/auto/src/test/run-pass-fulldeps/quote-tokens.rs

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

11-
#[allow(non_implicitly_copyable_typarams)];
12-
1311
extern mod syntax;
1412

1513
use syntax::ext::base::ExtCtxt;

branches/auto/src/test/run-pass/auto-encode.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
// xfail-test #6122
1414

15-
#[forbid(deprecated_pattern)];
16-
1715
extern mod extra;
1816

1917
// These tests used to be separate files, but I wanted to refactor all

branches/auto/src/test/run-pass/fixed_length_copy.rs

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

11-
12-
// error on implicit copies to check fixed length vectors
13-
// are implicitly copyable
14-
#[deny(implicit_copies)]
1511
pub fn main() {
1612
let arr = [1,2,3];
1713
let arr2 = arr;

branches/auto/src/test/run-pass/issue-2550.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn C(x: uint) -> C {
2121
fn f<T>(_x: T) {
2222
}
2323

24-
#[deny(non_implicitly_copyable_typarams)]
2524
pub fn main() {
2625
f(C(1u));
2726
}

0 commit comments

Comments
 (0)