Skip to content

Commit 6539cb4

Browse files
committed
auto merge of #20618 : alexcrichton/rust/less-warn, r=brson
This warning has been around in the compiler for quite some time now, but the real place for a warning like this, if it should exist, is in Cargo, not in the compiler itself. It's a first-class feature of Cargo that multiple versions of a crate can be compiled into the same executable, and we shouldn't be warning about our first-class features.
2 parents 8efd990 + 9d0b3c9 commit 6539cb4

File tree

5 files changed

+1
-61
lines changed

5 files changed

+1
-61
lines changed

src/librustc/metadata/creader.rs

-25
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ use metadata::cstore::{CStore, CrateSource, MetadataBlob};
2020
use metadata::decoder;
2121
use metadata::loader;
2222
use metadata::loader::CratePaths;
23-
use util::nodemap::FnvHashMap;
2423

2524
use std::rc::Rc;
26-
use std::collections::hash_map::Entry::{Occupied, Vacant};
2725
use syntax::ast;
2826
use syntax::abi;
2927
use syntax::attr;
3028
use syntax::attr::AttrMetaMethods;
3129
use syntax::codemap::{Span, mk_sp};
32-
use syntax::diagnostic::SpanHandler;
3330
use syntax::parse;
3431
use syntax::parse::token::InternedString;
3532
use syntax::parse::token;
@@ -67,27 +64,6 @@ fn dump_crates(cstore: &CStore) {
6764
})
6865
}
6966

70-
fn warn_if_multiple_versions(diag: &SpanHandler, cstore: &CStore) {
71-
let mut map = FnvHashMap::new();
72-
cstore.iter_crate_data(|cnum, data| {
73-
match map.entry(&data.name()) {
74-
Vacant(entry) => { entry.insert(vec![cnum]); },
75-
Occupied(mut entry) => { entry.get_mut().push(cnum); },
76-
}
77-
});
78-
79-
for (name, dupes) in map.into_iter() {
80-
if dupes.len() == 1 { continue }
81-
diag.handler().warn(
82-
format!("using multiple versions of crate `{}`", name)[]);
83-
for dupe in dupes.into_iter() {
84-
let data = cstore.get_crate_data(dupe);
85-
diag.span_note(data.span, "used here");
86-
loader::note_crate_name(diag, data.name()[]);
87-
}
88-
}
89-
}
90-
9167
fn should_link(i: &ast::ViewItem) -> bool {
9268
!attr::contains_name(i.attrs[], "no_link")
9369
}
@@ -188,7 +164,6 @@ impl<'a> CrateReader<'a> {
188164
if log_enabled!(log::DEBUG) {
189165
dump_crates(&self.sess.cstore);
190166
}
191-
warn_if_multiple_versions(self.sess.diagnostic(), &self.sess.cstore);
192167

193168
for &(ref name, kind) in self.sess.opts.libs.iter() {
194169
register_native_lib(self.sess, None, name.clone(), kind);

src/test/run-make/extern-diff-internal-name/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
all:
44
$(RUSTC) lib.rs
5-
$(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib 2>&1 | \
6-
{ ! grep "using multiple versions of crate"; }
5+
$(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib

src/test/run-make/multiple-versions/Makefile

-9
This file was deleted.

src/test/run-make/multiple-versions/bar.rs

-14
This file was deleted.

src/test/run-make/multiple-versions/foo.rs

-11
This file was deleted.

0 commit comments

Comments
 (0)