Skip to main content

RegionExt

Trait RegionExt 

Source
pub trait RegionExt<'tcx> {
    // Required methods
    fn new_early_param(
        tcx: TyCtxt<'tcx>,
        early_bound_region: EarlyParamRegion,
    ) -> Region<'tcx>;
    fn new_late_param(
        tcx: TyCtxt<'tcx>,
        scope: DefId,
        kind: LateParamRegionKind,
    ) -> Region<'tcx>;
    fn new_var(tcx: TyCtxt<'tcx>, v: RegionVid) -> Region<'tcx>;
    fn new_error(tcx: TyCtxt<'tcx>, guar: ErrorGuaranteed) -> Region<'tcx>;
    fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx>;
    fn new_error_with_message<S: Into<MultiSpan>>(
        tcx: TyCtxt<'tcx>,
        span: S,
        msg: &'static str,
    ) -> Region<'tcx>;
    fn new_from_kind(tcx: TyCtxt<'tcx>, kind: RegionKind<'tcx>) -> Region<'tcx>;
    fn get_name(self, tcx: TyCtxt<'tcx>) -> Option<Symbol>;
    fn get_name_or_anon(self, tcx: TyCtxt<'tcx>) -> Symbol;
    fn is_named(self, tcx: TyCtxt<'tcx>) -> bool;
    fn bound_at_or_above_binder(self, index: DebruijnIndex) -> bool;
    fn opt_param_def_id(
        self,
        tcx: TyCtxt<'tcx>,
        binding_item: DefId,
    ) -> Option<DefId>;
}

Required Methods§

Source

fn new_early_param( tcx: TyCtxt<'tcx>, early_bound_region: EarlyParamRegion, ) -> Region<'tcx>

Source

fn new_late_param( tcx: TyCtxt<'tcx>, scope: DefId, kind: LateParamRegionKind, ) -> Region<'tcx>

Source

fn new_var(tcx: TyCtxt<'tcx>, v: RegionVid) -> Region<'tcx>

Source

fn new_error(tcx: TyCtxt<'tcx>, guar: ErrorGuaranteed) -> Region<'tcx>

Constructs a RegionKind::ReError region.

Source

fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx>

Constructs a RegionKind::ReError region and registers a delayed bug to ensure it gets used.

Source

fn new_error_with_message<S: Into<MultiSpan>>( tcx: TyCtxt<'tcx>, span: S, msg: &'static str, ) -> Region<'tcx>

Constructs a RegionKind::ReError region and registers a delayed bug with the given msg to ensure it gets used.

Source

fn new_from_kind(tcx: TyCtxt<'tcx>, kind: RegionKind<'tcx>) -> Region<'tcx>

Avoid this in favour of more specific new_* methods, where possible, to avoid the cost of the match.

Source

fn get_name(self, tcx: TyCtxt<'tcx>) -> Option<Symbol>

Source

fn get_name_or_anon(self, tcx: TyCtxt<'tcx>) -> Symbol

Source

fn is_named(self, tcx: TyCtxt<'tcx>) -> bool

Is this region named by the user?

Source

fn bound_at_or_above_binder(self, index: DebruijnIndex) -> bool

Source

fn opt_param_def_id( self, tcx: TyCtxt<'tcx>, binding_item: DefId, ) -> Option<DefId>

Given some item binding_item, check if this region is a generic parameter introduced by it or one of the parent generics. Returns the DefId of the parameter definition if so.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'tcx> RegionExt<'tcx> for Region<'tcx>