pub type TraitRef<'tcx> = TraitRef<TyCtxt<'tcx>>;
Aliased Type§
struct TraitRef<'tcx> {
pub def_id: DefId,
pub args: &'tcx RawList<(), GenericArg<'tcx>>,
/* private fields */
}
Fields§
§def_id: DefId
§args: &'tcx RawList<(), GenericArg<'tcx>>
Implementations
Source§impl<I> TraitRef<I>where
I: Interner,
impl<I> TraitRef<I>where
I: Interner,
pub fn new_from_args( interner: I, trait_def_id: <I as Interner>::DefId, args: <I as Interner>::GenericArgs, ) -> TraitRef<I>
pub fn new(
interner: I,
trait_def_id: <I as Interner>::DefId,
args: impl IntoIterator- >,
) -> TraitRef<I>
pub fn from_method( interner: I, trait_id: <I as Interner>::DefId, args: <I as Interner>::GenericArgs, ) -> TraitRef<I>
Sourcepub fn identity(interner: I, def_id: <I as Interner>::DefId) -> TraitRef<I>
pub fn identity(interner: I, def_id: <I as Interner>::DefId) -> TraitRef<I>
Returns a TraitRef
of the form P0: Foo<P1..Pn>
where Pi
are the parameters defined on trait.
pub fn with_self_ty( self, interner: I, self_ty: <I as Interner>::Ty, ) -> TraitRef<I>
pub fn self_ty(&self) -> <I as Interner>::Ty
Trait Implementations§
Source§impl<'tcx> Key for TraitRef<'tcx>
impl<'tcx> Key for TraitRef<'tcx>
Source§type Cache<V> = DefaultCache<TraitRef<TyCtxt<'tcx>>, V>
type Cache<V> = DefaultCache<TraitRef<TyCtxt<'tcx>>, V>
The type of in-memory cache to use for queries with this key type. Read more
Source§fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
In the event that a cycle occurs, if no explicit span has been
given for a query with key
self
, what span should we use?Source§fn key_as_def_id(&self) -> Option<DefId>
fn key_as_def_id(&self) -> Option<DefId>
Source§fn def_id_for_ty_in_cycle(&self) -> Option<DefId>
fn def_id_for_ty_in_cycle(&self) -> Option<DefId>
Used to detect when ADT def ids are used as keys in a cycle for better error reporting.
Source§impl ParameterizedOverTcx for TraitRef<'static>
impl ParameterizedOverTcx for TraitRef<'static>
Source§impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for TraitRef<'tcx>
impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for TraitRef<'tcx>
Source§impl<'tcx> PrintTraitRefExt<'tcx> for TraitRef<'tcx>
impl<'tcx> PrintTraitRefExt<'tcx> for TraitRef<'tcx>
fn print_only_trait_path(self) -> TraitRefPrintOnlyTraitPath<'tcx>
fn print_trait_sugared(self) -> TraitRefPrintSugared<'tcx>
fn print_only_trait_name(self) -> TraitRefPrintOnlyTraitName<'tcx>
Source§impl<I, __CTX> HashStable<__CTX> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: HashStable<__CTX>,
<I as Interner>::GenericArgs: HashStable<__CTX>,
impl<I, __CTX> HashStable<__CTX> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: HashStable<__CTX>,
<I as Interner>::GenericArgs: HashStable<__CTX>,
fn hash_stable( &self, __hcx: &mut __CTX, __hasher: &mut StableHasher<SipHasher128>, )
Source§impl<I> IntoDiagArg for TraitRef<I>where
I: Interner,
impl<I> IntoDiagArg for TraitRef<I>where
I: Interner,
fn into_diag_arg(self) -> DiagArgValue
Source§impl<I> TypeFoldable<I> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: TypeFoldable<I>,
<I as Interner>::GenericArgs: TypeFoldable<I>,
impl<I> TypeFoldable<I> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: TypeFoldable<I>,
<I as Interner>::GenericArgs: TypeFoldable<I>,
Source§fn try_fold_with<__F>(
self,
__folder: &mut __F,
) -> Result<TraitRef<I>, <__F as FallibleTypeFolder<I>>::Error>where
__F: FallibleTypeFolder<I>,
fn try_fold_with<__F>(
self,
__folder: &mut __F,
) -> Result<TraitRef<I>, <__F as FallibleTypeFolder<I>>::Error>where
__F: FallibleTypeFolder<I>,
Source§fn fold_with<F>(self, folder: &mut F) -> Selfwhere
F: TypeFolder<I>,
fn fold_with<F>(self, folder: &mut F) -> Selfwhere
F: TypeFolder<I>,
A convenient alternative to
try_fold_with
for use with infallible
folders. Do not override this method, to ensure coherence with
try_fold_with
.Source§impl<I> TypeVisitable<I> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: TypeVisitable<I>,
<I as Interner>::GenericArgs: TypeVisitable<I>,
impl<I> TypeVisitable<I> for TraitRef<I>where
I: Interner,
<I as Interner>::DefId: TypeVisitable<I>,
<I as Interner>::GenericArgs: TypeVisitable<I>,
Source§fn visit_with<__V>(
&self,
__visitor: &mut __V,
) -> <__V as TypeVisitor<I>>::Resultwhere
__V: TypeVisitor<I>,
fn visit_with<__V>(
&self,
__visitor: &mut __V,
) -> <__V as TypeVisitor<I>>::Resultwhere
__V: TypeVisitor<I>,
impl<I> Copy for TraitRef<I>where
I: Interner,
impl<I> Eq for TraitRef<I>where
I: Interner,
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: 16 bytes