@@ -54,7 +54,7 @@ pub enum OutputType {
54
54
OutputTypeExe ,
55
55
}
56
56
57
- pub fn llvm_err ( sess : Session , msg : ~str ) -> ! {
57
+ pub fn llvm_err ( sess : & Session , msg : ~str ) -> ! {
58
58
unsafe {
59
59
let cstr = llvm:: LLVMRustGetLastError ( ) ;
60
60
if cstr == ptr:: null ( ) {
@@ -68,7 +68,7 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
68
68
}
69
69
70
70
pub fn WriteOutputFile (
71
- sess : Session ,
71
+ sess : & Session ,
72
72
target : lib:: llvm:: TargetMachineRef ,
73
73
pm : lib:: llvm:: PassManagerRef ,
74
74
m : ModuleRef ,
@@ -125,7 +125,7 @@ pub mod write {
125
125
}
126
126
}
127
127
128
- pub fn run_passes ( sess : Session ,
128
+ pub fn run_passes ( sess : & Session ,
129
129
trans : & CrateTranslation ,
130
130
output_types : & [ OutputType ] ,
131
131
output : & OutputFilenames ) {
@@ -156,7 +156,7 @@ pub mod write {
156
156
157
157
let tm = sess. targ_cfg . target_strs . target_triple . with_c_str ( |t| {
158
158
sess. opts . cg . target_cpu . with_c_str ( |cpu| {
159
- target_feature ( & sess) . with_c_str ( |features| {
159
+ target_feature ( sess) . with_c_str ( |features| {
160
160
llvm:: LLVMRustCreateTargetMachine (
161
161
t, cpu, features,
162
162
lib:: llvm:: CodeModelDefault ,
@@ -323,7 +323,7 @@ pub mod write {
323
323
}
324
324
}
325
325
326
- pub fn run_assembler ( sess : Session , outputs : & OutputFilenames ) {
326
+ pub fn run_assembler ( sess : & Session , outputs : & OutputFilenames ) {
327
327
let cc = super :: get_cc_prog ( sess) ;
328
328
let assembly = outputs. temp_path ( OutputTypeAssembly ) ;
329
329
let object = outputs. path ( OutputTypeObject ) ;
@@ -351,7 +351,7 @@ pub mod write {
351
351
}
352
352
}
353
353
354
- unsafe fn configure_llvm ( sess : Session ) {
354
+ unsafe fn configure_llvm ( sess : & Session ) {
355
355
use sync:: one:: { Once , ONCE_INIT } ;
356
356
static mut INIT : Once = ONCE_INIT ;
357
357
@@ -719,7 +719,7 @@ pub fn output_lib_filename(id: &CrateId) -> ~str {
719
719
format ! ( "{}-{}-{}" , id. name, crate_id_hash( id) , id. version_or_default( ) )
720
720
}
721
721
722
- pub fn get_cc_prog ( sess : Session ) -> ~str {
722
+ pub fn get_cc_prog ( sess : & Session ) -> ~str {
723
723
match sess. opts . cg . linker {
724
724
Some ( ref linker) => return linker. to_owned ( ) ,
725
725
None => { }
@@ -737,7 +737,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
737
737
get_system_tool ( sess, "cc" )
738
738
}
739
739
740
- pub fn get_ar_prog ( sess : Session ) -> ~str {
740
+ pub fn get_ar_prog ( sess : & Session ) -> ~str {
741
741
match sess. opts . cg . ar {
742
742
Some ( ref ar) => return ar. to_owned ( ) ,
743
743
None => { }
@@ -746,7 +746,7 @@ pub fn get_ar_prog(sess: Session) -> ~str {
746
746
get_system_tool ( sess, "ar" )
747
747
}
748
748
749
- fn get_system_tool ( sess : Session , tool : & str ) -> ~str {
749
+ fn get_system_tool ( sess : & Session , tool : & str ) -> ~str {
750
750
match sess. targ_cfg . os {
751
751
abi:: OsAndroid => match sess. opts . cg . android_cross_path {
752
752
Some ( ref path) => {
@@ -765,7 +765,7 @@ fn get_system_tool(sess: Session, tool: &str) -> ~str {
765
765
}
766
766
}
767
767
768
- fn remove ( sess : Session , path : & Path ) {
768
+ fn remove ( sess : & Session , path : & Path ) {
769
769
match fs:: unlink ( path) {
770
770
Ok ( ..) => { }
771
771
Err ( e) => {
@@ -776,7 +776,7 @@ fn remove(sess: Session, path: &Path) {
776
776
777
777
/// Perform the linkage portion of the compilation phase. This will generate all
778
778
/// of the requested outputs for this compilation session.
779
- pub fn link_binary ( sess : Session ,
779
+ pub fn link_binary ( sess : & Session ,
780
780
trans : & CrateTranslation ,
781
781
outputs : & OutputFilenames ,
782
782
id : & CrateId ) -> Vec < Path > {
@@ -830,7 +830,7 @@ pub fn filename_for_input(sess: &Session, crate_type: session::CrateType,
830
830
}
831
831
}
832
832
833
- fn link_binary_output ( sess : Session ,
833
+ fn link_binary_output ( sess : & Session ,
834
834
trans : & CrateTranslation ,
835
835
crate_type : session:: CrateType ,
836
836
outputs : & OutputFilenames ,
@@ -840,7 +840,7 @@ fn link_binary_output(sess: Session,
840
840
Some ( ref file) => file. clone ( ) ,
841
841
None => {
842
842
let out_filename = outputs. path ( OutputTypeExe ) ;
843
- filename_for_input ( & sess, crate_type, id, & out_filename)
843
+ filename_for_input ( sess, crate_type, id, & out_filename)
844
844
}
845
845
} ;
846
846
@@ -883,10 +883,10 @@ fn link_binary_output(sess: Session,
883
883
// rlib primarily contains the object file of the crate, but it also contains
884
884
// all of the object files from native libraries. This is done by unzipping
885
885
// native libraries and inserting all of the contents into this archive.
886
- fn link_rlib ( sess : Session ,
887
- trans : Option < & CrateTranslation > , // None == no metadata/bytecode
888
- obj_filename : & Path ,
889
- out_filename : & Path ) -> Archive {
886
+ fn link_rlib < ' a > ( sess : & ' a Session ,
887
+ trans : Option < & CrateTranslation > , // None == no metadata/bytecode
888
+ obj_filename : & Path ,
889
+ out_filename : & Path ) -> Archive < ' a > {
890
890
let mut a = Archive :: create ( sess, out_filename, obj_filename) ;
891
891
892
892
let used_libraries = sess. cstore . get_used_libraries ( ) ;
@@ -985,7 +985,7 @@ fn link_rlib(sess: Session,
985
985
// There's no need to include metadata in a static archive, so ensure to not
986
986
// link in the metadata object file (and also don't prepare the archive with a
987
987
// metadata file).
988
- fn link_staticlib ( sess : Session , obj_filename : & Path , out_filename : & Path ) {
988
+ fn link_staticlib ( sess : & Session , obj_filename : & Path , out_filename : & Path ) {
989
989
let mut a = link_rlib ( sess, None , obj_filename, out_filename) ;
990
990
a. add_native_library ( "morestack" ) . unwrap ( ) ;
991
991
a. add_native_library ( "compiler-rt" ) . unwrap ( ) ;
@@ -1016,7 +1016,7 @@ fn link_staticlib(sess: Session, obj_filename: &Path, out_filename: &Path) {
1016
1016
//
1017
1017
// This will invoke the system linker/cc to create the resulting file. This
1018
1018
// links to all upstream files as well.
1019
- fn link_natively ( sess : Session , dylib : bool , obj_filename : & Path ,
1019
+ fn link_natively ( sess : & Session , dylib : bool , obj_filename : & Path ,
1020
1020
out_filename : & Path ) {
1021
1021
let tmpdir = TempDir :: new ( "rustc" ) . expect ( "needs a temp dir" ) ;
1022
1022
// The invocations of cc share some flags across platforms
@@ -1066,7 +1066,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
1066
1066
}
1067
1067
}
1068
1068
1069
- fn link_args( sess : Session ,
1069
+ fn link_args( sess : & Session ,
1070
1070
dylib : bool ,
1071
1071
tmpdir : & Path ,
1072
1072
obj_filename : & Path ,
@@ -1248,7 +1248,7 @@ fn link_args(sess: Session,
1248
1248
// Also note that the native libraries linked here are only the ones located
1249
1249
// in the current crate. Upstream crates with native library dependencies
1250
1250
// may have their native library pulled in above.
1251
- fn add_local_native_libraries ( args : & mut Vec < ~str > , sess : Session ) {
1251
+ fn add_local_native_libraries ( args : & mut Vec < ~str > , sess : & Session ) {
1252
1252
let addl_lib_search_paths = sess. opts . addl_lib_search_paths . borrow ( ) ;
1253
1253
for path in addl_lib_search_paths. get ( ) . iter ( ) {
1254
1254
// FIXME (#9639): This needs to handle non-utf8 paths
@@ -1281,7 +1281,7 @@ fn add_local_native_libraries(args: &mut Vec<~str> , sess: Session) {
1281
1281
// Rust crates are not considered at all when creating an rlib output. All
1282
1282
// dependencies will be linked when producing the final output (instead of
1283
1283
// the intermediate rlib version)
1284
- fn add_upstream_rust_crates ( args : & mut Vec < ~str > , sess : Session ,
1284
+ fn add_upstream_rust_crates ( args : & mut Vec < ~str > , sess : & Session ,
1285
1285
dylib : bool , tmpdir : & Path ) {
1286
1286
1287
1287
// As a limitation of the current implementation, we require that everything
@@ -1376,8 +1376,8 @@ fn add_upstream_rust_crates(args: &mut Vec<~str> , sess: Session,
1376
1376
}
1377
1377
1378
1378
// Adds the static "rlib" versions of all crates to the command line.
1379
- fn add_static_crates ( args : & mut Vec < ~str > , sess : Session , tmpdir : & Path ,
1380
- crates : Vec < ( ast:: CrateNum , Path ) > ) {
1379
+ fn add_static_crates ( args : & mut Vec < ~str > , sess : & Session , tmpdir : & Path ,
1380
+ crates : Vec < ( ast:: CrateNum , Path ) > ) {
1381
1381
for ( cnum, cratepath) in crates. move_iter ( ) {
1382
1382
// When performing LTO on an executable output, all of the
1383
1383
// bytecode from the upstream libraries has already been
@@ -1423,7 +1423,7 @@ fn add_upstream_rust_crates(args: &mut Vec<~str> , sess: Session,
1423
1423
}
1424
1424
1425
1425
// Same thing as above, but for dynamic crates instead of static crates.
1426
- fn add_dynamic_crates ( args : & mut Vec < ~str > , sess : Session ,
1426
+ fn add_dynamic_crates ( args : & mut Vec < ~str > , sess : & Session ,
1427
1427
crates : Vec < ( ast:: CrateNum , Path ) > ) {
1428
1428
// If we're performing LTO, then it should have been previously required
1429
1429
// that all upstream rust dependencies were available in an rlib format.
@@ -1458,7 +1458,7 @@ fn add_upstream_rust_crates(args: &mut Vec<~str> , sess: Session,
1458
1458
// generic function calls a native function, then the generic function must
1459
1459
// be instantiated in the target crate, meaning that the native symbol must
1460
1460
// also be resolved in the target crate.
1461
- fn add_upstream_native_libraries ( args : & mut Vec < ~str > , sess : Session ) {
1461
+ fn add_upstream_native_libraries ( args : & mut Vec < ~str > , sess : & Session ) {
1462
1462
let cstore = sess. cstore ;
1463
1463
cstore. iter_crate_data ( |cnum, _| {
1464
1464
let libs = csearch:: get_native_libraries ( cstore, cnum) ;
0 commit comments