about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAxary <bastian_kauschke@hotmail.de>2018-11-16 18:43:06 +0100
committerAxary <bastian_kauschke@hotmail.de>2018-11-16 18:43:06 +0100
commit646d68f585e6cbabba5b7a67665af9a1f83ea6ea (patch)
tree588ccf9aef4bdc3cdf828aab56b4d851492aecfc /src
parent4c4aff9b3d1734a1dfb127ce8732728edc5b39ed (diff)
downloadrust-646d68f585e6cbabba5b7a67665af9a1f83ea6ea.tar.gz
rust-646d68f585e6cbabba5b7a67665af9a1f83ea6ea.zip
add a note to the error message
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/parse/parser.rs5
-rw-r--r--src/test/ui/bare-function-self.rs1
-rw-r--r--src/test/ui/bare-function-self.stderr4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index dd1864ce124..7ddb4099e0e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5388,7 +5388,10 @@ impl<'a> Parser<'a> {
         self.expect(&token::OpenDelim(token::Paren))?;
 
         if let Ok(Some(_)) = self.parse_self_arg() {
-            return Err(self.fatal("unexpected `self` argument in bare function"))
+            let mut err = self.struct_span_err(self.prev_span
+                , "unexpected `self` argument in bare function");
+            err.span_label(self.prev_span, "invalid argument in bare function");
+            return Err(err);
         }
 
         let sp = self.span;
diff --git a/src/test/ui/bare-function-self.rs b/src/test/ui/bare-function-self.rs
index 0a430aee973..f906b176d92 100644
--- a/src/test/ui/bare-function-self.rs
+++ b/src/test/ui/bare-function-self.rs
@@ -1,4 +1,5 @@
 fn a(&self) { }
 //~^ ERROR unexpected `self` argument in bare function
+//~| NOTE invalid argument in bare function
 
 fn main() { }
diff --git a/src/test/ui/bare-function-self.stderr b/src/test/ui/bare-function-self.stderr
index 51db0ddd70d..002d71b1103 100644
--- a/src/test/ui/bare-function-self.stderr
+++ b/src/test/ui/bare-function-self.stderr
@@ -1,8 +1,8 @@
 error: unexpected `self` argument in bare function
-  --> $DIR/bare-function-self.rs:12:11
+  --> $DIR/bare-function-self.rs:1:7
    |
 LL | fn a(&self) { }
-   |           ^
+   |       ^^^^ invalid argument in bare function
 
 error: aborting due to previous error