about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-01-05 17:40:26 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-01-07 23:26:28 -0800
commit563ecc1b1fe8f8daea20910a23b7090411cf2de8 (patch)
tree2d175a265860ab33a3d1c497d379661d3196056a
parentf2dd75cb865524ca558630a2e785ca55d6d287ef (diff)
downloadrust-563ecc1b1fe8f8daea20910a23b7090411cf2de8.tar.gz
rust-563ecc1b1fe8f8daea20910a23b7090411cf2de8.zip
add test case
-rw-r--r--src/test/ui/mismatched_types/issue-38371.rs18
-rw-r--r--src/test/ui/mismatched_types/issue-38371.stderr21
2 files changed, 31 insertions, 8 deletions
diff --git a/src/test/ui/mismatched_types/issue-38371.rs b/src/test/ui/mismatched_types/issue-38371.rs
index 20998447737..36191ebc540 100644
--- a/src/test/ui/mismatched_types/issue-38371.rs
+++ b/src/test/ui/mismatched_types/issue-38371.rs
@@ -1,4 +1,4 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -7,20 +7,28 @@
 // <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(slice_patterns)]
+
 
 struct Foo {
 }
 
-fn foo(&foo: Foo) {  // illegal syntax
+fn foo(&foo: Foo) {
+}
+
+fn bar(foo: Foo) {
+}
+
+fn qux(foo: &Foo) {
 }
 
-fn bar(foo: Foo) {  // legal
+fn zar(&foo: &Foo) {
 }
 
-fn qux(foo: &Foo) {  // legal
+fn agh(&&bar: &u32) {
 }
 
-fn zar(&foo: &Foo) {  // legal
+fn ugh(&[bar]: &u32) {
 }
 
 fn main() {}
diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr
index e0d80f890d9..5892b892fa7 100644
--- a/src/test/ui/mismatched_types/issue-38371.stderr
+++ b/src/test/ui/mismatched_types/issue-38371.stderr
@@ -1,12 +1,27 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-38371.rs:14:8
+  --> $DIR/issue-38371.rs:16:8
    |
-14 | fn foo(&foo: Foo) {  // illegal syntax
+16 | fn foo(&foo: Foo) {
    |        ^^^^ expected struct `Foo`, found reference
    |
    = note: expected type `Foo`
    = note:    found type `&_`
    = help: did you mean `foo: &Foo`?
 
-error: aborting due to previous error
+error[E0308]: mismatched types
+  --> $DIR/issue-38371.rs:28:9
+   |
+28 | fn agh(&&bar: &u32) {
+   |         ^^^^ expected u32, found reference
+   |
+   = note: expected type `u32`
+   = note:    found type `&_`
+
+error[E0529]: expected an array or slice, found `u32`
+  --> $DIR/issue-38371.rs:31:9
+   |
+31 | fn ugh(&[bar]: &u32) {
+   |         ^^^^^ pattern cannot match with input type `u32`
+
+error: aborting due to 3 previous errors