Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression on concrete playback inplace #2454

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions kani-compiler/src/kani_middle/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::path::Path;
use crate::kani_middle::attributes::test_harness_name;
use kani_metadata::{ArtifactType, HarnessAttributes, HarnessMetadata};
use rustc_hir::def_id::DefId;
use rustc_middle::ty::{Instance, TyCtxt};
use rustc_middle::ty::{Instance, InstanceDef, TyCtxt, WithOptConstParam};

use super::{attributes::extract_harness_attributes, SourceLocation};

Expand All @@ -24,7 +24,8 @@ pub fn gen_proof_metadata(tcx: TyCtxt, def_id: DefId, base_name: &Path) -> Harne
tcx.symbol_name(Instance::mono(tcx, def_id)).to_string()
};

let loc = SourceLocation::def_id_loc(tcx, def_id);
let body = tcx.instance_mir(InstanceDef::Item(WithOptConstParam::unknown(def_id)));
let loc = SourceLocation::new(tcx, &body.span);
let file_stem = format!("{}_{mangled_name}", base_name.file_stem().unwrap().to_str().unwrap());
let model_file = base_name.with_file_name(file_stem).with_extension(ArtifactType::SymTabGoto);

Expand All @@ -51,7 +52,8 @@ pub fn gen_test_metadata<'tcx>(
) -> HarnessMetadata {
let pretty_name = test_harness_name(tcx, test_desc);
let mangled_name = tcx.symbol_name(test_fn).to_string();
let loc = SourceLocation::def_id_loc(tcx, test_desc);
let body = tcx.instance_mir(InstanceDef::Item(WithOptConstParam::unknown(test_desc)));
let loc = SourceLocation::new(tcx, &body.span);
let file_stem = format!("{}_{mangled_name}", base_name.file_stem().unwrap().to_str().unwrap());
let model_file = base_name.with_file_name(file_stem).with_extension(ArtifactType::SymTabGoto);

Expand Down
10 changes: 1 addition & 9 deletions kani-compiler/src/kani_middle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
use std::collections::HashSet;

use kani_queries::{QueryDb, UserInput};
use rustc_hir::{
def::DefKind,
def_id::{DefId, LOCAL_CRATE},
};
use rustc_hir::{def::DefKind, def_id::LOCAL_CRATE};
use rustc_middle::mir::mono::MonoItem;
use rustc_middle::span_bug;
use rustc_middle::ty::layout::{
Expand Down Expand Up @@ -103,11 +100,6 @@ impl SourceLocation {
};
SourceLocation { filename, start_line, start_col, end_line, end_col }
}

pub fn def_id_loc(tcx: TyCtxt, def_id: DefId) -> Self {
let span = tcx.def_span(def_id);
Self::new(tcx, &span)
}
}

/// Get the FnAbi of a given instance with no extra variadic arguments.
Expand Down