1
Fork 0

Run format.

This commit is contained in:
12101111 2020-03-03 16:29:44 +08:00
parent 7ca1b2f504
commit 7996df992f
4 changed files with 9 additions and 4 deletions

View file

@ -1288,7 +1288,8 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(
let more_args = &sess.opts.cg.link_arg; let more_args = &sess.opts.cg.link_arg;
let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter()); let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter());
if is_pic(sess) && !sess.crt_static(Some(crate_type)) && !args.any(|x| *x == "-static") { if is_pic(sess) && !sess.crt_static(Some(crate_type)) && !args.any(|x| *x == "-static")
{
position_independent_executable = true; position_independent_executable = true;
} }
} }

View file

@ -167,7 +167,9 @@ pub fn invalid_output_for_target(sess: &Session, crate_type: config::CrateType)
if !sess.target.target.options.dynamic_linking { if !sess.target.target.options.dynamic_linking {
return true; return true;
} }
if sess.crt_static(Some(crate_type)) && !sess.target.target.options.crt_static_allows_dylibs { if sess.crt_static(Some(crate_type))
&& !sess.target.target.options.crt_static_allows_dylibs
{
return true; return true;
} }
} }

View file

@ -97,7 +97,9 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: config::CrateType) -> DependencyList {
// If the global prefer_dynamic switch is turned off, or the final // If the global prefer_dynamic switch is turned off, or the final
// executable will be statically linked, prefer static crate linkage. // executable will be statically linked, prefer static crate linkage.
config::CrateType::Executable if !sess.opts.cg.prefer_dynamic || sess.crt_static(Some(ty)) => { config::CrateType::Executable
if !sess.opts.cg.prefer_dynamic || sess.crt_static(Some(ty)) =>
{
Linkage::Static Linkage::Static
} }
config::CrateType::Executable => Linkage::Dynamic, config::CrateType::Executable => Linkage::Dynamic,

View file

@ -564,7 +564,7 @@ impl Session {
Some(config::CrateType::ProcMacro) => found_positive, Some(config::CrateType::ProcMacro) => found_positive,
Some(_) => !found_negative, Some(_) => !found_negative,
None => { None => {
// FIXME: When crate_type is not available, // FIXME: When crate_type is not available,
// we use compiler options to determine the crate_type. // we use compiler options to determine the crate_type.
// We can't check `#![crate_type = "proc-macro"]` here. // We can't check `#![crate_type = "proc-macro"]` here.
if self.opts.crate_types.contains(&config::CrateType::ProcMacro) { if self.opts.crate_types.contains(&config::CrateType::ProcMacro) {