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

ice: None , gats #2876

Open
matthiaskrgr opened this issue Nov 13, 2023 · 1 comment
Open

ice: None , gats #2876

matthiaskrgr opened this issue Nov 13, 2023 · 1 comment
Labels
[C] Bug This is a bug. Something isn't working. [E] Unsupported Construct Add support to an unsupported construct [F] Crash Kani crashed Z-Kani Compiler Issues that require some changes to the compiler

Comments

@matthiaskrgr
Copy link
Contributor

I tried this code:

// check-pass

use std::fmt::Debug;
use std::marker::PhantomData;

trait Foo {
    type Gat<'a>: ?Sized where Self: 'a;
}

struct Bar<'a, T: Foo + 'a>(T::Gat<'a>);

struct Baz<T: ?Sized>(PhantomData<T>);

impl<T: ?Sized> Foo for Baz<T> {
    type Gat<'a> = T where Self: 'a;
}

#[kani::proof]
fn main() {
    let x = Bar::<'_, Baz<()>>(());
    let y: &Bar<'_, Baz<dyn Debug>> = &x;
}

using the following command line invocation:

kani file.rs1

with Kani version: 0.40

I expected to see this happen: explanation

Instead, this happened: explanation

at 17:49:09 ❯ RUST_BACKTRACE=1 kani issue-75899-but-gats.rs
Kani Rust Verifier 0.40.0 (standalone)
warning: unused variable: `y`
  --> issue-75899-but-gats.rs:21:9
   |
21 |     let y: &Bar<'_, Baz<dyn Debug>> = &x;
   |         ^ help: if this is intentional, prefix it with an underscore: `_y`
   |
   = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs:1175:82:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/31bc7e2c47e82798a392c770611975a6883132c8/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/31bc7e2c47e82798a392c770611975a6883132c8/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/31bc7e2c47e82798a392c770611975a6883132c8/library/core/src/panicking.rs:127:5
   3: kani_compiler::codegen_cprover_gotoc::codegen::rvalue::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_vtable_method_field
   4: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   5: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   6: kani_compiler::codegen_cprover_gotoc::codegen::rvalue::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_pointer_cast
   7: kani_compiler::codegen_cprover_gotoc::codegen::rvalue::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_rvalue
   8: kani_compiler::codegen_cprover_gotoc::codegen::statement::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_statement
   9: kani_compiler::codegen_cprover_gotoc::codegen::block::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_block
  10: kani_compiler::codegen_cprover_gotoc::utils::debug::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::call_with_panic_debug_info
  11: kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend::codegen_items
  12: <kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  13: rustc_interface::passes::start_codegen
  14: <rustc_interface::queries::Queries>::ongoing_codegen
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Kani unexpectedly panicked during compilation.
Please file an issue here: https://github.com/model-checking/kani/issues/new?labels=bug&template=bug_report.md

[Kani] current codegen item: codegen_function: main
main
[Kani] current codegen location: Loc { file: "/tmp/icemaker/issue-75899-but-gats.rs", function: None, start_line: 19, start_col: Some(1), end_line: 19, end_col: Some(10) }
warning: 1 warning emitted

error: /home/matthias/.kani/kani-0.40.0/bin/kani-compiler exited with status exit status: 101
@matthiaskrgr matthiaskrgr added the [C] Bug This is a bug. Something isn't working. label Nov 13, 2023
@zhassan-aws zhassan-aws added [F] Crash Kani crashed [E] Unsupported Construct Add support to an unsupported construct Z-Kani Compiler Issues that require some changes to the compiler labels Jan 8, 2024
@zhassan-aws
Copy link
Contributor

Relevant documentation of GATs: https://blog.rust-lang.org/2022/10/28/gats-stabilization.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working. [E] Unsupported Construct Add support to an unsupported construct [F] Crash Kani crashed Z-Kani Compiler Issues that require some changes to the compiler
Projects
None yet
Development

No branches or pull requests

2 participants