epfl-lara / rust-stainless

An experimental Rust frontend for Stainless
Apache License 2.0
6 stars 2 forks source link

Ignore Lifetimes #147

Open yannbolliger opened 3 years ago

yannbolliger commented 3 years ago

We assume that rustc has done a good job at borrow checking and lifetime inference before the extraction phase. Therefore it is safe to ignore/erase lifetimes when extraction Rust to Stainless.

The failure: Unsupported tree: Cannot extract generic parameter '_ of kind: Lifetime only happens when using methods on generic types containing references like Option<&T>.copied(). As these methods are not understood by Stainless at the moment anyway, the issue is of very low priority.

Example:

pub fn main() {
  let opt = Some(&123).copied();
  assert!(matches!(opt, Some(123)));
}