make List.mapN properly add all decrefs

This commit is contained in:
Brendan Hansknecht 2023-03-01 21:56:10 -08:00
parent 82663fd30d
commit 66a7d08363
No known key found for this signature in database
GPG key ID: A199D0660F95F948

View file

@ -672,14 +672,14 @@ impl<'a, 'i> Context<'a, 'i> {
match ownership {
DataOwnedFunctionOwns | DataBorrowedFunctionOwns => {
// elements have been consumed, must still consume the list itself
let rest = self.arena.alloc($stmt);
let rest = self.arena.alloc(stmt);
let rc = Stmt::Refcounting(ModifyRc::DecRef(argument), rest);
stmt = self.arena.alloc(rc);
}
DataOwnedFunctionBorrows => {
// must consume list and elements
let rest = self.arena.alloc($stmt);
let rest = self.arena.alloc(stmt);
let rc = Stmt::Refcounting(ModifyRc::Dec(argument), rest);
stmt = self.arena.alloc(rc);