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:
relate_nested_regions(Some('r1), &'r2 uint)invokesrelate_op('r1, 'r2)
relate_nested_regions(Some('r1), &'r2 &'r3 uint)invokesrelate_op('r1, 'r2)relate_op('r2, 'r3)
relate_nested_regions(None, &'r2 &'r3 uint)invokesrelate_op('r2, 'r3)
relate_nested_regions(None, &'r2 &'r3 &'r4 uint)invokesrelate_op('r2, 'r3)relate_op('r2, 'r4)relate_op('r3, 'r4)
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.