Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run format.
  • Loading branch information
12101111 committed Mar 3, 2020
commit 7996df992fba0b7e09215843fcfabc0c53828c57
3 changes: 2 additions & 1 deletion src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(
let more_args = &sess.opts.cg.link_arg;
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;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_codegen_utils/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ pub fn invalid_output_for_target(sess: &Session, crate_type: config::CrateType)
if !sess.target.target.options.dynamic_linking {
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;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_metadata/dependency_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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
}
config::CrateType::Executable => Linkage::Dynamic,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_session/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ impl Session {
Some(config::CrateType::ProcMacro) => found_positive,
Some(_) => !found_negative,
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 can't check `#![crate_type = "proc-macro"]` here.
if self.opts.crate_types.contains(&config::CrateType::ProcMacro) {
Expand Down