37
37
use crate :: spec:: abi:: { lookup as lookup_abi, Abi } ;
38
38
use rustc_serialize:: json:: { Json , ToJson } ;
39
39
use std:: collections:: BTreeMap ;
40
- use std:: default:: Default ;
41
40
use std:: path:: { Path , PathBuf } ;
42
41
use std:: str:: FromStr ;
43
42
use std:: { fmt, io} ;
@@ -60,18 +59,19 @@ mod l4re_base;
60
59
mod linux_base;
61
60
mod linux_kernel_base;
62
61
mod linux_musl_base;
62
+ mod msvc_base;
63
63
mod netbsd_base;
64
64
mod openbsd_base;
65
65
mod redox_base;
66
66
mod riscv_base;
67
67
mod solaris_base;
68
68
mod thumb_base;
69
- mod uefi_base ;
69
+ mod uefi_msvc_base ;
70
70
mod vxworks_base;
71
71
mod wasm32_base;
72
- mod windows_base ;
72
+ mod windows_gnu_base ;
73
73
mod windows_msvc_base;
74
- mod windows_uwp_base ;
74
+ mod windows_uwp_gnu_base ;
75
75
mod windows_uwp_msvc_base;
76
76
77
77
#[ derive( Clone , Copy , Debug , Eq , Ord , PartialEq , PartialOrd ) ]
@@ -309,23 +309,14 @@ macro_rules! supported_targets {
309
309
}
310
310
311
311
#[ cfg( test) ]
312
- mod test_json_encode_decode {
313
- use rustc_serialize:: json:: ToJson ;
314
- use super :: Target ;
315
- $( use super :: $module; ) +
312
+ mod tests {
313
+ mod tests_impl;
316
314
315
+ // Cannot put this into a separate file without duplication, make an exception.
317
316
$(
318
- #[ test] // `#[test]` - this is hard to put into a separate file, make an exception
317
+ #[ test] // `#[test]`
319
318
fn $module( ) {
320
- // Grab the TargetResult struct. If we successfully retrieved
321
- // a Target, then the test JSON encoding/decoding can run for this
322
- // Target on this testing platform (i.e., checking the iOS targets
323
- // only on a Mac test platform).
324
- let _ = $module:: target( ) . map( |original| {
325
- let as_json = original. to_json( ) ;
326
- let parsed = Target :: from_json( as_json) . unwrap( ) ;
327
- assert_eq!( original, parsed) ;
328
- } ) ;
319
+ tests_impl:: test_target( super :: $module:: target( ) ) ;
329
320
}
330
321
) +
331
322
}
@@ -538,7 +529,8 @@ pub struct Target {
538
529
pub arch : String ,
539
530
/// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM.
540
531
pub data_layout : String ,
541
- /// Linker flavor
532
+ /// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed
533
+ /// on the command line.
542
534
pub linker_flavor : LinkerFlavor ,
543
535
/// Optional settings with defaults.
544
536
pub options : TargetOptions ,
@@ -566,7 +558,8 @@ pub struct TargetOptions {
566
558
/// Linker to invoke
567
559
pub linker : Option < String > ,
568
560
569
- /// LLD flavor
561
+ /// LLD flavor used if `lld` (or `rust-lld`) is specified as a linker
562
+ /// without clarifying its flavor in any way.
570
563
pub lld_flavor : LldFlavor ,
571
564
572
565
/// Linker arguments that are passed *before* any user-defined libraries.
0 commit comments