File tree 5 files changed +23
-5
lines changed
5 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,7 @@ export CFG_PREFIX
418
418
export CFG_LIBDIR
419
419
export CFG_RUSTLIBDIR
420
420
export CFG_LIBDIR_RELATIVE
421
+ export CFG_DISABLE_INJECT_STD_VERSION
421
422
422
423
# #####################################################################
423
424
# 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"
381
381
opt ccache 0 " invoke gcc/clang via ccache to reuse object files between builds"
382
382
opt local-rust 0 " use an installed rustc rather than downloading a snapshot"
383
383
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"
384
385
valopt prefix " /usr/local" " set installation prefix"
385
386
valopt local-rust-root " /usr/local" " set prefix for local rust binary"
386
387
valopt llvm-root " " " set LLVM root"
@@ -1042,6 +1043,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
1042
1043
putvar CFG_ANDROID_CROSS_PATH
1043
1044
putvar CFG_MINGW32_CROSS_PATH
1044
1045
putvar CFG_MANDIR
1046
+ putvar CFG_DISABLE_INJECT_STD_VERSION
1045
1047
1046
1048
# Avoid spurious warnings from clang by feeding it original source on
1047
1049
# 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.
20
20
21
21
*/
22
22
23
- #[ crate_id = "extra#0.10-pre" ] ;
23
+ // NOTE: upgrade to 0.10-pre after the next snapshot
24
+ #[ crate_id = "extra#0.9" ] ;
24
25
#[ comment = "Rust extras" ] ;
25
26
#[ license = "MIT/ASL2" ] ;
26
27
#[ crate_type = "rlib" ] ;
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ use syntax::fold;
21
21
use syntax:: opt_vec;
22
22
use syntax:: util:: small_vector:: SmallVector ;
23
23
24
+ // NOTE: upgrade to 0.10-pre after the next snapshot
25
+ pub static VERSION : & ' static str = "0.9" ;
26
+
24
27
pub fn maybe_inject_libstd_ref ( sess : Session , crate : ast:: Crate )
25
28
-> ast:: Crate {
26
29
if use_std ( & crate ) {
@@ -53,11 +56,21 @@ struct StandardLibraryInjector {
53
56
sess : Session ,
54
57
}
55
58
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
+
56
69
impl fold:: Folder for StandardLibraryInjector {
57
70
fn fold_crate ( & mut self , crate : ast:: Crate ) -> ast:: Crate {
58
71
let mut vis = ~[ ast:: ViewItem {
59
72
node : ast:: ViewItemExternMod ( self . sess . ident_of ( "std" ) ,
60
- None ,
73
+ with_version ( "std" ) ,
61
74
ast:: DUMMY_NODE_ID ) ,
62
75
attrs : ~[ ] ,
63
76
vis : ast:: Private ,
@@ -67,15 +80,15 @@ impl fold::Folder for StandardLibraryInjector {
67
80
if use_uv ( & crate ) && !self . sess . building_library . get ( ) {
68
81
vis. push ( ast:: ViewItem {
69
82
node : ast:: ViewItemExternMod ( self . sess . ident_of ( "green" ) ,
70
- None ,
83
+ with_version ( "green" ) ,
71
84
ast:: DUMMY_NODE_ID ) ,
72
85
attrs : ~[ ] ,
73
86
vis : ast:: Private ,
74
87
span : DUMMY_SP
75
88
} ) ;
76
89
vis. push ( ast:: ViewItem {
77
90
node : ast:: ViewItemExternMod ( self . sess . ident_of ( "rustuv" ) ,
78
- None ,
91
+ with_version ( "rustuv" ) ,
79
92
ast:: DUMMY_NODE_ID ) ,
80
93
attrs : ~[ ] ,
81
94
vis : ast:: Private ,
Original file line number Diff line number Diff line change 13
13
14
14
use driver:: session;
15
15
use front:: config;
16
+ use front:: std_inject:: with_version;
16
17
17
18
use std:: cell:: RefCell ;
18
19
use std:: vec;
@@ -292,7 +293,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
292
293
ast:: DUMMY_NODE_ID ) ) ] )
293
294
} else {
294
295
ast:: ViewItemExternMod ( id_extra,
295
- None ,
296
+ with_version ( "extra" ) ,
296
297
ast:: DUMMY_NODE_ID )
297
298
} ;
298
299
ast:: ViewItem {
You can’t perform that action at this time.
0 commit comments