-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
The AsRef<C> for Cell<C>
and AsMut<C> for Cell<C>
impls violate the AsRef
contract that these must not fail, see: https://doc.rust-lang.org/std/convert/trait.AsRef.html#relation-to-borrow
In the impls they panic if the cell has the wrong variant:
monorepo/runtime/src/utils/cell.rs
Lines 76 to 92 in 27333b9
impl<C> AsRef<C> for Cell<C> { | |
fn as_ref(&self) -> &C { | |
match self { | |
Self::Present(context) => context, | |
Self::Missing => panic!("{}", MISSING_CONTEXT), | |
} | |
} | |
} | |
impl<C> AsMut<C> for Cell<C> { | |
fn as_mut(&mut self) -> &mut C { | |
match self { | |
Self::Present(context) => context, | |
Self::Missing => panic!("{}", MISSING_CONTEXT), | |
} | |
} | |
} |
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog