Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table add missing sink #24721

Open
arnetheduck opened this issue Feb 25, 2025 · 2 comments · May be fixed by #24724
Open

Table add missing sink #24721

arnetheduck opened this issue Feb 25, 2025 · 2 comments · May be fixed by #24724
Assignees

Comments

@arnetheduck
Copy link
Contributor

Description

Table should not need to copy its key argument during insertion:

import std/tables
type NoCopies = object

proc `=copy`(a: var NoCopies, b: NoCopies) {.error.}

var t: Table[NoCopies, NoCopies]
t[NoCopies()] = NoCopies() # only moves

The same probably holds for a lot of std lib containers, ie the concept applies to all of them.

Nim Version

2.2

Current Output

Error: '=copy' is not available for type <NoCopies>; requires a copy because it's not the last read of 'key'; try to make key a 'sink' parameter; routine: rawInsert

Expected Output


Known Workarounds

No response

Additional Information

No response

@Araq
Copy link
Member

Araq commented Feb 25, 2025

Ping @demotomohiro please work on this.

@ringabout
Copy link
Member

I will take over it since it is similar to #24720 which lacks corresponding lent and sink in the stdlibs

@ringabout ringabout self-assigned this Feb 25, 2025
@ringabout ringabout linked a pull request Feb 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants