Skip to content

non_lifetime_binders falsely recognizes (and rejects) trait as lifetime #119067

Closed
@LastExceed

Description

@LastExceed

minimal repro:

#![allow(incomplete_features)]
#![feature(non_lifetime_binders)]

trait MyTrait1 {}

trait MyTrait2
    where for <T: MyTrait1> ():
{
    
}

output:

error: lifetime bounds cannot be used in this context
 --> src/lib.rs:7:19
  |
7 |     where for <T: MyTrait1> ():
  |                   ^^^^^^^^

use case:

[playground]
weird example, i know. its difficult to construct a proper example that isn't overly complex

workaround:

add the bound to all call sites that require it (e.g. add where Human: Consume<Food> to foo() in the above example)

rustc:

1.76.0-nightly (2023-12-17 6a62871)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsF-non_lifetime_binders`#![feature(non_lifetime_binders)]`T-compilerRelevant to the compiler 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