libsyntax: Make managed box @ patterns obsolete

This commit is contained in:
Patrick Walton 2014-01-03 14:15:08 -08:00
parent b8c60f906b
commit ce358fca33
2 changed files with 12 additions and 3 deletions

View File

@ -44,7 +44,8 @@ pub enum ObsoleteSyntax {
ObsoleteBoxedClosure,
ObsoleteClosureType,
ObsoleteMultipleImport,
ObsoleteExternModAttributesInParens
ObsoleteExternModAttributesInParens,
ObsoleteManagedPattern,
}
impl to_bytes::IterBytes for ObsoleteSyntax {
@ -148,7 +149,12 @@ impl ParserObsoleteMethods for Parser {
"`extern mod` with linkage attribute list",
"use `extern mod foo = \"bar\";` instead of \
`extern mod foo (name = \"bar\")`"
)
),
ObsoleteManagedPattern => (
"managed pointer pattern",
"use a nested `match` expression instead of a managed box \
pattern"
),
};
self.report(sp, kind, kind_str, desc);

View File

@ -2903,7 +2903,10 @@ impl Parser {
};
PatLit(vst)
}
_ => PatBox(sub)
_ => {
self.obsolete(self.span, ObsoleteManagedPattern);
PatBox(sub)
}
};
hi = self.last_span.hi;
return @ast::Pat {