about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2016-07-19 01:02:47 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2016-07-22 14:32:56 +0300
commitfa4eda8935cc902b0757815e774f11ee791af156 (patch)
tree2e0a377592d670bc18efa7b8ad9cb92a885b9c6d /src/test/compile-fail
parentb7b2db4da7dc6762d53659b32e5fb4ba8e5c5988 (diff)
downloadrust-fa4eda8935cc902b0757815e774f11ee791af156.tar.gz
rust-fa4eda8935cc902b0757815e774f11ee791af156.zip
switch projection errors to use the new type error messages
Unfortunately, projection errors do not come with a nice set of
mismatched types. This is because the type equality check occurs
within a higher-ranked context. Therefore, only the type error
is reported. This is ugly but was always the situation.

I will introduce better errors for the lower-ranked case in
another commit.

Fixes the last known occurence of #31173
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/associated-types-eq-3.rs6
-rw-r--r--src/test/compile-fail/issue-31173.rs26
2 files changed, 28 insertions, 4 deletions
diff --git a/src/test/compile-fail/associated-types-eq-3.rs b/src/test/compile-fail/associated-types-eq-3.rs
index 8c66160e8a3..cb952f6534f 100644
--- a/src/test/compile-fail/associated-types-eq-3.rs
+++ b/src/test/compile-fail/associated-types-eq-3.rs
@@ -47,10 +47,8 @@ pub fn main() {
     let a = 42;
     foo1(a);
     //~^ ERROR type mismatch resolving
-    //~| expected usize
-    //~| found struct `Bar`
+    //~| expected usize, found struct `Bar`
     baz(&a);
     //~^ ERROR type mismatch resolving
-    //~| expected usize
-    //~| found struct `Bar`
+    //~| expected usize, found struct `Bar`
 }
diff --git a/src/test/compile-fail/issue-31173.rs b/src/test/compile-fail/issue-31173.rs
new file mode 100644
index 00000000000..62d23a99cba
--- /dev/null
+++ b/src/test/compile-fail/issue-31173.rs
@@ -0,0 +1,26 @@
+// 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.
+
+use std::vec::IntoIter;
+
+pub fn get_tok(it: &mut IntoIter<u8>) {
+    let mut found_e = false;
+
+    let temp: Vec<u8> = it.take_while(|&x| {
+        found_e = true;
+        false
+    })
+        .cloned()
+        //~^ ERROR type mismatch resolving
+        //~| expected u8, found &-ptr
+        .collect(); //~ ERROR no method named `collect`
+}
+
+fn main() {}