From c3140e7eeb151130a6ce73e27e96398348898d3d Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Mon, 24 May 2021 23:58:20 +0200 Subject: [PATCH 1/9] Only register `WSACleanup` if `WSAStartup` is actually ever called --- library/std/src/sys/windows/net.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs index 1ad13254c0846..1e1a02189dc79 100644 --- a/library/std/src/sys/windows/net.rs +++ b/library/std/src/sys/windows/net.rs @@ -2,10 +2,10 @@ use crate::cmp; use crate::io::{self, IoSlice, IoSliceMut, Read}; +use crate::lazy::SyncOnceCell; use crate::mem; use crate::net::{Shutdown, SocketAddr}; use crate::ptr; -use crate::sync::Once; use crate::sys; use crate::sys::c; use crate::sys_common::net; @@ -26,26 +26,31 @@ pub mod netc { pub struct Socket(c::SOCKET); -static INIT: Once = Once::new(); +static WSA: SyncOnceCell i32> = SyncOnceCell::new(); /// Checks whether the Windows socket interface has been started already, and /// if not, starts it. pub fn init() { - INIT.call_once(|| unsafe { + let _ = WSA.get_or_init(|| unsafe { let mut data: c::WSADATA = mem::zeroed(); let ret = c::WSAStartup( 0x202, // version 2.2 &mut data, ); assert_eq!(ret, 0); + + // Only register `WSACleanup` if `WSAStartup` is actually ever called. + // Workaround to prevent linking to `WS2_32.dll` when no network functionality is used. + // See issue #85441. + c::WSACleanup }); } pub fn cleanup() { - if INIT.is_completed() { - // only close the socket interface if it has actually been started + // only perform cleanup if network functionality was actually initialized + if let Some(cleanup) = WSA.get() { unsafe { - c::WSACleanup(); + cleanup(); } } } From f798596a6c22ca6b6bead70cfd1ced38f79df10e Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Tue, 25 May 2021 00:05:18 +0200 Subject: [PATCH 2/9] Add test for checking if WS2_32.dll is linked --- src/test/run-make/issue-85441/Makefile | 9 +++++++++ src/test/run-make/issue-85441/empty.rs | 1 + 2 files changed, 10 insertions(+) create mode 100644 src/test/run-make/issue-85441/Makefile create mode 100644 src/test/run-make/issue-85441/empty.rs diff --git a/src/test/run-make/issue-85441/Makefile b/src/test/run-make/issue-85441/Makefile new file mode 100644 index 0000000000000..0de956d3aee52 --- /dev/null +++ b/src/test/run-make/issue-85441/Makefile @@ -0,0 +1,9 @@ +# only-windows + +-include ../../run-make-fulldeps/tools.mk + +# Tests that WS2_32.dll is not unnecessarily linked, see issue #85441 + +all: + $(RUSTC) empty.rs + objdump -p $(TMPDIR)/empty.exe | $(CGREP) -v -i "WS2_32.dll" diff --git a/src/test/run-make/issue-85441/empty.rs b/src/test/run-make/issue-85441/empty.rs new file mode 100644 index 0000000000000..f328e4d9d04c3 --- /dev/null +++ b/src/test/run-make/issue-85441/empty.rs @@ -0,0 +1 @@ +fn main() {} From 0933fbd05a96d5685a6b47e5feeeb128d7daa2bf Mon Sep 17 00:00:00 2001 From: LingMan Date: Tue, 1 Jun 2021 21:07:07 +0200 Subject: [PATCH 3/9] Use `Iterator::any` and `filter_map` instead of open-coding them --- compiler/rustc_lint/src/types.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 9c94bab04e98f..8e7706758b68a 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -712,15 +712,10 @@ fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKi return false; } - for variant in &def.variants { - if let Some(field) = transparent_newtype_field(cx.tcx, variant) { - if ty_is_known_nonnull(cx, field.ty(tcx, substs), mode) { - return true; - } - } - } - - false + def.variants + .iter() + .filter_map(|variant| transparent_newtype_field(cx.tcx, variant)) + .any(|field| ty_is_known_nonnull(cx, field.ty(tcx, substs), mode)) } _ => false, } From 59b6583287eb90598af98d916aaed617b148b4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 2 Jun 2021 00:00:00 +0000 Subject: [PATCH 4/9] Remove unused support for `VarDebugInfo` This code has been dead since changes in 68961. --- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 37 ++----------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index 38e928145a816..a5aa170deced9 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -7,9 +7,7 @@ use rustc_data_structures::graph::dominators::Dominators; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir::traversal; -use rustc_middle::mir::visit::{ - MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext, Visitor, -}; +use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor}; use rustc_middle::mir::{self, Location, TerminatorKind}; use rustc_middle::ty; use rustc_middle::ty::layout::HasTyCtxt; @@ -21,7 +19,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( let mir = fx.mir; let mut analyzer = LocalAnalyzer::new(fx); - analyzer.visit_body(&mir); + for (bb, data) in mir.basic_blocks().iter_enumerated() { + analyzer.visit_basic_block_data(bb, data); + } for (local, decl) in mir.local_decls.iter_enumerated() { let ty = fx.monomorphize(decl.ty); @@ -142,36 +142,7 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { if let mir::ProjectionElem::Deref = elem { // Deref projections typically only read the pointer. - // (the exception being `VarDebugInfo` contexts, handled below) base_context = PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy); - - // Indirect debuginfo requires going through memory, that only - // the debugger accesses, following our emitted DWARF pointer ops. - // - // FIXME(eddyb) Investigate the possibility of relaxing this, but - // note that `llvm.dbg.declare` *must* be used for indirect places, - // even if we start using `llvm.dbg.value` for all other cases, - // as we don't necessarily know when the value changes, but only - // where it lives in memory. - // - // It's possible `llvm.dbg.declare` could support starting from - // a pointer that doesn't point to an `alloca`, but this would - // only be useful if we know the pointer being `Deref`'d comes - // from an immutable place, and if `llvm.dbg.declare` calls - // must be at the very start of the function, then only function - // arguments could contain such pointers. - if context == PlaceContext::NonUse(NonUseContext::VarDebugInfo) { - // We use `NonUseContext::VarDebugInfo` for the base, - // which might not force the base local to memory, - // so we have to do it manually. - self.visit_local(&place_ref.local, context, location); - } - } - - // `NonUseContext::VarDebugInfo` needs to flow all the - // way down to the base local (see `visit_local`). - if context == PlaceContext::NonUse(NonUseContext::VarDebugInfo) { - base_context = context; } self.process_place(&place_base, base_context, location); From 624c693508e94de2c962a4341d843313e5837511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Thu, 3 Jun 2021 00:00:00 +0000 Subject: [PATCH 5/9] Remove check for projections in a branch without any The else branch is taken when projection slice is empty so everything except for the call to the `visit_local` is a dead code. --- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index a5aa170deced9..a040c3d7de147 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -157,20 +157,7 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { ); } } else { - // FIXME this is super_place code, is repeated here to avoid cloning place or changing - // visit_place API - let mut context = context; - - if !place_ref.projection.is_empty() { - context = if context.is_mutating_use() { - PlaceContext::MutatingUse(MutatingUseContext::Projection) - } else { - PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) - }; - } - self.visit_local(&place_ref.local, context, location); - self.visit_projection(*place_ref, context, location); } } } From d9630848d7a4a6478108f79ae0ce6028570dc732 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sat, 5 Jun 2021 21:10:08 +0800 Subject: [PATCH 6/9] Remove `_` from E0121 diagnostic suggestions --- compiler/rustc_typeck/src/collect/type_of.rs | 2 +- src/test/ui/error-codes/E0121.stderr | 2 +- .../issue-69396-const-no-type-in-macro.stderr | 2 +- ...typeck_type_placeholder_item.full_tait.stderr | 16 ++++++++-------- .../typeck_type_placeholder_item.min_tait.stderr | 16 ++++++++-------- .../typeck_type_placeholder_item_help.stderr | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index 5197b620f90ba..19c35ebd011b1 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -766,7 +766,7 @@ fn infer_placeholder_type( if !ty.references_error() { diag.span_suggestion( span, - "replace `_` with the correct type", + "replace with the correct type", ty.to_string(), Applicability::MaybeIncorrect, ); diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index ad854837ae5bd..246f69558ff0d 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -14,7 +14,7 @@ LL | static BAR: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr index 6a744812e41d1..a84c048fab967 100644 --- a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -37,7 +37,7 @@ LL | const A = "A".$fn(); | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `bool` + | help: replace with the correct type: `bool` ... LL | / suite! { LL | | len; diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr index 75e4cb3e2d819..bd7cbd444d704 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.full_tait.stderr @@ -79,7 +79,7 @@ LL | static TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:19:15 @@ -88,7 +88,7 @@ LL | static TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:22:15 @@ -210,7 +210,7 @@ LL | static B: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:80:15 @@ -244,7 +244,7 @@ LL | static FN_TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:92:22 @@ -253,7 +253,7 @@ LL | static FN_TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:95:22 @@ -435,7 +435,7 @@ LL | const _: Option<_> = map(value); | ^^^^^^^^^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -526,7 +526,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:201:26 @@ -639,7 +639,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 69 previous errors; 1 warning emitted diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr index c6758c52a914e..afd6aaf4e55ab 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.min_tait.stderr @@ -70,7 +70,7 @@ LL | static TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:19:15 @@ -79,7 +79,7 @@ LL | static TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:22:15 @@ -201,7 +201,7 @@ LL | static B: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:80:15 @@ -235,7 +235,7 @@ LL | static FN_TEST3: _ = "test"; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `&str` + | help: replace with the correct type: `&str` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:92:22 @@ -244,7 +244,7 @@ LL | static FN_TEST4: _ = 145; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:95:22 @@ -426,7 +426,7 @@ LL | const _: Option<_> = map(value); | ^^^^^^^^^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -517,7 +517,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item.rs:201:26 @@ -630,7 +630,7 @@ LL | const D: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 69 previous errors diff --git a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr index f868c8d483486..2b64df774b08f 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -14,7 +14,7 @@ LL | const TEST2: _ = 42u32; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `u32` + | help: replace with the correct type: `u32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:10:14 @@ -23,7 +23,7 @@ LL | const TEST3: _ = Some(42); | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `Option` + | help: replace with the correct type: `Option` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:13:22 @@ -38,7 +38,7 @@ LL | const TEST5: _ = 42; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/typeck_type_placeholder_item_help.rs:24:18 @@ -47,7 +47,7 @@ LL | const TEST6: _ = 13; | ^ | | | not allowed in type signatures - | help: replace `_` with the correct type: `i32` + | help: replace with the correct type: `i32` error: aborting due to 6 previous errors From c01bd560e2f87a9a960ed071213edd70f73171a8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 5 Jun 2021 23:03:54 +0200 Subject: [PATCH 7/9] Fix display for search results --- src/librustdoc/html/static/rustdoc.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index d3f8a7aa67dd7..578e8ce5acbef 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -800,6 +800,8 @@ a { .search-results .result-name > span { display: inline-block; + margin: 0; + font-weight: normal; } body.blur > :not(#help) { From a26f00357f95f6affba7917e00e02152b1b24210 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Fri, 4 Jun 2021 19:47:28 -0700 Subject: [PATCH 8/9] Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}. --- .../rustc_codegen_cranelift/src/toolchain.rs | 90 +------------------ compiler/rustc_codegen_ssa/src/back/link.rs | 3 +- 2 files changed, 3 insertions(+), 90 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/toolchain.rs b/compiler/rustc_codegen_cranelift/src/toolchain.rs index 49475fe2469ed..f86236ef3eafc 100644 --- a/compiler/rustc_codegen_cranelift/src/toolchain.rs +++ b/compiler/rustc_codegen_cranelift/src/toolchain.rs @@ -2,9 +2,8 @@ use std::path::PathBuf; -use rustc_middle::bug; +use rustc_codegen_ssa::back::link::linker_and_flavor; use rustc_session::Session; -use rustc_target::spec::LinkerFlavor; /// Tries to infer the path of a binary for the target toolchain from the linker name. pub(crate) fn get_toolchain_binary(sess: &Session, tool: &str) -> PathBuf { @@ -30,90 +29,3 @@ pub(crate) fn get_toolchain_binary(sess: &Session, tool: &str) -> PathBuf { linker } - -// Adapted from https://github.com/rust-lang/rust/blob/5db778affee7c6600c8e7a177c48282dab3f6292/src/librustc_codegen_ssa/back/link.rs#L848-L931 -fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { - fn infer_from( - sess: &Session, - linker: Option, - flavor: Option, - ) -> Option<(PathBuf, LinkerFlavor)> { - match (linker, flavor) { - (Some(linker), Some(flavor)) => Some((linker, flavor)), - // only the linker flavor is known; use the default linker for the selected flavor - (None, Some(flavor)) => Some(( - PathBuf::from(match flavor { - LinkerFlavor::Em => { - if cfg!(windows) { - "emcc.bat" - } else { - "emcc" - } - } - LinkerFlavor::Gcc => { - if cfg!(any(target_os = "solaris", target_os = "illumos")) { - // On historical Solaris systems, "cc" may have - // been Sun Studio, which is not flag-compatible - // with "gcc". This history casts a long shadow, - // and many modern illumos distributions today - // ship GCC as "gcc" without also making it - // available as "cc". - "gcc" - } else { - "cc" - } - } - LinkerFlavor::Ld => "ld", - LinkerFlavor::Msvc => "link.exe", - LinkerFlavor::Lld(_) => "lld", - LinkerFlavor::PtxLinker => "rust-ptx-linker", - LinkerFlavor::BpfLinker => "bpf-linker", - }), - flavor, - )), - (Some(linker), None) => { - let stem = linker.file_stem().and_then(|stem| stem.to_str()).unwrap_or_else(|| { - sess.fatal("couldn't extract file stem from specified linker") - }); - - let flavor = if stem == "emcc" { - LinkerFlavor::Em - } else if stem == "gcc" - || stem.ends_with("-gcc") - || stem == "clang" - || stem.ends_with("-clang") - { - LinkerFlavor::Gcc - } else if stem == "ld" || stem == "ld.lld" || stem.ends_with("-ld") { - LinkerFlavor::Ld - } else if stem == "link" || stem == "lld-link" { - LinkerFlavor::Msvc - } else if stem == "lld" || stem == "rust-lld" { - LinkerFlavor::Lld(sess.target.lld_flavor) - } else { - // fall back to the value in the target spec - sess.target.linker_flavor - }; - - Some((linker, flavor)) - } - (None, None) => None, - } - } - - // linker and linker flavor specified via command line have precedence over what the target - // specification specifies - if let Some(ret) = infer_from(sess, sess.opts.cg.linker.clone(), sess.opts.cg.linker_flavor) { - return ret; - } - - if let Some(ret) = infer_from( - sess, - sess.target.linker.clone().map(PathBuf::from), - Some(sess.target.linker_flavor), - ) { - return ret; - } - - bug!("Not enough information provided to determine how to invoke the linker"); -} diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 9a66d01625246..7a05eba8025bc 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1089,7 +1089,8 @@ pub fn ignored_for_lto(sess: &Session, info: &CrateInfo, cnum: CrateNum) -> bool && (info.compiler_builtins == Some(cnum) || info.is_no_builtins.contains(&cnum)) } -fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { +// This functions tries to determine the appropriate linker (and corresponding LinkerFlavor) to use +pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { fn infer_from( sess: &Session, linker: Option, From 31eee595cf317d5a328356232016c8504dad9292 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Sun, 6 Jun 2021 22:54:00 +0200 Subject: [PATCH 9/9] Fix corrected example in E0759.md --- compiler/rustc_error_codes/src/error_codes/E0759.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0759.md b/compiler/rustc_error_codes/src/error_codes/E0759.md index 2fe5ada257fc2..6b16a7d415aa6 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0759.md +++ b/compiler/rustc_error_codes/src/error_codes/E0759.md @@ -16,13 +16,13 @@ fn bar(x: &i32) -> Box { // error! Add `'static` requirement to fix them: -```compile_fail,E0759 +``` # use std::fmt::Debug; -fn foo(x: &i32) -> impl Debug + 'static { // ok! +fn foo(x: &'static i32) -> impl Debug + 'static { // ok! x } -fn bar(x: &i32) -> Box { // ok! +fn bar(x: &'static i32) -> Box { // ok! Box::new(x) } ```