about summary refs log tree commit diff
path: root/src/test/ui/span
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2017-01-14 18:04:27 -0500
committercomex <comexk@gmail.com>2017-01-14 18:44:35 -0500
commit9cfb8b730a473814c2ae090c342abb95e53502db (patch)
treeac757a3acf31331c3ef7c9a0f3f063b1d85c9fd6 /src/test/ui/span
parent743535a643ff9c7f5791a71f6b62c27617cdbb3e (diff)
parent93e70ecb7fbe05caa74dfb2bf3c29315edc2b3e6 (diff)
downloadrust-9cfb8b730a473814c2ae090c342abb95e53502db.tar.gz
rust-9cfb8b730a473814c2ae090c342abb95e53502db.zip
Merge branch 'master' into lint-attr-fix
Diffstat (limited to 'src/test/ui/span')
-rw-r--r--src/test/ui/span/E0204.rs36
-rw-r--r--src/test/ui/span/E0204.stderr38
-rw-r--r--src/test/ui/span/coerce-suggestions.stderr12
-rw-r--r--src/test/ui/span/issue-27522.rs19
-rw-r--r--src/test/ui/span/issue-27522.stderr11
-rw-r--r--src/test/ui/span/typo-suggestion.stderr6
6 files changed, 113 insertions, 9 deletions
diff --git a/src/test/ui/span/E0204.rs b/src/test/ui/span/E0204.rs
new file mode 100644
index 00000000000..9fb37607c7d
--- /dev/null
+++ b/src/test/ui/span/E0204.rs
@@ -0,0 +1,36 @@
+// Copyright 2016 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 {
+    foo: Vec<u32>,
+}
+
+impl Copy for Foo { }
+
+#[derive(Copy)]
+struct Foo2<'a> {
+    ty: &'a mut bool,
+}
+
+enum EFoo {
+    Bar { x: Vec<u32> },
+    Baz,
+}
+
+impl Copy for EFoo { }
+
+#[derive(Copy)]
+enum EFoo2<'a> {
+    Bar(&'a mut bool),
+    Baz,
+}
+
+fn main() {
+}
diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr
new file mode 100644
index 00000000000..81a60a9dd30
--- /dev/null
+++ b/src/test/ui/span/E0204.stderr
@@ -0,0 +1,38 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0204.rs:15:6
+   |
+12 |     foo: Vec<u32>,
+   |     ------------- this field does not implement `Copy`
+...
+15 | impl Copy for Foo { }
+   |      ^^^^
+
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0204.rs:27:6
+   |
+23 |     Bar { x: Vec<u32> },
+   |           ----------- this field does not implement `Copy`
+...
+27 | impl Copy for EFoo { }
+   |      ^^^^
+
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0204.rs:17:10
+   |
+17 | #[derive(Copy)]
+   |          ^^^^
+18 | struct Foo2<'a> {
+19 |     ty: &'a mut bool,
+   |     ---------------- this field does not implement `Copy`
+
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/E0204.rs:29:10
+   |
+29 | #[derive(Copy)]
+   |          ^^^^
+30 | enum EFoo2<'a> {
+31 |     Bar(&'a mut bool),
+   |         ------------- this field does not implement `Copy`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr
index e3164661507..ed1bcd318a4 100644
--- a/src/test/ui/span/coerce-suggestions.stderr
+++ b/src/test/ui/span/coerce-suggestions.stderr
@@ -7,8 +7,8 @@ error[E0308]: mismatched types
    = note: expected type `usize`
    = note:    found type `std::string::String`
    = help: here are some functions which might fulfill your needs:
- - .capacity()
- - .len()
+           - .capacity()
+           - .len()
 
 error[E0308]: mismatched types
   --> $DIR/coerce-suggestions.rs:23:19
@@ -19,10 +19,10 @@ error[E0308]: mismatched types
    = note: expected type `&str`
    = note:    found type `std::string::String`
    = help: here are some functions which might fulfill your needs:
- - .as_str()
- - .trim()
- - .trim_left()
- - .trim_right()
+           - .as_str()
+           - .trim()
+           - .trim_left()
+           - .trim_right()
 
 error[E0308]: mismatched types
   --> $DIR/coerce-suggestions.rs:30:10
diff --git a/src/test/ui/span/issue-27522.rs b/src/test/ui/span/issue-27522.rs
new file mode 100644
index 00000000000..81fcb007eb4
--- /dev/null
+++ b/src/test/ui/span/issue-27522.rs
@@ -0,0 +1,19 @@
+// Copyright 2016 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.
+
+// Point at correct span for self type
+
+struct SomeType {}
+
+trait Foo {
+    fn handler(self: &SomeType);
+}
+
+fn main() {}
diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr
new file mode 100644
index 00000000000..71130f4947a
--- /dev/null
+++ b/src/test/ui/span/issue-27522.stderr
@@ -0,0 +1,11 @@
+error[E0308]: mismatched method receiver
+  --> $DIR/issue-27522.rs:16:22
+   |
+16 |     fn handler(self: &SomeType);
+   |                      ^^^^^^^^^ expected Self, found struct `SomeType`
+   |
+   = note: expected type `&Self`
+   = note:    found type `&SomeType`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr
index 117c38e1db9..dca0a93f897 100644
--- a/src/test/ui/span/typo-suggestion.stderr
+++ b/src/test/ui/span/typo-suggestion.stderr
@@ -1,10 +1,10 @@
-error[E0425]: unresolved value `bar`
+error[E0425]: cannot find value `bar` in this scope
   --> $DIR/typo-suggestion.rs:15:26
    |
 15 |     println!("Hello {}", bar);
-   |                          ^^^ no resolution found
+   |                          ^^^ not found in this scope
 
-error[E0425]: unresolved value `fob`
+error[E0425]: cannot find value `fob` in this scope
   --> $DIR/typo-suggestion.rs:18:26
    |
 18 |     println!("Hello {}", fob);