Skip to content

Mocks closures respect no lifetime constraints #38

Description

@CodeSandwich

This code compiles causing conversion of &str to &'static str:

#[mockable]fnterrible(_:&str) -> &'staticstr{"a"}#[test]fnterrible_test(){// This closure has type `for <'a> fn(&'a str) -> MockResult<(&'a str,), &'a str>`
terrible.mock_safe(|a| MockResult::Return(a));let x = "abc".to_string();let y = x.as_str();let z:&'staticstr = terrible(y);assert_eq!("abc", z);}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions