Skip to content

Commit 1be7f96

Browse files
Rename is_translated_fn query to is_translated_item and make it support statics.
1 parent 8ff633c commit 1be7f96

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ define_dep_nodes!( <'tcx>
625625
[eval_always] CollectAndPartitionTranslationItems,
626626
[] ExportName(DefId),
627627
[] ContainsExternIndicator(DefId),
628-
[] IsTranslatedFunction(DefId),
628+
[] IsTranslatedItem(DefId),
629629
[] CodegenUnit(InternedString),
630630
[] CompileCodegenUnit(InternedString),
631631
[input] OutputFilenames,

src/librustc/ty/maps/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ define_maps! { <'tcx>
349349
[] fn export_name: ExportName(DefId) -> Option<Symbol>,
350350
[] fn contains_extern_indicator: ContainsExternIndicator(DefId) -> bool,
351351
[] fn symbol_export_level: GetSymbolExportLevel(DefId) -> SymbolExportLevel,
352-
[] fn is_translated_function: IsTranslatedFunction(DefId) -> bool,
352+
[] fn is_translated_item: IsTranslatedItem(DefId) -> bool,
353353
[] fn codegen_unit: CodegenUnit(InternedString) -> Arc<CodegenUnit<'tcx>>,
354354
[] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
355355
[] fn output_filenames: output_filenames_node(CrateNum)

src/librustc/ty/maps/plumbing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
929929
DepKind::ContainsExternIndicator => {
930930
force!(contains_extern_indicator, def_id!());
931931
}
932-
DepKind::IsTranslatedFunction => { force!(is_translated_function, def_id!()); }
932+
DepKind::IsTranslatedItem => { force!(is_translated_item, def_id!()); }
933933
DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); }
934934

935935
DepKind::TargetFeaturesWhitelist => { force!(target_features_whitelist, LOCAL_CRATE); }

src/librustc_trans/base.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>(
10041004
let translation_items: DefIdSet = items.iter().filter_map(|trans_item| {
10051005
match *trans_item {
10061006
MonoItem::Fn(ref instance) => Some(instance.def_id()),
1007+
MonoItem::Static(def_id) => Some(def_id),
10071008
_ => None,
10081009
}
10091010
}).collect();
@@ -1107,7 +1108,7 @@ impl CrateInfo {
11071108
}
11081109
}
11091110

1110-
fn is_translated_function(tcx: TyCtxt, id: DefId) -> bool {
1111+
fn is_translated_item(tcx: TyCtxt, id: DefId) -> bool {
11111112
let (all_trans_items, _) =
11121113
tcx.collect_and_partition_translation_items(LOCAL_CRATE);
11131114
all_trans_items.contains(&id)
@@ -1222,7 +1223,7 @@ pub fn provide(providers: &mut Providers) {
12221223
providers.collect_and_partition_translation_items =
12231224
collect_and_partition_translation_items;
12241225

1225-
providers.is_translated_function = is_translated_function;
1226+
providers.is_translated_item = is_translated_item;
12261227

12271228
providers.codegen_unit = |tcx, name| {
12281229
let (_, all) = tcx.collect_and_partition_translation_items(LOCAL_CRATE);

src/librustc_trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub fn get_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
149149
unsafe {
150150
llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage);
151151

152-
if cx.tcx.is_translated_function(instance_def_id) {
152+
if cx.tcx.is_translated_item(instance_def_id) {
153153
if instance_def_id.is_local() {
154154
if !cx.tcx.is_exported_symbol(instance_def_id) {
155155
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);

0 commit comments

Comments
 (0)