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

[lifetime-generate] Trait bound is not satisfied (external impl of a trait) #1310

Open
BLepers opened this issue Oct 17, 2024 · 1 comment
Open

Comments

@BLepers
Copy link
Contributor

BLepers commented Oct 17, 2024

I am trying to specify the following code:

use vstd::prelude::*;

// Cannot be put in the verus!{} block because
// error: The verifier does not yet support the following Rust feature: &mut types, except in special cases
impl<T: 'static> ForeignOwnable for Box<T> {
    type Borrowed<'a> = &'a mut T;
}

verus!{
pub trait ForeignOwnable: Sized {
    type Borrowed<'a>;
}

struct A { a: i32 }
struct B {}

pub trait Operations: Sized {
    type QueueData: ForeignOwnable;
}

impl Operations for B {
    type QueueData = Box<A>;
}

fn main() {
    let a = Box::new(A { a: 1 });
}
}

Which gives the following error:

error: the trait bound `C<6, (std::boxed::Box<A>, std::boxed::Box<C<13, ()>>)>: T41_ForeignOwnable` is not satisfied
  --> test7.rs:20:1
   |
20 | impl Operations for B {
   | ^

error: aborting due to 1 previous error

Is there any way to make Verus realize that the ForeignOwnable trait is implemented for Box? I tried playing with external_trait_specification, but got nowhere...

@tjhance
Copy link
Collaborator

tjhance commented Oct 22, 2024

Looks like another lifetime-generate error

@tjhance tjhance changed the title Trait bound is not satisfied (external impl of a trait) [lifetime-generate] Trait bound is not satisfied (external impl of a trait) Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants