pub struct RegionHighlightMode<'tcx> {
    tcx: TyCtxt<'tcx>,
    highlight_regions: [Option<(Region<'tcx>, usize)>; 3],
    highlight_bound_region: Option<(BoundRegionKind, usize)>,
Expand description

The “region highlights” are used to control region printing during specific error messages. When a “region highlight” is enabled, it gives an alternate way to print specific regions. For now, we always print those regions using a number, so something like “'0”.

Regions not selected by the region highlight mode are presently unaffected.


tcx: TyCtxt<'tcx>highlight_regions: [Option<(Region<'tcx>, usize)>; 3]

If enabled, when we see the selected region, use “'N” instead of the ordinary behavior.

highlight_bound_region: Option<(BoundRegionKind, usize)>

If enabled, when printing a “free region” that originated from the given ty::BoundRegionKind, print it as “'1”. Free regions that would ordinarily have names print as normal.

This is used when you have a signature like fn foo(x: &u32, y: &'a u32) and we want to give a name to the region of the reference x.


If region and number are both Some, invokes highlighting_region.

Highlights the region inference variable vid as 'N.

Convenience wrapper for highlighting_region.

Returns Some(n) with the number to use for the given region, if any.

Highlight the given bound region. We can only highlight one bound region at a time. See the field highlight_bound_region for more detailed notes.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.


Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 80 bytes