Skip to content

Commit 7cb2aa2

Browse files
committed
auto merge of #11523 : alexcrichton/rust/stage3, r=brson
This should go back to the old behavior while preserving the snapshot ease.
2 parents 7232dbf + 7a37294 commit 7cb2aa2

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

Makefile.in

+1
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ export CFG_PREFIX
418418
export CFG_LIBDIR
419419
export CFG_RUSTLIBDIR
420420
export CFG_LIBDIR_RELATIVE
421+
export CFG_DISABLE_INJECT_STD_VERSION
421422

422423
######################################################################
423424
# Subprograms

configure

+2
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ opt clang 0 "prefer clang to gcc for building the runtime"
381381
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
382382
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
383383
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
384+
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
384385
valopt prefix "/usr/local" "set installation prefix"
385386
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
386387
valopt llvm-root "" "set LLVM root"
@@ -1042,6 +1043,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
10421043
putvar CFG_ANDROID_CROSS_PATH
10431044
putvar CFG_MINGW32_CROSS_PATH
10441045
putvar CFG_MANDIR
1046+
putvar CFG_DISABLE_INJECT_STD_VERSION
10451047

10461048
# Avoid spurious warnings from clang by feeding it original source on
10471049
# ccache-miss rather than preprocessed input.

src/libextra/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Rust extras are part of the standard Rust distribution.
2020
2121
*/
2222

23-
#[crate_id = "extra#0.10-pre"];
23+
// NOTE: upgrade to 0.10-pre after the next snapshot
24+
#[crate_id = "extra#0.9"];
2425
#[comment = "Rust extras"];
2526
#[license = "MIT/ASL2"];
2627
#[crate_type = "rlib"];

src/librustc/front/std_inject.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ use syntax::fold;
2121
use syntax::opt_vec;
2222
use syntax::util::small_vector::SmallVector;
2323

24+
// NOTE: upgrade to 0.10-pre after the next snapshot
25+
pub static VERSION: &'static str = "0.9";
26+
2427
pub fn maybe_inject_libstd_ref(sess: Session, crate: ast::Crate)
2528
-> ast::Crate {
2629
if use_std(&crate) {
@@ -53,11 +56,21 @@ struct StandardLibraryInjector {
5356
sess: Session,
5457
}
5558

59+
pub fn with_version(crate: &str) -> Option<(@str, ast::StrStyle)> {
60+
match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
61+
Some("1") => None,
62+
_ => {
63+
Some((format!("{}\\#{}", crate, VERSION).to_managed(),
64+
ast::CookedStr))
65+
}
66+
}
67+
}
68+
5669
impl fold::Folder for StandardLibraryInjector {
5770
fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
5871
let mut vis = ~[ast::ViewItem {
5972
node: ast::ViewItemExternMod(self.sess.ident_of("std"),
60-
None,
73+
with_version("std"),
6174
ast::DUMMY_NODE_ID),
6275
attrs: ~[],
6376
vis: ast::Private,
@@ -67,15 +80,15 @@ impl fold::Folder for StandardLibraryInjector {
6780
if use_uv(&crate) && !self.sess.building_library.get() {
6881
vis.push(ast::ViewItem {
6982
node: ast::ViewItemExternMod(self.sess.ident_of("green"),
70-
None,
83+
with_version("green"),
7184
ast::DUMMY_NODE_ID),
7285
attrs: ~[],
7386
vis: ast::Private,
7487
span: DUMMY_SP
7588
});
7689
vis.push(ast::ViewItem {
7790
node: ast::ViewItemExternMod(self.sess.ident_of("rustuv"),
78-
None,
91+
with_version("rustuv"),
7992
ast::DUMMY_NODE_ID),
8093
attrs: ~[],
8194
vis: ast::Private,

src/librustc/front/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use driver::session;
1515
use front::config;
16+
use front::std_inject::with_version;
1617

1718
use std::cell::RefCell;
1819
use std::vec;
@@ -292,7 +293,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
292293
ast::DUMMY_NODE_ID))])
293294
} else {
294295
ast::ViewItemExternMod(id_extra,
295-
None,
296+
with_version("extra"),
296297
ast::DUMMY_NODE_ID)
297298
};
298299
ast::ViewItem {

0 commit comments

Comments
 (0)