Skip to content

Support limited use of generic type parameters in function signatures #3

@mzabaluev

Description

@mzabaluev

The aim is to support signatures like this:

#[test]
fn decode_from_bytes<'a, T>>() -> Result<(), <&'a [u8] as TryInto<T>>::Error>
where
    &'a [u8]: TryInto<T>,
    <&'a [u8] as TryInto<T>>::Error: std::error::Error,
{
    let v = b"Hello, world!".try_into()?;
    // ...
}

Substitution of arbitrary type parameters is fraught with breakage due to lack of hygiene, possible inferred lifetimes, lifetimes bound by a type, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions