about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-15 19:25:45 -0700
committerGitHub <noreply@github.com>2016-06-15 19:25:45 -0700
commit58adb0760726bfb6f19c055caa58af51ef393b57 (patch)
tree0e6332f48ca979ef4f7279af9e3b202a2c456091 /src/libsyntax/parse
parentbb4a79b087158f396b984bdf552d2c90890b12a3 (diff)
parente3d6bb1f71f372c37cb864d0f8f71cc256eae44b (diff)
downloadrust-58adb0760726bfb6f19c055caa58af51ef393b57.tar.gz
rust-58adb0760726bfb6f19c055caa58af51ef393b57.zip
Auto merge of #34291 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #34207, #34268, #34270, #34290
- Failed merges:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 22cc20b8f8c..341b076e7cf 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5430,18 +5430,15 @@ impl<'a> Parser<'a> {
                               name: String,
                               id_sp: Span) -> PResult<'a, (ast::ItemKind, Vec<ast::Attribute> )> {
         let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
-        match included_mod_stack.iter().position(|p| *p == path) {
-            Some(i) => {
-                let mut err = String::from("circular modules: ");
-                let len = included_mod_stack.len();
-                for p in &included_mod_stack[i.. len] {
-                    err.push_str(&p.to_string_lossy());
-                    err.push_str(" -> ");
-                }
-                err.push_str(&path.to_string_lossy());
-                return Err(self.span_fatal(id_sp, &err[..]));
-            }
-            None => ()
+        if let Some(i) = included_mod_stack.iter().position(|p| *p == path) {
+            let mut err = String::from("circular modules: ");
+            let len = included_mod_stack.len();
+            for p in &included_mod_stack[i.. len] {
+                err.push_str(&p.to_string_lossy());
+                err.push_str(" -> ");
+            }
+            err.push_str(&path.to_string_lossy());
+            return Err(self.span_fatal(id_sp, &err[..]));
         }
         included_mod_stack.push(path.clone());
         drop(included_mod_stack);