From 5e06da29a73bba354903ba7dc1eddf3434ac112e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Hlusi=C4=8Dka?= <jakub.hlusicka@email.cz>
Date: Sun, 7 Aug 2016 00:09:54 +0200
Subject: [PATCH] E0131 updated to new format

---
 src/librustc_typeck/lib.rs     | 14 +++++++++-----
 src/test/compile-fail/E0131.rs |  4 +++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index 6f0892cdcdf16..65e00705121a7 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -211,11 +211,15 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
             match tcx.map.find(main_id) {
                 Some(hir_map::NodeItem(it)) => {
                     match it.node {
-                        hir::ItemFn(_, _, _, _, ref ps, _)
-                        if ps.is_parameterized() => {
-                            span_err!(ccx.tcx.sess, main_span, E0131,
-                                      "main function is not allowed to have type parameters");
-                            return;
+                        hir::ItemFn(_, _, _, _, ref generics, _) => {
+                            if let Some(gen_span) = generics.span() {
+                                struct_span_err!(ccx.tcx.sess, gen_span, E0131,
+                                         "main function is not allowed to have type parameters")
+                                    .span_label(gen_span,
+                                                &format!("main cannot have type parameters"))
+                                    .emit();
+                                return;
+                            }
                         }
                         _ => ()
                     }
diff --git a/src/test/compile-fail/E0131.rs b/src/test/compile-fail/E0131.rs
index aa11577ccdf1e..e6e924e2d966f 100644
--- a/src/test/compile-fail/E0131.rs
+++ b/src/test/compile-fail/E0131.rs
@@ -8,5 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn main<T>() { //~ ERROR E0131
+fn main<T>() {
+    //~^ ERROR E0131
+    //~| NOTE main cannot have type parameters
 }