From: Alex Crichton Date: Tue, 24 Jun 2014 23:29:15 +0000 (-0700) Subject: rustc: Don't register syntax crates twice X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fb296b80118a2c594986c09f2b6ec97829ba3d2d;p=rust.git rustc: Don't register syntax crates twice We only need to register them once, and once they're registered twice warnings will start being spewed or worse may happen! Closes #14330 --- diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index efe28614b8f..0b9ed68215a 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -448,7 +448,7 @@ pub fn read_plugin_metadata(&mut self, krate: &ast::ViewItem) -> PluginMetadata macros: macros.move_iter().map(|x| x.to_string()).collect(), registrar_symbol: registrar, }; - if should_link { + if should_link && existing_match(&self.env, &info.crate_id, None).is_none() { // register crate now to avoid double-reading metadata register_crate(&mut self.env, &None, info.ident.as_slice(), &info.crate_id, krate.span, library); diff --git a/src/test/run-pass/issue-14330.rs b/src/test/run-pass/issue-14330.rs new file mode 100644 index 00000000000..a7f2ebf9e11 --- /dev/null +++ b/src/test/run-pass/issue-14330.rs @@ -0,0 +1,15 @@ +// Copyright 2012-2014 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. + +#![feature(phase)] + +#[phase(plugin, link)] extern crate std; + +fn main() {}