From 984a596cfd4a1acb3709cd96eb4a8bfe4e3d0966 Mon Sep 17 00:00:00 2001 From: Potpourri Date: Sun, 1 Feb 2015 00:59:58 +0300 Subject: [PATCH] Reject syntax like `use std::io::;` --- src/libsyntax/parse/parser.rs | 5 +++++ src/test/compile-fail/use-ends-with-mod-sep.rs | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/test/compile-fail/use-ends-with-mod-sep.rs diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d99095eeba377..b34e99146bd2e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5954,6 +5954,11 @@ impl<'a> Parser<'a> { return P(spanned(lo, self.span.hi, ViewPathGlob(path))); } + // fall-through for case foo::bar::; + token::Semi => { + self.span_err(self.span, "expected identifier or `{` or `*`, found `;`"); + } + _ => break } } diff --git a/src/test/compile-fail/use-ends-with-mod-sep.rs b/src/test/compile-fail/use-ends-with-mod-sep.rs new file mode 100644 index 0000000000000..a375a5962a567 --- /dev/null +++ b/src/test/compile-fail/use-ends-with-mod-sep.rs @@ -0,0 +1,11 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any::; //~ ERROR expected identifier or `{` or `*`, found `;`