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

--gc:arc causes: Error: cannot create an implicit openArray copy to be passed to a sink parameter #81

Closed
timotheecour opened this issue Oct 31, 2020 · 5 comments · Fixed by #103
Labels

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Oct 31, 2020

when true:
  import pkg/regex
  proc main()=
    let pat = "foo"
    # const pat = "foo" # works
    let r = pat.re
  main()

with --gc:arc

/Users/timothee/git_clone/nim/timn/tests/nim/all/t11213.nim(14, 5) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex.nim(276, 3) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/compiler.nim(8, 3) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/compiler.nim(13, 3) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/nfa.nim(256, 3) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/nfa.nim(52, 3) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/nfa.nim(146, 9) template/generic instantiation from here
/Users/timothee/git_clone/nim/nim-regex/src/regex/nodetype.nim(151, 19) Error: cannot create an implicit openArray copy to be passed to a sink parameter
    result.next.add next
@nitely
Copy link
Owner

nitely commented Oct 31, 2020

It's this issue, I think: nim-lang/Nim#15511

@timotheecour
Copy link
Contributor Author

ya I noticed at the same time as you, I've reopened nim-lang/Nim#15511

timotheecour added a commit to timotheecour/nim-regex that referenced this issue Oct 31, 2020
nitely pushed a commit that referenced this issue Oct 31, 2020
@nitely nitely added the upstream label Nov 5, 2020
@ringabout
Copy link
Contributor

ringabout commented Feb 24, 2021

@timotheecour
This issue is already fixed by devel.

It works with --gc:arc!

@timotheecour
Copy link
Contributor Author

ok, I'm closing this, we should test regex in CI but IMO it should be nim's important_package's responsibility to test this (and other packages) with --gc:arc as it'd be best equipped to do so (it's not just --gc:arc but also orc and many other experimental or not options).

so I'm closing this but we should followup with a way to do that. IMO nim-lang/RFCs#336 is the best approach for this (guarantees your flags (eg gc:arc) would apply to subprocesses, and without any modification to packages needed, all can be done in compiler logic + important_packages.nim handling

@timotheecour
Copy link
Contributor Author

timotheecour commented Feb 25, 2021

re-opening, we should probably revert [1] #82 now that bug was fixed, because result.next.add next can probably be more efficient than

    for ai in next:
      result.next.add ai

thanks to move/copyMem etc (even if that's not the case today, it should be in future)

[1] or rather use:

when (NimMajor, NimMinor, NimPatch) >= (1,5,1):
  result.next.add next
else:
  # refs https://github.com/nim-lang/Nim/issues/15511
  for ai in next:
    result.next.add ai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants