Skip to content

Commit 60b785f

Browse files
committed
Mark #[rustc_std_internal_symbol] as extern indicator
It currently implies #[no_mangle] which is alread an extern indicator, but this will change in a future commit.
1 parent 98b9d02 commit 60b785f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ impl CodegenFnAttrs {
174174
/// * `#[linkage]` is present
175175
pub fn contains_extern_indicator(&self) -> bool {
176176
self.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
177+
|| self.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
177178
|| self.export_name.is_some()
178179
|| match self.linkage {
179180
// These are private, so make sure we don't try to consider

compiler/rustc_passes/src/reachable.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ impl<'tcx> ReachableContext<'tcx> {
184184
CodegenFnAttrs::EMPTY
185185
};
186186
let is_extern = codegen_attrs.contains_extern_indicator();
187-
let std_internal =
188-
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
189-
if is_extern || std_internal {
187+
if is_extern {
190188
self.reachable_symbols.insert(search_item);
191189
}
192190
} else {
@@ -426,7 +424,6 @@ fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
426424
}
427425
let codegen_attrs = tcx.codegen_fn_attrs(def_id);
428426
codegen_attrs.contains_extern_indicator()
429-
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
430427
// FIXME(nbdd0121): `#[used]` are marked as reachable here so it's picked up by
431428
// `linked_symbols` in cg_ssa. They won't be exported in binary or cdylib due to their
432429
// `SymbolExportLevel::Rust` export level but may end up being exported in dylibs.

0 commit comments

Comments
 (0)