Skip to content

Field of type Code in struct when making closure #1243

@danielsn

Description

@danielsn

When running the tests/kani/Refs/main.rs regression, we get the following error if we turn on typechecking for data-fields.

thread 'rustc' panicked at 'Illegal field.
        Name: 0
        Type: Code { parameters: [Parameter { typ: CInteger(SizeT), identifier: None, base_name: None }, Parameter { typ: CInteger(SizeT), identifier: None, base_name: None }], return_type: StructTag("tag-_12144896164184170153") }', /Users/dsn/ws/rmc/cprover_bindings/src/goto_program/typ.rs:187:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: cprover_bindings::goto_program::typ::DatatypeComponent::field
             at /Users/dsn/ws/rmc/cprover_bindings/src/goto_program/typ.rs:187:9
   3: kani_compiler::codegen_cprover_gotoc::codegen::typ::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_struct_fields
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs:732:39
   4: kani_compiler::codegen_cprover_gotoc::codegen::typ::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_ty_tuple_like
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs:765:9
   5: kani_compiler::codegen_cprover_gotoc::codegen::typ::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_ty_closure::{{closure}}

Looks like we're codegenning Code instead of Code* when doing a closure

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions