Skip to content

Bug: error on dereferencing a Copy type inside a closure #1120

@maximebuyse

Description

@maximebuyse

Code snippet to reproduce the bug:

fn f<T: Copy>(x: &T) {
    let _c = || *x;
}

Charon version: ed22146

Charon command: charon cargo --preset=aeneas

Charon output:

error: Type error after transformations:
       Found incorrect clause var: Bound(1, 0)
       Visitor stack:
         charon_lib::ast::types::TraitRef
         charon_lib::ids::index_vec::IndexVec<charon_lib::ast::types::vars::TraitClauseId, charon_lib::ast::types::TraitRef>
         charon_lib::ast::types::GenericArgs
         alloc::boxed::Box<charon_lib::ast::types::GenericArgs>
         charon_lib::ast::types::TraitImplRef
         charon_lib::ast::types::RegionBinder<charon_lib::ast::types::TraitImplRef>
         charon_lib::ast::types::ClosureInfo
         charon_lib::ast::gast::ItemSource
         charon_lib::ast::types::TypeDecl
       Binding stack (depth 2):
         0: 
         1: <'_0, T>
 --> src/main.rs:4:14
  |
4 |     let _c = || *x;
  |              ^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugA bug in charon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions