ra-ap-rustc_type_ir 0.147.0

Automatically published version of the package `rustc_type_ir` in the rust-lang/rust repository from commit 9bc8b40bc314b74e1d5e5ab21a0df39c55a34806 The publishing script for this crate lives at: https://github.com/rust-analyzer/rustc-auto-publish
Documentation
/// An `Into`-like trait that takes `TyCtxt` to perform interner-specific transformations.
pub trait Upcast<I, T> {
    fn upcast(self, interner: I) -> T;
}

impl<I, T, U> Upcast<I, U> for T
where
    U: UpcastFrom<I, T>,
{
    fn upcast(self, interner: I) -> U {
        U::upcast_from(self, interner)
    }
}

/// A `From`-like trait that takes `TyCtxt` to perform interner-specific transformations.
pub trait UpcastFrom<I, T> {
    fn upcast_from(from: T, interner: I) -> Self;
}

impl<I, T> UpcastFrom<I, T> for T {
    fn upcast_from(from: T, _tcx: I) -> Self {
        from
    }
}