Skip to content

lifetime '__mv_inner_static is missing in item #49

@jimy-byerley

Description

@jimy-byerley

hello and thanks for this crate !

it seems multiversion proc macro is messing up something in functions returning a static lifetime (typically functions returning strings, or owned Cow ...)

here is a minimal example

use multiversion::multiversion;

#[multiversion(targets = "simd")]
fn foo(a: u32) -> &'static [u8] {
    "hello".as_bytes()
}

producing this:

error[E0261]: use of undeclared lifetime name `'__mv_inner_static`
 --> src/bin.rs:7:20
  |
6 | #[multiversion(targets = "simd")]
  | - lifetime `'__mv_inner_static` is missing in item created through this procedural macro
7 | fn foo(a: u32) -> &'static [u8] {
  |                    ^^^^^^^ undeclared lifetime
  |
help: consider introducing lifetime `'__mv_inner_static` here
  |
6 | #[multiversion(targets = "simd")]<'__mv_inner_static>
  |                                  ++++++++++++++++++++

of cours in my real case i wasn't using strings, but Cow of vector values

versions:

  • cargo: 1.93.0
  • rustc: 1.93.0
  • multiversion: 0.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions