about summary refs log tree commit diff
path: root/src/test/run-make
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-11-09 20:51:16 +0200
committerGitHub <noreply@github.com>2016-11-09 20:51:16 +0200
commit7f2853fda3773d4f9ec28484ba3592d5e825ca59 (patch)
treee1e75573b26d35b20c4682d4008b1f8e835476ca /src/test/run-make
parent6c7b43375ad70b9b134973b461854bbe60313ffc (diff)
parent40c2c0f833c0480c3cf3904fa3614cb0a01d7f87 (diff)
downloadrust-7f2853fda3773d4f9ec28484ba3592d5e825ca59.tar.gz
rust-7f2853fda3773d4f9ec28484ba3592d5e825ca59.zip
Rollup merge of #37370 - estebank:signature-2-empire-strikes-back, r=nikomatsakis
Include type of missing trait methods in error

Provide either a span pointing to the original definition of missing
trait items, or a message with the inferred definitions.

Fixes #24626. Follow up to PR #36371.

If PR #37369 lands, missing trait items that present a multiline span will be able to show the entirety of the item definition on the error itself, instead of just the first line.
Diffstat (limited to 'src/test/run-make')
-rw-r--r--src/test/run-make/missing-items/Makefile10
-rw-r--r--src/test/run-make/missing-items/m1.rs17
-rw-r--r--src/test/run-make/missing-items/m2.rs19
3 files changed, 46 insertions, 0 deletions
diff --git a/src/test/run-make/missing-items/Makefile b/src/test/run-make/missing-items/Makefile
new file mode 100644
index 00000000000..bcc9cdf2d65
--- /dev/null
+++ b/src/test/run-make/missing-items/Makefile
@@ -0,0 +1,10 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) m1.rs -C prefer-dynamic
+	$(RUSTC) m2.rs 2>&1 | grep "error\[E0046\]: not all trait items implemented, missing: .*"
+	$(RUSTC) m2.rs 2>&1 | grep "  --> m2.rs:18:1"
+	$(RUSTC) m2.rs 2>&1 | grep "   | ^ missing .CONSTANT., .Type., .method. in implementation"
+	$(RUSTC) m2.rs 2>&1 | grep "   = note: .CONSTANT. from trait: .const CONSTANT: u32;."
+	$(RUSTC) m2.rs 2>&1 | grep "   = note: .Type. from trait: .type Type;."
+	$(RUSTC) m2.rs 2>&1 | grep "   = note: .method. from trait: .fn(&Self, std::string::String) -> <Self as m1::X>::Type."
diff --git a/src/test/run-make/missing-items/m1.rs b/src/test/run-make/missing-items/m1.rs
new file mode 100644
index 00000000000..060c7a9571b
--- /dev/null
+++ b/src/test/run-make/missing-items/m1.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#![feature(associated_consts)]
+#![crate_type = "dylib"]
+pub trait X {
+  const CONSTANT: u32;
+  type Type;
+  fn method(&self, s: String) -> Self::Type;
+}
diff --git a/src/test/run-make/missing-items/m2.rs b/src/test/run-make/missing-items/m2.rs
new file mode 100644
index 00000000000..7055673acc9
--- /dev/null
+++ b/src/test/run-make/missing-items/m2.rs
@@ -0,0 +1,19 @@
+// 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.
+
+#![feature(associated_consts)]
+#![crate_type = "dylib"]
+extern crate m1;
+
+struct X {
+}
+
+impl m1::X for X {
+}