Forbid multiple imports in use statements

Closes #10911
This commit is contained in:
Alex Crichton 2013-12-10 21:50:38 -08:00
parent 487e58cca2
commit e2fa3c3af7
2 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,7 @@ pub enum ObsoleteSyntax {
ObsoleteVecDotDotWildcard,
ObsoleteBoxedClosure,
ObsoleteClosureType,
ObsoleteMultipleImport,
}
impl to_bytes::IterBytes for ObsoleteSyntax {
@ -140,6 +141,10 @@ fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) {
"closures are now written `|A| -> B` rather than `&fn(A) -> \
B`."
),
ObsoleteMultipleImport => (
"multiple imports",
"only one import is allowed per `use` statement"
),
};
self.report(sp, kind, kind_str, desc);

View File

@ -4923,6 +4923,7 @@ fn parse_view_paths(&self) -> ~[@view_path] {
let mut vp = ~[self.parse_view_path()];
while *self.token == token::COMMA {
self.bump();
self.obsolete(*self.last_span, ObsoleteMultipleImport);
vp.push(self.parse_view_path());
}
return vp;