-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)C-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant to the types team, which will review and decide on the PR/issue.
Description
I tried this code (playground):
use std::ops::Not;
trait Type {
type Native<'a>
where
Self: 'a;
}
fn not<T: Type>(val: T::Native<'_>) -> T::Native<'_>
where
for<'a> T::Native<'a>: Not<Output = T::Native<'a>>,
{
!val
}
fn main() {}
I expected to see this happen: should compile fine
Instead, this happened: error
Meta
rustc --version --verbose
:
rustc 1.78.0-nightly (3406ada96 2024-02-21)
binary: rustc
commit-hash: 3406ada96f8e16e49e947a91db3eba0db45245fa
commit-date: 2024-02-21
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0
Backtrace
error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
--> src/main.rs:11:32
|
11 | for<'a> T::Native<'a>: Not<Output = T::Native<'a>>,
| ^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0582`.
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)C-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant to the types team, which will review and decide on the PR/issue.