Skip to content

Commit e4375b1

Browse files
committed
Remove long-obsolete is_blocklisted_fn mechanism.
1 parent 369122e commit e4375b1

File tree

3 files changed

+2
-62
lines changed

3 files changed

+2
-62
lines changed

crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ impl<'tcx> CodegenCx<'tcx> {
7676
other => bug!("fn_abi type {}", other.debug(function_type, self)),
7777
};
7878

79-
if crate::is_blocklisted_fn(self.tcx, &self.sym, instance) {
80-
// This can happen if we call a blocklisted function in another crate.
81-
let result = self.undef(function_type);
82-
self.zombie_with_span(result.def_cx(self), span, "called blocklisted fn");
83-
return result;
84-
}
8579
let fn_id = {
8680
let mut emit = self.emit_global();
8781
let fn_id = emit

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
157157
use rustc_middle::mir::mono::{MonoItem, MonoItemData};
158158
use rustc_middle::mir::pretty::write_mir_pretty;
159159
use rustc_middle::ty::print::with_no_trimmed_paths;
160-
use rustc_middle::ty::{self, Instance, InstanceKind, TyCtxt};
160+
use rustc_middle::ty::{InstanceKind, TyCtxt};
161161
use rustc_session::Session;
162162
use rustc_session::config::{self, OutputFilenames, OutputType};
163-
use rustc_span::symbol::{Symbol, sym};
163+
use rustc_span::symbol::Symbol;
164164
use std::any::Any;
165165
use std::fs::{File, create_dir_all};
166166
use std::io::Cursor;
@@ -184,45 +184,6 @@ fn dump_mir(tcx: TyCtxt<'_>, mono_items: &[(MonoItem<'_>, MonoItemData)], path:
184184
}
185185
}
186186

187-
fn is_blocklisted_fn<'tcx>(
188-
tcx: TyCtxt<'tcx>,
189-
sym: &symbols::Symbols,
190-
instance: Instance<'tcx>,
191-
) -> bool {
192-
// TODO: These sometimes have a constant value of an enum variant with a hole
193-
if let InstanceKind::Item(def_id) = instance.def {
194-
if let Some(debug_trait_def_id) = tcx.get_diagnostic_item(sym::Debug) {
195-
// Helper for detecting `<_ as core::fmt::Debug>::fmt` (in impls).
196-
let is_debug_fmt_method = |def_id| match tcx.opt_associated_item(def_id) {
197-
Some(assoc) if assoc.ident(tcx).name == sym::fmt => match assoc.container {
198-
ty::AssocItemContainer::Impl => {
199-
let impl_def_id = assoc.container_id(tcx);
200-
tcx.impl_trait_ref(impl_def_id)
201-
.map(|tr| tr.skip_binder().def_id)
202-
== Some(debug_trait_def_id)
203-
}
204-
ty::AssocItemContainer::Trait => false,
205-
},
206-
_ => false,
207-
};
208-
209-
if is_debug_fmt_method(def_id) {
210-
return true;
211-
}
212-
213-
if tcx.opt_item_ident(def_id).map(|i| i.name) == Some(sym.fmt_decimal) {
214-
if let Some(parent_def_id) = tcx.opt_parent(def_id) {
215-
if is_debug_fmt_method(parent_def_id) {
216-
return true;
217-
}
218-
}
219-
}
220-
}
221-
}
222-
223-
false
224-
}
225-
226187
// TODO: Should this store Vec or Module?
227188
struct SpirvModuleBuffer(Vec<u32>);
228189

@@ -470,11 +431,6 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
470431
}
471432

472433
for &(mono_item, mono_item_data) in mono_items.iter() {
473-
if let MonoItem::Fn(instance) = mono_item {
474-
if is_blocklisted_fn(cx.tcx, &cx.sym, instance) {
475-
continue;
476-
}
477-
}
478434
mono_item.predefine::<Builder<'_, '_>>(
479435
&cx,
480436
mono_item_data.linkage,
@@ -484,11 +440,6 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
484440

485441
// ... and now that we have everything pre-defined, fill out those definitions.
486442
for &(mono_item, _) in mono_items.iter() {
487-
if let MonoItem::Fn(instance) = mono_item {
488-
if is_blocklisted_fn(cx.tcx, &cx.sym, instance) {
489-
continue;
490-
}
491-
}
492443
mono_item.define::<Builder<'_, '_>>(&cx);
493444
}
494445

crates/rustc_codegen_spirv/src/symbols.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use std::rc::Rc;
1313
/// already exists, deduplicating it if so. This makes things like comparison and cloning really cheap. So, this struct
1414
/// is to allocate all our keywords up front and intern them all, so we can do comparisons really easily and fast.
1515
pub struct Symbols {
16-
// Used by `is_blocklisted_fn`.
17-
pub fmt_decimal: Symbol,
18-
1916
pub discriminant: Symbol,
2017
pub rust_gpu: Symbol,
2118
pub spirv: Symbol,
@@ -403,8 +400,6 @@ impl Symbols {
403400
assert!(old.is_none());
404401
}
405402
Self {
406-
fmt_decimal: Symbol::intern("fmt_decimal"),
407-
408403
discriminant: Symbol::intern("discriminant"),
409404
rust_gpu: Symbol::intern("rust_gpu"),
410405
spirv: Symbol::intern("spirv"),

0 commit comments

Comments
 (0)