Function rustc::middle::typeck::check::regionmanip::relate_nested_regions[src]

pub fn relate_nested_regions(tcx: &ctxt, opt_region: Option<Region>, ty: t, relate_op: |Region, Region|)

This rather specialized function walks each region r that appear in ty and invokes relate_op(r_encl, r) for each one. r_encl here is the region of any enclosing &'r T pointer. If there is no enclosing pointer, and opt_region is Some, then opt_region.get() is used instead. Otherwise, no callback occurs at all).

Here are some examples to give you an intution:

This function is used in various pieces of code because we enforce the constraint that a region pointer cannot outlive the things it points at. Hence, in the second example above, 'r2 must be a subregion of 'r3.