about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/issue-17662.rs22
-rw-r--r--src/test/run-pass/issue-17662.rs23
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue-17662.rs b/src/test/auxiliary/issue-17662.rs
new file mode 100644
index 00000000000..e2c6857fb69
--- /dev/null
+++ b/src/test/auxiliary/issue-17662.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.
+
+#![crate_type = "lib"]
+
+pub trait Foo<'a, T> {
+    fn foo(&self) -> T;
+}
+
+pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
+    let x: &'a Foo<T> = x;
+    //            ^ the lifetime parameter of Foo is left to be infered.
+    x.foo()
+    // ^ encoding this method call in metadata triggers an ICE.
+}
diff --git a/src/test/run-pass/issue-17662.rs b/src/test/run-pass/issue-17662.rs
new file mode 100644
index 00000000000..34bcfeb10de
--- /dev/null
+++ b/src/test/run-pass/issue-17662.rs
@@ -0,0 +1,23 @@
+// 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.
+
+// aux-build:issue-17662.rs
+
+extern crate "issue-17662" as i;
+
+struct Bar<'a>;
+
+impl<'a> i::Foo<'a, uint> for Bar<'a> {
+    fn foo(&self) -> uint { 5u }
+}
+
+pub fn main() {
+    assert_eq!(i::foo(&Bar), 5);
+}