]> Repositorios git - scryer-prolog.git/commitdiff
Explicitly dereference pointer to avoid calling neg() on reference
authorNicolas Luck <[email protected]>
Fri, 21 Jul 2023 15:07:40 +0000 (17:07 +0200)
committerNicolas Luck <[email protected]>
Fri, 21 Jul 2023 15:07:40 +0000 (17:07 +0200)
src/parser/parser.rs

index 20f53e5bd2171416a631ee34d71ae5d4cf9ce22b..5d637e02a595a26e7369add10a2b0779dc61860b 100644 (file)
@@ -959,12 +959,14 @@ impl<'a, R: CharRead> Parser<'a, R> {
 
     fn shift_token(&mut self, token: Token, op_dir: &CompositeOpDir) -> Result<(), ParserError> {
         fn negate_int_rc(mut t: TypedArenaPtr<Integer>) -> TypedArenaPtr<Integer> {
-            let mut data = t.neg();
+            let i: Integer = (*t).clone();
+            let mut data = i.neg();
             TypedArenaPtr::new(&mut data)
         }
 
-        fn negate_rat_rc(mut t: TypedArenaPtr<Rational>) -> TypedArenaPtr<Rational> {
-            let mut data = t.neg();
+        fn negate_rat_rc(t: TypedArenaPtr<Rational>) -> TypedArenaPtr<Rational> {
+            let r: Rational = (*t).clone();
+            let mut data = r.neg();
             TypedArenaPtr::new(&mut data)
         }