about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-20 00:27:07 +0000
committerbors <bors@rust-lang.org>2014-11-20 00:27:07 +0000
commit399ff259e18c1061aa4ea60856fcecb486d36624 (patch)
treec5a9ea6a35b79ae1f79b3c35fb844b2cba1b36c2 /src/test/compile-fail
parenta24b44483a4983c18645ed85c60b2af3bf358976 (diff)
parentee66c841655c3abb528841704d991c4a5a67ff9d (diff)
downloadrust-399ff259e18c1061aa4ea60856fcecb486d36624.tar.gz
rust-399ff259e18c1061aa4ea60856fcecb486d36624.zip
auto merge of #19118 : jakub-/rust/roll-up, r=jakub-
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/associated-types-in-ambiguous-context.rs4
-rw-r--r--src/test/compile-fail/associated-types-in-wrong-context.rs4
-rw-r--r--src/test/compile-fail/bad-lit-suffixes.rs41
-rw-r--r--src/test/compile-fail/deriving-non-type.rs40
-rw-r--r--src/test/compile-fail/ifmt-bad-arg.rs4
-rw-r--r--src/test/compile-fail/ifmt-unimpl.rs4
-rw-r--r--src/test/compile-fail/issue-1448-2.rs2
-rw-r--r--src/test/compile-fail/issue-14853.rs11
-rw-r--r--src/test/compile-fail/issue-19086.rs23
-rw-r--r--src/test/compile-fail/regions-escape-method.rs26
-rw-r--r--src/test/compile-fail/utf8_idents.rs24
11 files changed, 169 insertions, 14 deletions
diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/compile-fail/associated-types-in-ambiguous-context.rs
index a2c01fe62f6..24de1fa2f78 100644
--- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs
+++ b/src/test/compile-fail/associated-types-in-ambiguous-context.rs
@@ -20,12 +20,12 @@ fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {}
 
 trait Other {
     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
-    //~^ ERROR this associated type is not allowed in this context
+    //~^ ERROR no suitable bound on `Self`
 }
 
 impl<T:Get> Other for T {
     fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
-    //~^ ERROR this associated type is not allowed in this context
+    //~^ ERROR currently unsupported
 }
 
 trait Grab {
diff --git a/src/test/compile-fail/associated-types-in-wrong-context.rs b/src/test/compile-fail/associated-types-in-wrong-context.rs
index 8fbfc33896b..8cab2759ad5 100644
--- a/src/test/compile-fail/associated-types-in-wrong-context.rs
+++ b/src/test/compile-fail/associated-types-in-wrong-context.rs
@@ -16,7 +16,7 @@ trait Get {
 }
 
 fn get(x: int) -> <int as Get>::Value {}
-//~^ ERROR this associated type is not allowed in this context
+//~^ ERROR unsupported
 
 struct Struct {
     x: int,
@@ -24,7 +24,7 @@ struct Struct {
 
 impl Struct {
     fn uhoh<T>(foo: <T as Get>::Value) {}
-    //~^ ERROR this associated type is not allowed in this context
+    //~^ ERROR no suitable bound on `T`
 }
 
 fn main() {
diff --git a/src/test/compile-fail/bad-lit-suffixes.rs b/src/test/compile-fail/bad-lit-suffixes.rs
new file mode 100644
index 00000000000..d10337e768c
--- /dev/null
+++ b/src/test/compile-fail/bad-lit-suffixes.rs
@@ -0,0 +1,41 @@
+// 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.
+
+
+extern crate
+    "foo"suffix //~ ERROR extern crate name with a suffix is illegal
+     as foo;
+
+extern
+    "C"suffix //~ ERROR ABI spec with a suffix is illegal
+    fn foo() {}
+
+extern
+    "C"suffix //~ ERROR ABI spec with a suffix is illegal
+{}
+
+fn main() {
+    ""suffix; //~ ERROR str literal with a suffix is illegal
+    b""suffix; //~ ERROR binary str literal with a suffix is illegal
+    r#""#suffix; //~ ERROR str literal with a suffix is illegal
+    br#""#suffix; //~ ERROR binary str literal with a suffix is illegal
+    'a'suffix; //~ ERROR char literal with a suffix is illegal
+    b'a'suffix; //~ ERROR byte literal with a suffix is illegal
+
+    1234u1024; //~ ERROR illegal width `1024` for integer literal
+    1234i1024; //~ ERROR illegal width `1024` for integer literal
+    1234f1024; //~ ERROR illegal width `1024` for float literal
+    1234.5f1024; //~ ERROR illegal width `1024` for float literal
+
+    1234suffix; //~ ERROR illegal suffix `suffix` for numeric literal
+    0b101suffix; //~ ERROR illegal suffix `suffix` for numeric literal
+    1.0suffix; //~ ERROR illegal suffix `suffix` for float literal
+    1.0e10suffix; //~ ERROR illegal suffix `suffix` for float literal
+}
diff --git a/src/test/compile-fail/deriving-non-type.rs b/src/test/compile-fail/deriving-non-type.rs
new file mode 100644
index 00000000000..8226bba42b0
--- /dev/null
+++ b/src/test/compile-fail/deriving-non-type.rs
@@ -0,0 +1,40 @@
+// 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.
+
+#![allow(dead_code)]
+
+struct S;
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+trait T { }
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+impl S { }
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+impl T for S { }
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+static s: uint = 0u;
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+const c: uint = 0u;
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+mod m { }
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+extern "C" { }
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+type A = uint;
+
+#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
+fn main() { }
diff --git a/src/test/compile-fail/ifmt-bad-arg.rs b/src/test/compile-fail/ifmt-bad-arg.rs
index 6829b1e2721..db7f49272aa 100644
--- a/src/test/compile-fail/ifmt-bad-arg.rs
+++ b/src/test/compile-fail/ifmt-bad-arg.rs
@@ -23,8 +23,8 @@ fn main() {
     format!("{foo}", 1, foo=2);        //~ ERROR: argument never used
     format!("", foo=2);                //~ ERROR: named argument never used
 
-    format!("{0:d} {0:s}", 1);         //~ ERROR: redeclared with type `s`
-    format!("{foo:d} {foo:s}", foo=1); //~ ERROR: redeclared with type `s`
+    format!("{0:x} {0:X}", 1);         //~ ERROR: redeclared with type `X`
+    format!("{foo:x} {foo:X}", foo=1); //~ ERROR: redeclared with type `X`
 
     format!("{foo}", foo=1, foo=2);    //~ ERROR: duplicate argument
     format!("", foo=1, 2);             //~ ERROR: positional arguments cannot follow
diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/compile-fail/ifmt-unimpl.rs
index 194047ce848..948040496bd 100644
--- a/src/test/compile-fail/ifmt-unimpl.rs
+++ b/src/test/compile-fail/ifmt-unimpl.rs
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    format!("{:d}", "3");
-    //~^ ERROR: the trait `core::fmt::Signed` is not implemented
+    format!("{:X}", "3");
+    //~^ ERROR: the trait `core::fmt::UpperHex` is not implemented
 }
diff --git a/src/test/compile-fail/issue-1448-2.rs b/src/test/compile-fail/issue-1448-2.rs
index 3daced7a5ac..234fa85c89a 100644
--- a/src/test/compile-fail/issue-1448-2.rs
+++ b/src/test/compile-fail/issue-1448-2.rs
@@ -13,5 +13,5 @@
 fn foo(a: uint) -> uint { a }
 
 fn main() {
-    println!("{:u}", foo(10i)); //~ ERROR mismatched types
+    println!("{}", foo(10i)); //~ ERROR mismatched types
 }
diff --git a/src/test/compile-fail/issue-14853.rs b/src/test/compile-fail/issue-14853.rs
index 4243b98e0dd..6515b34d964 100644
--- a/src/test/compile-fail/issue-14853.rs
+++ b/src/test/compile-fail/issue-14853.rs
@@ -10,17 +10,18 @@
 
 use std::fmt::Show;
 
+trait Str {}
+
 trait Something {
-    fn yay<T: Show>(_: Option<Self>, thing: &[T]) -> String {
-    }
+    fn yay<T: Show>(_: Option<Self>, thing: &[T]);
 }
 
 struct X { data: u32 }
 
 impl Something for X {
-    fn yay<T: Str>(_:Option<X>, thing: &[T]) -> String {
-//~^ ERROR in method `yay`, type parameter 0 requires bound `core::str::Str`, which is not required
-        format!("{:s}", thing[0])
+    fn yay<T: Str>(_:Option<X>, thing: &[T]) {
+//~^ ERROR in method `yay`, type parameter 0 requires bound `Str`, which is not required
+
     }
 }
 
diff --git a/src/test/compile-fail/issue-19086.rs b/src/test/compile-fail/issue-19086.rs
new file mode 100644
index 00000000000..69201859457
--- /dev/null
+++ b/src/test/compile-fail/issue-19086.rs
@@ -0,0 +1,23 @@
+// 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.
+
+use Foo::FooB;
+
+enum Foo {
+    FooB { x: i32, y: i32 }
+}
+
+fn main() {
+    let f = FooB { x: 3, y: 4 };
+    match f {
+        FooB(a, b) => println!("{} {}", a, b),
+//~^ ERROR `FooB` does not name a non-struct variant or a tuple struct
+    }
+}
diff --git a/src/test/compile-fail/regions-escape-method.rs b/src/test/compile-fail/regions-escape-method.rs
new file mode 100644
index 00000000000..f92c264784a
--- /dev/null
+++ b/src/test/compile-fail/regions-escape-method.rs
@@ -0,0 +1,26 @@
+// Copyright 2012 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 a method call where the parameter `B` would (illegally) be
+// inferred to a region bound in the method argument. If this program
+// were accepted, then the closure passed to `s.f` could escape its
+// argument.
+
+struct S;
+
+impl S {
+    fn f<B>(&self, _: |&i32| -> B) {
+    }
+}
+
+fn main() {
+    let s = S;
+    s.f(|p| p) //~ ERROR cannot infer
+}
diff --git a/src/test/compile-fail/utf8_idents.rs b/src/test/compile-fail/utf8_idents.rs
new file mode 100644
index 00000000000..0c3c11ccd07
--- /dev/null
+++ b/src/test/compile-fail/utf8_idents.rs
@@ -0,0 +1,24 @@
+// 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-lexer-test FIXME #15679
+
+fn foo<
+    'β, //~ ERROR non-ascii idents are not fully supported.
+    γ  //~ ERROR non-ascii idents are not fully supported.
+>() {}
+
+struct X {
+    δ: uint //~ ERROR non-ascii idents are not fully supported.
+}
+
+pub fn main() {
+    let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported.
+}