CanonicalizeMode in rustc_infer::infer::canonical::canonicalizer - Rust
Description: Controls how we canonicalize “free regions” that are not inference variables. This depends on what we are canonicalizing for – e.g., if we are canonicalizing to create a query, we want to replace those with inference variables, since we want to make a maximally general query. But if we are canonicalizing a query response, then we don’t typically replace free regions, as they must have been introduced from other parts of the system.

Skip to main content

## CanonicalizeMode

# Trait CanonicalizeMode

Source

    trait CanonicalizeMode {
        // Required methods
        fn canonicalize_free_region<'tcx>(
            &self,
            canonicalizer: &mut Canonicalizer<'_, 'tcx>,
            r: Region<'tcx>,
        ) -> Region<'tcx>;
        fn any(&self) -> bool;
        fn preserve_universes(&self) -> bool;
    }

Expand description

Controls how we canonicalize “free regions” that are not inference variables. This depends on what we are canonicalizing for – e.g., if we are canonicalizing to create a query, we want to replace those with inference variables, since we want to make a maximally general query. But if we are canonicalizing a query response, then we don’t typically replace free regions, as they must have been introduced from other parts of the system.

## Required Methods§

Source

#### fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: Region<'tcx>, ) -> Region<'tcx>

Source

#### fn any(&self) -> bool

Source

#### fn preserve_universes(&self) -> bool

## Dyn Compatibility§

This trait is dyn compatible.

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

## Implementors§

Source§

### impl CanonicalizeMode for CanonicalizeAllFreeRegions

Source§

### impl CanonicalizeMode for CanonicalizeFreeRegionsOtherThanStatic

Source§

### impl CanonicalizeMode for CanonicalizeQueryResponse

Source§

### impl CanonicalizeMode for CanonicalizeUserTypeAnnotation