Skip to content

Commit fb296b8

Browse files
committed
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
1 parent 86dda1b commit fb296b8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/librustc/metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl<'a> PluginMetadataReader<'a> {
448448
macros: macros.move_iter().map(|x| x.to_string()).collect(),
449449
registrar_symbol: registrar,
450450
};
451-
if should_link {
451+
if should_link && existing_match(&self.env, &info.crate_id, None).is_none() {
452452
// register crate now to avoid double-reading metadata
453453
register_crate(&mut self.env, &None, info.ident.as_slice(),
454454
&info.crate_id, krate.span, library);

src/test/run-pass/issue-14330.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(phase)]
12+
13+
#[phase(plugin, link)] extern crate std;
14+
15+
fn main() {}

0 commit comments

Comments
 (0)