Function rustc_hir_analysis::check::check::check_opaque_meets_bounds
source · [−]fn check_opaque_meets_bounds<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
substs: SubstsRef<'tcx>,
span: Span,
origin: &OpaqueTyOrigin
)
Expand description
Check that the concrete type behind impl Trait
actually implements Trait
.
This is mostly checked at the places that specify the opaque type, but we
check those cases in the param_env
of that function, which may have
bounds not on this opaque type:
type X
Without this check the above code is incorrectly accepted: we would ICE if
some tried, for example, to clone an Option<X<&mut ()>>
.