Skip to content

Commit e2fa3c3

Browse files
committed
Forbid multiple imports in use statements
Closes #10911
1 parent 487e58c commit e2fa3c3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/libsyntax/parse/obsolete.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub enum ObsoleteSyntax {
4444
ObsoleteVecDotDotWildcard,
4545
ObsoleteBoxedClosure,
4646
ObsoleteClosureType,
47+
ObsoleteMultipleImport,
4748
}
4849

4950
impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -140,6 +141,10 @@ impl ParserObsoleteMethods for Parser {
140141
"closures are now written `|A| -> B` rather than `&fn(A) -> \
141142
B`."
142143
),
144+
ObsoleteMultipleImport => (
145+
"multiple imports",
146+
"only one import is allowed per `use` statement"
147+
),
143148
};
144149

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

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4923,6 +4923,7 @@ impl Parser {
49234923
let mut vp = ~[self.parse_view_path()];
49244924
while *self.token == token::COMMA {
49254925
self.bump();
4926+
self.obsolete(*self.last_span, ObsoleteMultipleImport);
49264927
vp.push(self.parse_view_path());
49274928
}
49284929
return vp;

0 commit comments

Comments
 (0)