struct OrphanChecker<'tcx> {
    tcx: TyCtxt<'tcx>,
    in_crate: InCrate,
    in_self_ty: bool,
    search_first_local_ty: bool,
    non_local_tys: Vec<(Ty<'tcx>, bool)>,
}

Fields§

§tcx: TyCtxt<'tcx>§in_crate: InCrate§in_self_ty: bool§search_first_local_ty: bool

Ignore orphan check failures and exclusively search for the first local type.

§non_local_tys: Vec<(Ty<'tcx>, bool)>

Implementations§

Trait Implementations§

All possible values for a constant parameter already exist in the crate defining the trait, so they are always non-local1.

Because there’s no way to have an impl where the first local generic argument is a constant, we also don’t have to fail the orphan check when encountering a parameter or a generic constant.

This means that we can completely ignore constants during the orphan check.

See src/test/ui/coherence/const-generics-orphan-check-ok.rs for examples.


  1. This might not hold for function pointers or trait objects in the future. As these should be quite rare as const arguments and especially rare as impl parameters, allowing uncovered const parameters in impls seems more useful than allowing impl<T> Trait<local_fn_ptr, T> for i32 to compile. 

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 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.

Layout§

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: 40 bytes