Skip to content

Commit d86dc3b

Browse files
authored
Better unsupported construct messages (rust-lang#1725)
1 parent 21ceaa2 commit d86dc3b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ impl<'tcx> GotocCtx<'tcx> {
836836
let drop_sym = self.ensure(&drop_sym_name, |ctx, name| {
837837
// Function body
838838
let unimplemented = ctx.codegen_unimplemented_stmt(
839-
format!("drop_in_place for {}", drop_sym_name).as_str(),
839+
format!("drop_in_place for {}", drop_instance).as_str(),
840840
Location::none(),
841841
"https://github.com/model-checking/kani/issues/281",
842842
);

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl<'tcx> GotocCtx<'tcx> {
334334
if !(typ.is_trait() || typ.is_box()) {
335335
warn!(self_type=?typ, "Unsupported drop of unsized");
336336
return self.codegen_unimplemented_stmt(
337-
format!("Unsupported drop unsized struct: {:?}", typ).as_str(),
337+
format!("drop unsized struct for {:?}", typ).as_str(),
338338
loc,
339339
"https://github.com/model-checking/kani/issues/1072",
340340
);
@@ -383,7 +383,11 @@ impl<'tcx> GotocCtx<'tcx> {
383383
func.call(args).as_stmt(loc)
384384
} else {
385385
self.codegen_unimplemented_stmt(
386-
format!("drop_in_place call for {:?}", func).as_str(),
386+
format!(
387+
"drop_in_place call for {}",
388+
self.readable_instance_name(drop_instance)
389+
)
390+
.as_str(),
387391
loc,
388392
"https://github.com/model-checking/kani/issues/426",
389393
)

tests/expected/drop/expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Description: "assertion failed: self.id == 1"\
77
in function <DummyImpl as std::ops::Drop>::drop
88

99
Status: FAILURE\
10-
Description: "Unsupported drop unsized struct: Wrapper<dyn DummyTrait> is not currently supported by Kani. Please post your example at https://github.com/model-checking/kani/issues/1072"
10+
Description: "drop unsized struct for Wrapper<dyn DummyTrait> is not currently supported by Kani. Please post your example at https://github.com/model-checking/kani/issues/1072"
1111

1212

13-
Failed Checks: Unsupported drop unsized struct: Wrapper<dyn DummyTrait> is not currently supported by Kani. Please post your example at https://github.com/model-checking/kani/issues/1072
13+
Failed Checks: drop unsized struct for Wrapper<dyn DummyTrait> is not currently supported by Kani. Please post your example at https://github.com/model-checking/kani/issues/1072
1414

1515
VERIFICATION:- FAILED
1616

0 commit comments

Comments
 (0)