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 @@ impl<'a> PluginMetadataReader<'a> { 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() {}