pub trait Key {
    fn query_crate_is_local(&self) -> bool;
    fn default_span(&self, tcx: TyCtxt<'_>) -> Span;

    fn key_as_def_id(&self) -> Option<DefId> { ... }
}
Expand description

The Key trait controls what types can legally be used as the key for a query.

Required Methods

Given an instance of this key, what crate is it referring to? This is used to find the provider.

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?

Provided Methods

If the key is a DefId or DefId–equivalent, return that DefId. Otherwise, return None.

Implementations on Foreign Types

Canonical query goals correspond to abstract trait operations that are not tied to any crate in particular.

Implementors