Skip to content

The value no longer satisfies the constraint after passing through identity, which seems counterintuitive #124481

Open
@A4-Tacks

Description

@A4-Tacks
use std::convert::identity;

fn foo<F: for<'a> FnOnce(&'a ()) -> &'a ()>(f: F) {
    f(&());
}

fn main() {
    //foo(identity(|x| x));
    foo(|x| x);
}

I'm not sure if this is a generic or something issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-discussionCategory: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions