about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-08-06 15:01:22 +0300
committerGitHub <noreply@github.com>2016-08-06 15:01:22 +0300
commit8747b5bc61da72013eb3596e40a464235028568b (patch)
tree6e8050676ce1e82f40e4267b0e2ab419b138e771
parenta7b7417c281e14122722c2fd0e7dbb2be6aabcd0 (diff)
parent58b618e5270a1bef26ad1ed95820c22e09b24ec5 (diff)
downloadrust-8747b5bc61da72013eb3596e40a464235028568b.tar.gz
rust-8747b5bc61da72013eb3596e40a464235028568b.zip
Rollup merge of #35368 - shantanuraj:master, r=jonathandturner
Update E0207 to use struct_span_err, add span_label

Fixes #35302 part of #35233

r? @jonathandturner
-rw-r--r--src/librustc_typeck/collect.rs12
-rw-r--r--src/test/compile-fail/E0207.rs1
-rw-r--r--src/test/compile-fail/impl-unused-rps-in-assoc-type.rs1
-rw-r--r--src/test/compile-fail/issue-22886.rs1
-rw-r--r--src/test/compile-fail/issue-35139.rs1
5 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index cb9c0496246..92b91028b98 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -2317,8 +2317,12 @@ fn report_unused_parameter(ccx: &CrateCtxt,
                            kind: &str,
                            name: &str)
 {
-    span_err!(ccx.tcx.sess, span, E0207,
-              "the {} parameter `{}` is not constrained by the \
-               impl trait, self type, or predicates",
-              kind, name);
+    struct_span_err!(
+        ccx.tcx.sess, span, E0207,
+        "the {} parameter `{}` is not constrained by the \
+        impl trait, self type, or predicates",
+        kind, name)
+        .span_label(span, &format!("unconstrained lifetime parameter"))
+        .emit();
+
 }
diff --git a/src/test/compile-fail/E0207.rs b/src/test/compile-fail/E0207.rs
index bd87dbaf786..43ff085a4fa 100644
--- a/src/test/compile-fail/E0207.rs
+++ b/src/test/compile-fail/E0207.rs
@@ -11,6 +11,7 @@
 struct Foo;
 
 impl<T: Default> Foo { //~ ERROR E0207
+                       //~| NOTE unconstrained lifetime parameter
     fn get(&self) -> T {
         <T as Default>::default()
     }
diff --git a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs b/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs
index 23401db21d8..d48433ee928 100644
--- a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs
+++ b/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs
@@ -19,6 +19,7 @@ trait Fun {
 struct Holder { x: String }
 
 impl<'a> Fun for Holder { //~ ERROR E0207
+                          //~| NOTE unconstrained lifetime parameter
     type Output = &'a str;
     fn call<'b>(&'b self) -> &'b str {
         &self.x[..]
diff --git a/src/test/compile-fail/issue-22886.rs b/src/test/compile-fail/issue-22886.rs
index 4aa2571cad0..d258a4a8b33 100644
--- a/src/test/compile-fail/issue-22886.rs
+++ b/src/test/compile-fail/issue-22886.rs
@@ -21,6 +21,7 @@ fn crash_please() {
 struct Newtype(Option<Box<usize>>);
 
 impl<'a> Iterator for Newtype { //~ ERROR E0207
+                                //~| NOTE unconstrained lifetime parameter
     type Item = &'a Box<usize>;
 
     fn next(&mut self) -> Option<&Box<usize>> {
diff --git a/src/test/compile-fail/issue-35139.rs b/src/test/compile-fail/issue-35139.rs
index 67f0e7aaf97..5c4f161a500 100644
--- a/src/test/compile-fail/issue-35139.rs
+++ b/src/test/compile-fail/issue-35139.rs
@@ -17,6 +17,7 @@ pub trait MethodType {
 pub struct MTFn;
 
 impl<'a> MethodType for MTFn { //~ ERROR E0207
+                               //~| NOTE unconstrained lifetime parameter
     type GetProp = fmt::Debug + 'a;
 }