Skip to content

Commit 0e95b08

Browse files
committed
auto merge of #12738 : alexcrichton/rust/needstest, r=brson,just
Closes #6738 Closes #7061 Closes #7899 Closes #9719 Closes #10028 Closes #10228 Closes #10401 Closes #11192 Closes #11508 Closes #11529 Closes #11873 Closes #11925
2 parents bd47f67 + 13e10f5 commit 0e95b08

16 files changed

+340
-0
lines changed

src/test/auxiliary/issue-10028.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[unsafe_no_drop_flag]
12+
pub struct ZeroLengthThingWithDestructor;
13+
impl Drop for ZeroLengthThingWithDestructor {
14+
fn drop(&mut self) {}
15+
}
16+
impl ZeroLengthThingWithDestructor {
17+
pub fn new() -> ZeroLengthThingWithDestructor {
18+
ZeroLengthThingWithDestructor
19+
}
20+
}

src/test/auxiliary/issue-11508.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Closed01<F>(F);
12+
13+
pub trait Bar { fn new() -> Self; }
14+
15+
impl<T: Bar> Bar for Closed01<T> {
16+
fn new() -> Closed01<T> { Closed01(Bar::new()) }
17+
}
18+
impl Bar for f32 { fn new() -> f32 { 1.0 } }
19+
20+
pub fn random<T: Bar>() -> T { Bar::new() }

src/test/auxiliary/issue-11529.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct A<'a>(&'a int);

src/test/auxiliary/issue-7899.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct V2<T>(T, T);

src/test/compile-fail/issue-10401.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let mut a = "a";
13+
a += { "b" };
14+
//~^ ERROR: binary assignment operation `+=` cannot be applied
15+
}

src/test/compile-fail/issue-11192.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo {
12+
x: int
13+
}
14+
15+
impl Drop for Foo {
16+
fn drop(&mut self) {
17+
println!("drop {}", self.x);
18+
}
19+
}
20+
21+
fn main() {
22+
let mut ptr = ~Foo { x: 0 };
23+
let test = |foo: &Foo| {
24+
println!("access {}", foo.x);
25+
ptr = ~Foo { x: ptr.x + 1 };
26+
println!("access {}", foo.x);
27+
};
28+
test(ptr);
29+
//~^ ERROR: cannot borrow `*ptr` as immutable
30+
}
31+

src/test/compile-fail/issue-11873.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::vec_ng::Vec;
12+
13+
fn main() {
14+
let mut v = vec!(1);
15+
let f = || v.push(2);
16+
let _w = v; //~ ERROR: cannot move out of `v`
17+
18+
f();
19+
}

src/test/compile-fail/issue-11925.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let r = {
13+
let x = ~42;
14+
let f = proc() &x; //~ ERROR: borrowed value does not live long enough
15+
f()
16+
};
17+
18+
drop(r);
19+
}

src/test/compile-fail/issue-6738.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo<T> {
12+
x: T,
13+
}
14+
impl<T> Foo<T> {
15+
fn add(&mut self, v: Foo<T>){
16+
self.x += v.x;
17+
//~^ ERROR: binary assignment operation `+=` cannot be applied
18+
}
19+
}
20+
fn main() {}

src/test/compile-fail/issue-7061.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[feature(managed_boxes)];
12+
13+
struct BarStruct;
14+
15+
impl<'a> BarStruct {
16+
fn foo(&'a mut self) -> @BarStruct { self }
17+
//~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)