Skip to content

Commit 0b994e3

Browse files
authored
Remove skip_codegen_function (rust-lang#1898)
1 parent 1611824 commit 0b994e3

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

kani-compiler/src/codegen_cprover_gotoc/codegen/assert.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ impl<'tcx> GotocCtx<'tcx> {
239239
///
240240
/// TODO: Ideally we'd eliminate this. Currently used in two places:
241241
///
242-
/// 1. Functions where we skip codegen. Will eventually go away (we hope?)
243-
/// 2. TerminatorKind::Resume and TK::Abort. Related to unwind support.
242+
/// - `TerminatorKind::Resume` and `TerminatorKind::Abort`. Related to unwind support.
244243
pub fn codegen_mimic_unimplemented(
245244
&mut self,
246245
operation_name: &str,

kani-compiler/src/codegen_cprover_gotoc/codegen/function.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,12 @@ use rustc_ast::Attribute;
1212
use rustc_hir::def::DefKind;
1313
use rustc_hir::def_id::DefId;
1414
use rustc_middle::mir::{HasLocalDecls, Local};
15-
use rustc_middle::ty::print::with_no_trimmed_paths;
1615
use rustc_middle::ty::{self, Instance};
1716
use std::collections::BTreeMap;
1817
use std::convert::TryInto;
1918
use std::iter::FromIterator;
2019
use tracing::{debug, info_span};
2120

22-
/// Utility to skip functions that can't currently be successfully codgenned.
23-
impl<'tcx> GotocCtx<'tcx> {
24-
fn should_skip_current_fn(&self) -> bool {
25-
let current_fn_name =
26-
with_no_trimmed_paths!(self.tcx.def_path_str(self.current_fn().instance().def_id()));
27-
// We cannot use self.current_fn().readable_name() because it gives the monomorphized type, which is more difficult to match on.
28-
// Ideally we should not rely on the pretty-printed name here. Tracked here: https://github.com/model-checking/kani/issues/1374
29-
match current_fn_name.as_str() {
30-
// https://github.com/model-checking/kani/issues/202
31-
"fmt::ArgumentV1::<'a>::as_usize" => true,
32-
// https://github.com/model-checking/kani/issues/282
33-
"bridge::closure::Closure::<'a, A, R>::call" => true,
34-
name if name.contains("reusable_box::ReusableBoxFuture") => true,
35-
"tokio::sync::Semaphore::acquire_owned::{closure#0}" => true,
36-
_ => false,
37-
}
38-
}
39-
}
40-
4121
/// Codegen MIR functions into gotoc
4222
impl<'tcx> GotocCtx<'tcx> {
4323
/// Get the number of parameters that the current function expects.
@@ -94,20 +74,6 @@ impl<'tcx> GotocCtx<'tcx> {
9474
info_span!("CodegenFunction", name = self.current_fn().readable_name()).entered();
9575
if old_sym.is_function_definition() {
9676
tracing::info!("Double codegen of {:?}", old_sym);
97-
} else if self.should_skip_current_fn() {
98-
debug!("Skipping function {}", self.current_fn().readable_name());
99-
self.codegen_function_prelude();
100-
self.codegen_declare_variables();
101-
let loc = self.codegen_span(&self.current_fn().mir().span);
102-
let readable_name = format!("The function {}", self.current_fn().readable_name());
103-
// We'll ideally just get rid of this eventually, but use "mimic" to avoid extra compilation warnings
104-
let body = self.codegen_mimic_unimplemented(
105-
&readable_name,
106-
loc,
107-
// There actually are links to specific issues in `should_skip_current_fn`...
108-
"https://github.com/model-checking/kani/issues/new/choose",
109-
);
110-
self.symbol_table.update_fn_declaration_with_definition(&name, body);
11177
} else {
11278
assert!(old_sym.is_function());
11379
let mir = self.current_fn().mir();

0 commit comments

Comments
 (0)