Emit a better error for attempted unsafe-pointer-self. Close #8306.
This commit is contained in:
parent
e9f6f3f2cc
commit
02f93ca324
2 changed files with 35 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue