Skip to content

Commit

Permalink
rune: Clean up target_value! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Nov 5, 2024
1 parent 16b4402 commit f7aa70a
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 219 deletions.
2 changes: 1 addition & 1 deletion crates/rune/src/runtime/borrow_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct BorrowMut<'a, T: ?Sized> {
impl<'a, T: ?Sized> BorrowMut<'a, T> {
/// Construct a borrow mut from static data.
#[inline]
pub(crate) fn from_static(data: &mut T) -> Self {
pub(crate) fn from_ref(data: &'a mut T) -> Self {
Self {
data: NonNull::from(data),
guard: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/rune/src/runtime/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ impl Value {
#[inline]
pub fn borrow_tuple_mut(&self) -> Result<BorrowMut<'_, Tuple>, RuntimeError> {
match self.as_ref() {
Repr::Inline(Inline::Unit) => Ok(BorrowMut::from_static(Tuple::new_mut(&mut []))),
Repr::Inline(Inline::Unit) => Ok(BorrowMut::from_ref(Tuple::new_mut(&mut []))),
Repr::Inline(value) => Err(RuntimeError::expected::<Tuple>(value.type_info())),
Repr::Dynamic(value) => Err(RuntimeError::expected::<Tuple>(value.type_info())),
Repr::Any(value) => {
Expand Down
Loading

0 comments on commit f7aa70a

Please sign in to comment.