File tree Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,7 @@ export CFG_PREFIX
418418export CFG_LIBDIR
419419export CFG_RUSTLIBDIR
420420export CFG_LIBDIR_RELATIVE
421+ export CFG_DISABLE_INJECT_STD_VERSION
421422
422423# #####################################################################
423424# Subprograms
Original file line number Diff line number Diff line change @@ -381,6 +381,7 @@ opt clang 0 "prefer clang to gcc for building the runtime"
381381opt ccache 0 " invoke gcc/clang via ccache to reuse object files between builds"
382382opt local-rust 0 " use an installed rustc rather than downloading a snapshot"
383383opt 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"
384385valopt prefix " /usr/local" " set installation prefix"
385386valopt local-rust-root " /usr/local" " set prefix for local rust binary"
386387valopt llvm-root " " " set LLVM root"
@@ -1042,6 +1043,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
10421043putvar CFG_ANDROID_CROSS_PATH
10431044putvar CFG_MINGW32_CROSS_PATH
10441045putvar 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.
Original file line number Diff line number Diff 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" ] ;
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ use syntax::fold;
2121use syntax:: opt_vec;
2222use 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+
2427pub 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+
5669impl 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 ,
Original file line number Diff line number Diff line change 1313
1414use driver:: session;
1515use front:: config;
16+ use front:: std_inject:: with_version;
1617
1718use std:: cell:: RefCell ;
1819use 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 {
You can’t perform that action at this time.
0 commit comments