about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/auxiliary/issue-10028.rs20
-rw-r--r--src/test/auxiliary/issue-11508.rs20
-rw-r--r--src/test/auxiliary/issue-11529.rs11
-rw-r--r--src/test/auxiliary/issue-7899.rs11
-rw-r--r--src/test/compile-fail/issue-10401.rs15
-rw-r--r--src/test/compile-fail/issue-11192.rs31
-rw-r--r--src/test/compile-fail/issue-11873.rs19
-rw-r--r--src/test/compile-fail/issue-11925.rs19
-rw-r--r--src/test/compile-fail/issue-6738.rs20
-rw-r--r--src/test/compile-fail/issue-7061.rs20
-rw-r--r--src/test/run-pass/issue-10028.rs28
-rw-r--r--src/test/run-pass/issue-10228.rs25
-rw-r--r--src/test/run-pass/issue-11508.rs21
-rw-r--r--src/test/run-pass/issue-11529.rs19
-rw-r--r--src/test/run-pass/issue-7899.rs18
-rw-r--r--src/test/run-pass/issue-9719.rs43
16 files changed, 340 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue-10028.rs b/src/test/auxiliary/issue-10028.rs
new file mode 100644
index 00000000000..00fdb3e40b9
--- /dev/null
+++ b/src/test/auxiliary/issue-10028.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[unsafe_no_drop_flag]
+pub struct ZeroLengthThingWithDestructor;
+impl Drop for ZeroLengthThingWithDestructor {
+    fn drop(&mut self) {}
+}
+impl ZeroLengthThingWithDestructor {
+    pub fn new() -> ZeroLengthThingWithDestructor {
+        ZeroLengthThingWithDestructor
+    }
+}
diff --git a/src/test/auxiliary/issue-11508.rs b/src/test/auxiliary/issue-11508.rs
new file mode 100644
index 00000000000..dfdde5e5e4e
--- /dev/null
+++ b/src/test/auxiliary/issue-11508.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Closed01<F>(F);
+
+pub trait Bar { fn new() -> Self; }
+
+impl<T: Bar> Bar for Closed01<T> {
+    fn new() -> Closed01<T> { Closed01(Bar::new()) }
+}
+impl Bar for f32 { fn new() -> f32 { 1.0 } }
+
+pub fn random<T: Bar>() -> T { Bar::new() }
diff --git a/src/test/auxiliary/issue-11529.rs b/src/test/auxiliary/issue-11529.rs
new file mode 100644
index 00000000000..9d500532401
--- /dev/null
+++ b/src/test/auxiliary/issue-11529.rs
@@ -0,0 +1,11 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct A<'a>(&'a int);
diff --git a/src/test/auxiliary/issue-7899.rs b/src/test/auxiliary/issue-7899.rs
new file mode 100644
index 00000000000..f1a0fcffd16
--- /dev/null
+++ b/src/test/auxiliary/issue-7899.rs
@@ -0,0 +1,11 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct V2<T>(T, T);
diff --git a/src/test/compile-fail/issue-10401.rs b/src/test/compile-fail/issue-10401.rs
new file mode 100644
index 00000000000..e36193aee25
--- /dev/null
+++ b/src/test/compile-fail/issue-10401.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let mut a = "a";
+    a += { "b" };
+    //~^ ERROR: binary assignment operation `+=` cannot be applied
+}
diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs
new file mode 100644
index 00000000000..f1da3032890
--- /dev/null
+++ b/src/test/compile-fail/issue-11192.rs
@@ -0,0 +1,31 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+    x: int
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("drop {}", self.x);
+    }
+}
+
+fn main() {
+    let mut ptr = ~Foo { x: 0 };
+    let test = |foo: &Foo| {
+        println!("access {}", foo.x);
+        ptr = ~Foo { x: ptr.x + 1 };
+        println!("access {}", foo.x);
+    };
+    test(ptr);
+    //~^ ERROR: cannot borrow `*ptr` as immutable
+}
+
diff --git a/src/test/compile-fail/issue-11873.rs b/src/test/compile-fail/issue-11873.rs
new file mode 100644
index 00000000000..49b226b882e
--- /dev/null
+++ b/src/test/compile-fail/issue-11873.rs
@@ -0,0 +1,19 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::vec_ng::Vec;
+
+fn main() {
+    let mut v = vec!(1);
+    let f = || v.push(2);
+    let _w = v; //~ ERROR: cannot move out of `v`
+
+    f();
+}
diff --git a/src/test/compile-fail/issue-11925.rs b/src/test/compile-fail/issue-11925.rs
new file mode 100644
index 00000000000..06a976ecf3d
--- /dev/null
+++ b/src/test/compile-fail/issue-11925.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let r = {
+        let x = ~42;
+        let f = proc() &x; //~ ERROR: borrowed value does not live long enough
+        f()
+    };
+
+    drop(r);
+}
diff --git a/src/test/compile-fail/issue-6738.rs b/src/test/compile-fail/issue-6738.rs
new file mode 100644
index 00000000000..447d0e061ee
--- /dev/null
+++ b/src/test/compile-fail/issue-6738.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T> {
+    x: T,
+}
+impl<T> Foo<T> {
+    fn add(&mut self, v: Foo<T>){
+        self.x += v.x;
+        //~^ ERROR: binary assignment operation `+=` cannot be applied
+    }
+}
+fn main() {}
diff --git a/src/test/compile-fail/issue-7061.rs b/src/test/compile-fail/issue-7061.rs
new file mode 100644
index 00000000000..c7fa286d351
--- /dev/null
+++ b/src/test/compile-fail/issue-7061.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[feature(managed_boxes)];
+
+struct BarStruct;
+
+impl<'a> BarStruct {
+    fn foo(&'a mut self) -> @BarStruct { self }
+    //~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct
+}
+
+fn main() {}
diff --git a/src/test/run-pass/issue-10028.rs b/src/test/run-pass/issue-10028.rs
new file mode 100644
index 00000000000..e69aabd46f5
--- /dev/null
+++ b/src/test/run-pass/issue-10028.rs
@@ -0,0 +1,28 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-10028.rs
+// ignore-fast
+
+extern crate issue10028 = "issue-10028";
+
+use issue10028::ZeroLengthThingWithDestructor;
+
+struct Foo {
+    zero_length_thing: ZeroLengthThingWithDestructor
+}
+
+fn make_foo() -> Foo {
+    Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() }
+}
+
+fn main() {
+    let _f:Foo = make_foo();
+}
diff --git a/src/test/run-pass/issue-10228.rs b/src/test/run-pass/issue-10228.rs
new file mode 100644
index 00000000000..70590876856
--- /dev/null
+++ b/src/test/run-pass/issue-10228.rs
@@ -0,0 +1,25 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum StdioContainer {
+    CreatePipe(bool)
+}
+
+struct Test<'a> {
+    args: &'a [~str],
+    io: &'a [StdioContainer]
+}
+
+pub fn main() {
+    let test = Test {
+        args: &[],
+        io: &[CreatePipe(true)]
+    };
+}
diff --git a/src/test/run-pass/issue-11508.rs b/src/test/run-pass/issue-11508.rs
new file mode 100644
index 00000000000..a7ad38cde0f
--- /dev/null
+++ b/src/test/run-pass/issue-11508.rs
@@ -0,0 +1,21 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-11508.rs
+// ignore-fast
+
+extern crate rand = "issue-11508";
+
+use rand::{Closed01, random};
+
+fn main() {
+    let Closed01(val) = random::<Closed01<f32>>();
+    println!("{}", val);
+}
diff --git a/src/test/run-pass/issue-11529.rs b/src/test/run-pass/issue-11529.rs
new file mode 100644
index 00000000000..643e6ca4bda
--- /dev/null
+++ b/src/test/run-pass/issue-11529.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-11529.rs
+// ignore-fast
+
+extern crate a = "issue-11529";
+
+fn main() {
+    let one = 1;
+    let _a = a::A(&one);
+}
diff --git a/src/test/run-pass/issue-7899.rs b/src/test/run-pass/issue-7899.rs
new file mode 100644
index 00000000000..6ee734d0212
--- /dev/null
+++ b/src/test/run-pass/issue-7899.rs
@@ -0,0 +1,18 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-fast
+// aux-build:issue-7899.rs
+
+extern crate testcrate = "issue-7899";
+
+fn main() {
+    let f = testcrate::V2(1.0f32, 2.0f32);
+}
diff --git a/src/test/run-pass/issue-9719.rs b/src/test/run-pass/issue-9719.rs
new file mode 100644
index 00000000000..52204c9e0c2
--- /dev/null
+++ b/src/test/run-pass/issue-9719.rs
@@ -0,0 +1,43 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod a {
+    pub enum Enum<T> {
+        A(T),
+    }
+
+    pub trait X {}
+    impl X for int {}
+
+    pub struct Z<'a>(Enum<&'a X>);
+    fn foo() { let x = 42; let z = Z(A(&x as &X)); let _ = z; }
+}
+
+mod b {
+    trait X {}
+    impl X for int {}
+    struct Y<'a>{
+        x:Option<&'a X>,
+    }
+
+    fn bar() {
+        let x = 42;
+        let _y = Y { x: Some(&x as &X) };
+    }
+}
+
+mod c {
+    pub trait X { fn f(&self); }
+    impl X for int { fn f(&self) {} }
+    pub struct Z<'a>(Option<&'a X>);
+    fn main() { let x = 42; let z = Z(Some(&x as &X)); let _ = z; }
+}
+
+pub fn main() {}