Skip to content

Commit 24893e8

Browse files
committed
libsyntax: Stop parsing ~mut
1 parent e3d43e4 commit 24893e8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/libsyntax/parse/obsolete.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub enum ObsoleteSyntax {
4848
ObsoleteUnenforcedBound,
4949
ObsoleteImplSyntax,
5050
ObsoleteTraitBoundSeparator,
51+
ObsoleteMutOwnedPointer,
5152
}
5253

5354
pub impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -126,6 +127,12 @@ pub impl Parser {
126127
"space-separated trait bounds",
127128
"write `+` between trait bounds"
128129
),
130+
ObsoleteMutOwnedPointer => (
131+
"mutable owned pointer",
132+
"mutability inherits through `~` pointers; place the `~` box
133+
in a mutable location, like a mutable local variable or an \
134+
`@mut` box"
135+
),
129136
};
130137

131138
self.report(sp, kind, kind_str, desc);

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove};
7575
use parse::obsolete::{ObsoleteStructCtor, ObsoleteWith};
7676
use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
7777
use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
78-
use parse::obsolete::{ObsoleteTraitBoundSeparator};
78+
use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
7979
use parse::prec::{as_prec, token_to_binop};
8080
use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
8181
use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
@@ -677,6 +677,11 @@ pub impl Parser {
677677
// rather than boxed ptrs. But the special casing of str/vec is not
678678
// reflected in the AST type.
679679
let mt = self.parse_mt();
680+
681+
if mt.mutbl == m_mutbl && sigil == OwnedSigil {
682+
self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
683+
}
684+
680685
ctor(mt)
681686
}
682687

0 commit comments

Comments
 (0)