pub struct TypeId(/* private fields */);Expand description
A type in a Types store.
Ids are dense and only meaningful for the store that issued them. The fixed ids below exist in every store.
§Examples
use typeck_lang::{TypeId, Types};
use hir_lang::Prim;
let mut types = Types::new();
let pair = types.tuple(&[TypeId::prim(Prim::I32), TypeId::prim(Prim::I32)]);
// Hash-consed: building the same type again yields the same id.
assert_eq!(pair, types.tuple(&[TypeId::prim(Prim::I32), TypeId::prim(Prim::I32)]));
assert_ne!(pair, TypeId::UNIT);Implementations§
Source§impl TypeId
impl TypeId
Sourcepub const ERROR: Self
pub const ERROR: Self
The error type {error}: the type of anything already reported. Every
check that meets it succeeds silently, so one root cause produces one
diagnostic.
Sourcepub const NEVER: Self
pub const NEVER: Self
The type of expressions that never produce a value (return, break,
throw, an endless loop). It coerces to every type.
Trait Implementations§
impl Copy for TypeId
impl Eq for TypeId
Source§impl Ord for TypeId
impl Ord for TypeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for TypeId
impl PartialOrd for TypeId
impl StructuralPartialEq for TypeId
Auto Trait Implementations§
impl Freeze for TypeId
impl RefUnwindSafe for TypeId
impl Send for TypeId
impl Sync for TypeId
impl Unpin for TypeId
impl UnsafeUnpin for TypeId
impl UnwindSafe for TypeId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more