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/obsolete.rs2
-rw-r--r--src/libsyntax/parse/parser.rs6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 7b3030124b7..0c5c0f3d513 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -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"
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index af25a4f6e58..c9102cbb86b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -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