Skip to content

Commit ce358fc

Browse files
committed
libsyntax: Make managed box @ patterns obsolete
1 parent b8c60f9 commit ce358fc

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/libsyntax/parse/obsolete.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ pub enum ObsoleteSyntax {
4444
ObsoleteBoxedClosure,
4545
ObsoleteClosureType,
4646
ObsoleteMultipleImport,
47-
ObsoleteExternModAttributesInParens
47+
ObsoleteExternModAttributesInParens,
48+
ObsoleteManagedPattern,
4849
}
4950

5051
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -148,7 +149,12 @@ impl ParserObsoleteMethods for Parser {
148149
"`extern mod` with linkage attribute list",
149150
"use `extern mod foo = \"bar\";` instead of \
150151
`extern mod foo (name = \"bar\")`"
151-
)
152+
),
153+
ObsoleteManagedPattern => (
154+
"managed pointer pattern",
155+
"use a nested `match` expression instead of a managed box \
156+
pattern"
157+
),
152158
};
153159

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

src/libsyntax/parse/parser.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,10 @@ impl Parser {
29032903
};
29042904
PatLit(vst)
29052905
}
2906-
_ => PatBox(sub)
2906+
_ => {
2907+
self.obsolete(self.span, ObsoleteManagedPattern);
2908+
PatBox(sub)
2909+
}
29072910
};
29082911
hi = self.last_span.hi;
29092912
return @ast::Pat {

0 commit comments

Comments
 (0)