about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-11-13 14:20:56 -0500
committerChristopher Vittal <christopher.vittal@gmail.com>2017-11-15 15:46:01 -0500
commit15001ee336f864679eca133e9055b68614d50643 (patch)
tree994d68e8ded2198e622743d8e48600df5b441e84 /src/test/ui/impl-trait
parent9d71bf6d556e116e850c0d9b5f8975889b1ab575 (diff)
downloadrust-15001ee336f864679eca133e9055b68614d50643.tar.gz
rust-15001ee336f864679eca133e9055b68614d50643.zip
add a UI test showing the current output from an impl trait type
Diffstat (limited to 'src/test/ui/impl-trait')
-rw-r--r--src/test/ui/impl-trait/universal-mismatched-type.rs19
-rw-r--r--src/test/ui/impl-trait/universal-mismatched-type.stderr13
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/universal-mismatched-type.rs b/src/test/ui/impl-trait/universal-mismatched-type.rs
new file mode 100644
index 00000000000..af7adc4c657
--- /dev/null
+++ b/src/test/ui/impl-trait/universal-mismatched-type.rs
@@ -0,0 +1,19 @@
+// 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.
+//
+// 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(universal_impl_trait)]
+
+use std::fmt::Debug;
+
+fn foo(x: impl Debug) -> String {
+    x
+}
+
+fn main() { }
diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr
new file mode 100644
index 00000000000..7f206846ad1
--- /dev/null
+++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr
@@ -0,0 +1,13 @@
+error[E0308]: mismatched types
+  --> $DIR/universal-mismatched-type.rs:16:5
+   |
+15 | fn foo(x: impl Debug) -> String {
+   |                          ------ expected `std::string::String` because of return type
+16 |     x
+   |     ^ expected struct `std::string::String`, found type parameter
+   |
+   = note: expected type `std::string::String`
+              found type ``
+
+error: aborting due to previous error
+