about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 51213512a55..6db9828fa25 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3571,6 +3571,19 @@ impl Parser {
             self.bump();
             sty_value
           }
+          token::BINOP(token::STAR) => {
+            // Possibly "*self" or "*mut self" -- not supported. Try to avoid
+            // emitting cryptic "unexpected token" errors.
+            self.bump();
+            if self.token_is_mutability(self.token) {
+                self.bump();
+            }
+            if self.is_self_ident() {
+                self.span_err(*self.span, "cannot pass self by unsafe pointer");
+                self.bump();
+            }
+            sty_value
+          }
           _ => {
             sty_static
           }