Skip to main content

luaur_analysis/records/
cannot_assign_to_never.rs

1use crate::enums::reason::Reason;
2use crate::type_aliases::type_id::TypeId;
3use alloc::vec::Vec;
4
5#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6pub struct CannotAssignToNever {
7    /// type of the rvalue being assigned
8    pub(crate) rhsType: TypeId,
9    /// Originating type.
10    pub(crate) cause: Vec<TypeId>,
11    pub(crate) reason: Reason,
12}
13
14impl CannotAssignToNever {
15    pub const fn new(rhs_type: TypeId, cause: Vec<TypeId>, reason: Reason) -> Self {
16        Self {
17            rhsType: rhs_type,
18            cause,
19            reason,
20        }
21    }
22}
23
24#[allow(non_snake_case)]
25impl CannotAssignToNever {
26    pub fn rhsType(&self) -> TypeId {
27        self.rhsType
28    }
29
30    pub fn cause(&self) -> &[TypeId] {
31        &self.cause
32    }
33
34    pub fn reason(&self) -> Reason {
35        self.reason
36    }
37}