libsyntax: Forbid ~mut and ~const. rs=demuting
This commit is contained in:
parent
061a223723
commit
8d7e6ef772
9 changed files with 33 additions and 46 deletions
|
|
@ -128,7 +128,7 @@ pub impl Parser {
|
|||
"write `+` between trait bounds"
|
||||
),
|
||||
ObsoleteMutOwnedPointer => (
|
||||
"mutable owned pointer",
|
||||
"const or mutable owned pointer",
|
||||
"mutability inherits through `~` pointers; place the `~` box
|
||||
in a mutable location, like a mutable local variable or an \
|
||||
`@mut` box"
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ pub impl Parser {
|
|||
// reflected in the AST type.
|
||||
let mt = self.parse_mt();
|
||||
|
||||
if mt.mutbl == m_mutbl && sigil == OwnedSigil {
|
||||
if mt.mutbl != m_imm && sigil == OwnedSigil {
|
||||
self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
|
||||
}
|
||||
|
||||
|
|
@ -1574,6 +1574,10 @@ pub impl Parser {
|
|||
token::TILDE => {
|
||||
self.bump();
|
||||
let m = self.parse_mutability();
|
||||
if m != m_imm {
|
||||
self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
|
||||
}
|
||||
|
||||
let e = self.parse_prefix_expr();
|
||||
hi = e.span.hi;
|
||||
// HACK: turn ~[...] into a ~-evec
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue