rustc_hir_analysis::check::wfcheck

Function check_gat_where_clauses

source
fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId)
Expand description

Require that the user writes where clauses on GATs for the implicit outlives bounds involving trait parameters in trait functions and lifetimes passed as GAT args. See self-outlives-lint test.

We use the following trait as an example throughout this function:

trait IntoIter {
    type Iter<'a>: Iterator<Item = Self::Item<'a>>;
    type Item<'a>;
    fn into_iter<'a>(&'a self) -> Self::Iter<'a>;
}