about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-04 21:57:08 +0000
committerbors <bors@rust-lang.org>2014-10-04 21:57:08 +0000
commit07aeac8ac80a9af809a022626773c903d2116bf7 (patch)
treea93c45afbe1461649a1c787b9fbd99f80e01145c
parenta2e7c4da9b331d337fba0b3911c6d3d7f48e8305 (diff)
parent6f6d13a7c7cb2faa12c0905b094024521a86c165 (diff)
downloadrust-07aeac8ac80a9af809a022626773c903d2116bf7.tar.gz
rust-07aeac8ac80a9af809a022626773c903d2116bf7.zip
auto merge of #17761 : bkoropoff/rust/issue-17758, r=alexcrichton
This fixes an ICE and closes issue #17758
-rw-r--r--src/librustc/middle/typeck/infer/error_reporting.rs13
-rw-r--r--src/test/compile-fail/issue-17758.rs22
2 files changed, 35 insertions, 0 deletions
diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs
index 8ff5b3c9024..2a8a695b63e 100644
--- a/src/librustc/middle/typeck/infer/error_reporting.rs
+++ b/src/librustc/middle/typeck/infer/error_reporting.rs
@@ -869,6 +869,19 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
                         ast::TypeImplItem(_) => None,
                     }
                 },
+                ast_map::NodeTraitItem(ref item) => {
+                    match **item {
+                        ast::ProvidedMethod(ref m) => {
+                            Some((m.pe_fn_decl(),
+                                  m.pe_generics(),
+                                  m.pe_fn_style(),
+                                  m.pe_ident(),
+                                  Some(&m.pe_explicit_self().node),
+                                  m.span))
+                        }
+                        _ => None
+                    }
+                }
                 _ => None
             },
             None => None
diff --git a/src/test/compile-fail/issue-17758.rs b/src/test/compile-fail/issue-17758.rs
new file mode 100644
index 00000000000..bb480e5e4dd
--- /dev/null
+++ b/src/test/compile-fail/issue-17758.rs
@@ -0,0 +1,22 @@
+// 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.
+
+// Test that regionck suggestions in a provided method of a trait
+// don't ICE
+
+trait Foo<'a> {
+    fn foo(&'a self);
+    fn bar(&self) {
+        self.foo();
+        //~^ ERROR mismatched types: expected `&'a Self`, found `&Self` (lifetime mismatch)
+    }
+}
+
+fn main() {}