about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-06 23:30:17 +0000
committerbors <bors@rust-lang.org>2015-02-06 23:30:17 +0000
commitd3732a12e896ab98aa27eaffab99a78bbaf837e4 (patch)
treec0d1d61f5e603754ec67ddb0893ff188167a3104 /src/test
parentb75b21cb9b187a6f836da61769a8110354fd6dad (diff)
parentdf7db970dcdb7b7fb1080b9d66baf2e45b689914 (diff)
downloadrust-d3732a12e896ab98aa27eaffab99a78bbaf837e4.tar.gz
rust-d3732a12e896ab98aa27eaffab99a78bbaf837e4.zip
Auto merge of #21997 - Manishearth:rollup, r=alexcrichton
None
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench/shootout-reverse-complement.rs4
-rw-r--r--src/test/compile-fail/assoc-inherent.rs2
-rw-r--r--src/test/compile-fail/gated-bad-feature.rs1
-rw-r--r--src/test/compile-fail/issue-21974.rs28
-rw-r--r--src/test/compile-fail/issue-7364.rs2
-rw-r--r--src/test/compile-fail/issue-9243.rs2
-rw-r--r--src/test/compile-fail/lint-dead-code-1.rs1
-rw-r--r--src/test/compile-fail/lint-missing-doc.rs1
-rw-r--r--src/test/compile-fail/missing_debug_impls.rs2
-rw-r--r--src/test/compile-fail/stable-features.rs20
-rw-r--r--src/test/run-make/alloc-extern-crates/Makefile5
-rw-r--r--src/test/run-make/alloc-extern-crates/fakealloc.rs36
-rw-r--r--src/test/run-make/save-analysis/foo.rs3
-rw-r--r--src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs23
-rw-r--r--src/test/run-pass/associated-types-duplicate-binding-in-env.rs27
-rw-r--r--src/test/run-pass/issue-21891.rs16
-rw-r--r--src/test/run-pass/issue-7660.rs2
-rw-r--r--src/test/run-pass/regions-mock-tcx.rs19
18 files changed, 174 insertions, 20 deletions
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index 82887386814..94438319954 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -90,12 +90,12 @@ impl Tables {
         }
     }
 
-    /// Retreives the complement for `i`.
+    /// Retrieves the complement for `i`.
     fn cpl8(&self, i: u8) -> u8 {
         self.table8[i as uint]
     }
 
-    /// Retreives the complement for `i`.
+    /// Retrieves the complement for `i`.
     fn cpl16(&self, i: u16) -> u16 {
         self.table16[i as uint]
     }
diff --git a/src/test/compile-fail/assoc-inherent.rs b/src/test/compile-fail/assoc-inherent.rs
index ba8e4a652d3..e68c3e30b9a 100644
--- a/src/test/compile-fail/assoc-inherent.rs
+++ b/src/test/compile-fail/assoc-inherent.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Test associated types are forbidden in inherant impls.
+// Test associated types are forbidden in inherent impls.
 
 struct Foo;
 
diff --git a/src/test/compile-fail/gated-bad-feature.rs b/src/test/compile-fail/gated-bad-feature.rs
index 39cd3e3b86a..5baafd41531 100644
--- a/src/test/compile-fail/gated-bad-feature.rs
+++ b/src/test/compile-fail/gated-bad-feature.rs
@@ -20,4 +20,3 @@
 #![feature = "foo"] //~ ERROR: malformed feature
 
 #![feature(test_removed_feature)] //~ ERROR: feature has been removed
-#![feature(test_accepted_feature)] //~ WARNING: feature has been added
diff --git a/src/test/compile-fail/issue-21974.rs b/src/test/compile-fail/issue-21974.rs
new file mode 100644
index 00000000000..f768d6c00ec
--- /dev/null
+++ b/src/test/compile-fail/issue-21974.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.
+
+// Test that (for now) we report an ambiguity error here, because
+// specific trait relationships are ignored for the purposes of trait
+// matching. This behavior should likely be improved such that this
+// test passes. See #21974 for more details.
+
+trait Foo {
+    fn foo(self);
+}
+
+fn foo<'a,'b,T>(x: &'a T, y: &'b T)
+    where &'a T : Foo,
+          &'b T : Foo
+{
+    x.foo(); //~ ERROR type annotations required
+    y.foo();
+}
+
+fn main() { }
diff --git a/src/test/compile-fail/issue-7364.rs b/src/test/compile-fail/issue-7364.rs
index 2e644b65402..465a38111ba 100644
--- a/src/test/compile-fail/issue-7364.rs
+++ b/src/test/compile-fail/issue-7364.rs
@@ -12,7 +12,7 @@
 
 use std::cell::RefCell;
 
-// Regresion test for issue 7364
+// Regression test for issue 7364
 static boxed: Box<RefCell<isize>> = box RefCell::new(0);
 //~^ ERROR statics are not allowed to have custom pointers
 //~| ERROR: the trait `core::marker::Sync` is not implemented for the type
diff --git a/src/test/compile-fail/issue-9243.rs b/src/test/compile-fail/issue-9243.rs
index 808aa098c5a..7424a45d044 100644
--- a/src/test/compile-fail/issue-9243.rs
+++ b/src/test/compile-fail/issue-9243.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Regresion test for issue 9243
+// Regression test for issue 9243
 
 struct Test {
     mem: isize,
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs
index 519839ae2f4..b1bb28f7ce7 100644
--- a/src/test/compile-fail/lint-dead-code-1.rs
+++ b/src/test/compile-fail/lint-dead-code-1.rs
@@ -12,7 +12,6 @@
 #![allow(unused_variables)]
 #![allow(non_camel_case_types)]
 #![allow(non_upper_case_globals)]
-#![allow(missing_copy_implementations)]
 #![deny(dead_code)]
 #![feature(core)]
 
diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs
index 55103f10f2c..3b96fd64fa2 100644
--- a/src/test/compile-fail/lint-missing-doc.rs
+++ b/src/test/compile-fail/lint-missing-doc.rs
@@ -12,7 +12,6 @@
 // injected intrinsics by the compiler.
 #![deny(missing_docs)]
 #![allow(dead_code)]
-#![allow(missing_copy_implementations)]
 
 //! Some garbage docs for the crate here
 #![doc="More garbage"]
diff --git a/src/test/compile-fail/missing_debug_impls.rs b/src/test/compile-fail/missing_debug_impls.rs
index bc4bfef4d48..ddc9081e33b 100644
--- a/src/test/compile-fail/missing_debug_impls.rs
+++ b/src/test/compile-fail/missing_debug_impls.rs
@@ -10,7 +10,7 @@
 
 // compile-flags: --crate-type lib
 #![deny(missing_debug_implementations)]
-#![allow(unused, missing_copy_implementations)]
+#![allow(unused)]
 
 use std::fmt;
 
diff --git a/src/test/compile-fail/stable-features.rs b/src/test/compile-fail/stable-features.rs
new file mode 100644
index 00000000000..30eb4112c3f
--- /dev/null
+++ b/src/test/compile-fail/stable-features.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.
+
+// Testing that the stable_features lint catches use of stable
+// language and lib features.
+
+#![deny(stable_features)]
+#![feature(test_accepted_feature)] //~ ERROR this feature is stable
+#![feature(rust1)] //~ ERROR this feature is stable
+
+fn main() {
+    let _foo: Vec<()> = Vec::new();
+}
diff --git a/src/test/run-make/alloc-extern-crates/Makefile b/src/test/run-make/alloc-extern-crates/Makefile
new file mode 100644
index 00000000000..b8c52378554
--- /dev/null
+++ b/src/test/run-make/alloc-extern-crates/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) fakealloc.rs
+	$(RUSTC) ../../../liballoc/lib.rs --cfg feature=\"external_crate\" --extern external=$(TMPDIR)/$(shell $(RUSTC) --print file-names fakealloc.rs)
diff --git a/src/test/run-make/alloc-extern-crates/fakealloc.rs b/src/test/run-make/alloc-extern-crates/fakealloc.rs
new file mode 100644
index 00000000000..563a527b941
--- /dev/null
+++ b/src/test/run-make/alloc-extern-crates/fakealloc.rs
@@ -0,0 +1,36 @@
+// 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.
+
+#![crate_type = "rlib"]
+#![no_std]
+#![feature(core)]
+extern crate core;
+
+
+#[inline]
+pub unsafe fn allocate(_size: usize, _align: usize) -> *mut u8 { 0 as *mut u8 }
+
+#[inline]
+pub unsafe fn deallocate(_ptr: *mut u8, _old_size: usize, _align: usize) { }
+
+#[inline]
+pub unsafe fn reallocate(_ptr: *mut u8, _old_size: usize, _size: usize, _align: usize) -> *mut u8 {
+    0 as *mut u8
+}
+
+#[inline]
+pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize,
+                                    _align: usize) -> usize { old_size }
+
+#[inline]
+pub fn usable_size(size: usize, _align: usize) -> usize { size }
+
+#[inline]
+pub fn stats_print() { }
diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs
index 3ede775b119..d90219b4221 100644
--- a/src/test/run-make/save-analysis/foo.rs
+++ b/src/test/run-make/save-analysis/foo.rs
@@ -17,7 +17,6 @@ extern crate graphviz;
 
 extern crate "flate" as myflate;
 
-use graphviz::maybe_owned_vec::MaybeOwnedVector;
 use std::collections::{HashMap,HashSet};
 use std::cell::RefCell;
 use std::old_io::stdio::println;
@@ -35,7 +34,7 @@ use std::mem::size_of;
 static uni: &'static str = "Les Miséééééééérables";
 static yy: usize = 25us;
 
-static bob: Option<graphviz::maybe_owned_vec::MaybeOwnedVector<'static, isize>> = None;
+static bob: Option<std::vec::CowVec<'static, isize>> = None;
 
 // buglink test - see issue #1337.
 
diff --git a/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs
new file mode 100644
index 00000000000..8b7ea61dc77
--- /dev/null
+++ b/src/test/run-pass/associated-types-duplicate-binding-in-env-hrtb.rs
@@ -0,0 +1,23 @@
+// Copyright 2015 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.
+
+// Check that we do not report ambiguities when equivalent predicates
+// (modulo bound lifetime names) appears in the environment
+// twice. Issue #21965.
+
+fn foo<T>(t: T) -> i32
+    where T : for<'a> Fn(&'a u8) -> i32,
+          T : for<'b> Fn(&'b u8) -> i32,
+{
+    t(&3)
+}
+
+fn main() {
+}
diff --git a/src/test/run-pass/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types-duplicate-binding-in-env.rs
new file mode 100644
index 00000000000..62ac2187952
--- /dev/null
+++ b/src/test/run-pass/associated-types-duplicate-binding-in-env.rs
@@ -0,0 +1,27 @@
+// Copyright 2015 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.
+
+// Check that we do not report ambiguities when the same predicate
+// appears in the environment twice. Issue #21965.
+
+trait Foo {
+    type B;
+
+    fn get() -> Self::B;
+}
+
+fn foo<T>() -> ()
+    where T : Foo<B=()>, T : Foo<B=()>
+{
+    <T as Foo>::get()
+}
+
+fn main() {
+}
diff --git a/src/test/run-pass/issue-21891.rs b/src/test/run-pass/issue-21891.rs
new file mode 100644
index 00000000000..d6e6f23191e
--- /dev/null
+++ b/src/test/run-pass/issue-21891.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 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.
+
+static foo: [uint; 3] = [1, 2, 3];
+
+static slice_1: &'static [uint] = &foo;
+static slice_2: &'static [uint] = &foo;
+
+fn main() {}
diff --git a/src/test/run-pass/issue-7660.rs b/src/test/run-pass/issue-7660.rs
index 8a953cea904..9e36b1f5082 100644
--- a/src/test/run-pass/issue-7660.rs
+++ b/src/test/run-pass/issue-7660.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Regresion test for issue 7660
+// Regression test for issue 7660
 // rvalue lifetime too short when equivalent `match` works
 
 extern crate collections;
diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs
index be7db25201a..bf789d53645 100644
--- a/src/test/run-pass/regions-mock-tcx.rs
+++ b/src/test/run-pass/regions-mock-tcx.rs
@@ -21,7 +21,7 @@ extern crate libc;
 
 use TypeStructure::{TypeInt, TypeFunction};
 use AstKind::{ExprInt, ExprVar, ExprLambda};
-use arena::Arena;
+use arena::TypedArena;
 use std::collections::HashMap;
 use std::mem;
 
@@ -45,17 +45,20 @@ impl<'tcx> PartialEq for TypeStructure<'tcx> {
 
 impl<'tcx> Eq for TypeStructure<'tcx> {}
 
+type TyArena<'tcx> = TypedArena<TypeStructure<'tcx>>;
+type AstArena<'ast> = TypedArena<AstStructure<'ast>>;
+
 struct TypeContext<'tcx, 'ast> {
-    ty_arena: &'tcx Arena,
+    ty_arena: &'tcx TyArena<'tcx>,
     types: Vec<Type<'tcx>> ,
     type_table: HashMap<NodeId, Type<'tcx>>,
 
-    ast_arena: &'ast Arena,
+    ast_arena: &'ast AstArena<'ast>,
     ast_counter: uint,
 }
 
 impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
-    fn new(ty_arena: &'tcx Arena, ast_arena: &'ast Arena)
+    fn new(ty_arena: &'tcx TyArena<'tcx>, ast_arena: &'ast AstArena<'ast>)
            -> TypeContext<'tcx, 'ast> {
         TypeContext { ty_arena: ty_arena,
                       types: Vec::new(),
@@ -72,7 +75,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
             }
         }
 
-        let ty = self.ty_arena.alloc(|| s);
+        let ty = self.ty_arena.alloc(s);
         self.types.push(ty);
         ty
     }
@@ -85,7 +88,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
     fn ast(&mut self, a: AstKind<'ast>) -> Ast<'ast> {
         let id = self.ast_counter;
         self.ast_counter += 1;
-        self.ast_arena.alloc(|| AstStructure { id: NodeId {id:id}, kind: a })
+        self.ast_arena.alloc(AstStructure { id: NodeId {id:id}, kind: a })
     }
 }
 
@@ -127,8 +130,8 @@ fn compute_types<'tcx,'ast>(tcx: &mut TypeContext<'tcx,'ast>,
 }
 
 pub fn main() {
-    let ty_arena = arena::Arena::new();
-    let ast_arena = arena::Arena::new();
+    let ty_arena = TypedArena::new();
+    let ast_arena = TypedArena::new();
     let mut tcx = TypeContext::new(&ty_arena, &ast_arena);
     let ast = tcx.ast(ExprInt);
     let ty = compute_types(&mut tcx, ast);