Content-Length: 13324 | pFad | https://doc.rust-lang.org/std/pin/../default/../rc/../../../std/../error_codes/./E0316.html

E0316 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0316

A where clause contains a nested quantification over lifetimes.

Erroneous code example:

#![allow(unused)]
fn main() {
trait Tr<'a, 'b> {}

fn foo<T>(t: T)
where
    for<'a> &'a T: for<'b> Tr<'a, 'b>, // error: nested quantification
{
}
}

Rust syntax allows lifetime quantifications in two places within where clauses: Quantifying over the trait bound only (as in Ty: for<'l> Trait<'l>) and quantifying over the whole clause (as in for<'l> &'l Ty: Trait<'l>). Using both in the same clause leads to a nested lifetime quantification, which is not supported.

The following example compiles, because the clause with the nested quantification has been rewritten to use only one for<>:

#![allow(unused)]
fn main() {
trait Tr<'a, 'b> {}

fn foo<T>(t: T)
where
    for<'a, 'b> &'a T: Tr<'a, 'b>, // ok
{
}
}








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/std/pin/../default/../rc/../../../std/../error_codes/./E0316.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy