charon icon indicating copy to clipboard operation
charon copied to clipboard

Tracking issue for incorrect translated generics

Open N1ark opened this issue 7 months ago • 0 comments

The translation of the following snippets of code fail with --extract-opaque-bodies --monomorphize, due to errors in the generics -- this issue is meant to be updated as we fix these issues.

std::path::_::from:

fn main() {
    let _ = std::path::PathBuf::from("foo");
}

Warning that is printed right before:

warning: Mismatched method generics:
         params:   <'_0, A, [@TraitClause0]: @TraitDecl4<missing(@Type1_0)>, [@TraitClause1]: @TraitDecl5<missing(@Type1_0)>>
         supplied: <'_, @Adt6>[@TraitDecl4<@Adt6>, @TraitImpl5, @TraitDecl4<u8>]
 --> /rustc/library/std/src/ffi/os_str.rs:983:5

String::from:

fn main() {
    let _ = String::from("Hello, world!");
}

Warning:

warning: Mismatched method generics:
         params:   <'_0, A, [@TraitClause0]: @TraitDecl2<missing(@Type1_0)>, [@TraitClause1]: @TraitDecl4<missing(@Type1_0)>>
         supplied: <'_, @Adt2>[@TraitDecl2<@Adt2>, @TraitImpl2, @TraitDecl2<u8>]
 --> /rustc/library/alloc/src/str.rs:210:5

Known issues with no repr yet

  • core::iter::adapters::map::_::for_each
  • impl Iterator for Range https://github.com/cryspen/hax/issues/1622

N1ark avatar May 30 '25 15:05 N1ark