From e2fa3c3af79df48776dabcdf9291534822e6f874 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 10 Dec 2013 21:50:38 -0800 Subject: [PATCH] Forbid multiple imports in use statements Closes #10911 --- src/libsyntax/parse/obsolete.rs | 5 +++++ src/libsyntax/parse/parser.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 8e291ca6705..d739fca99da 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -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); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 62bfd7c80f9..12266a878db 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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;