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

cmd/compile: unsafe.{Add,Slice} should require -lang=go1.17 #46525

Closed
mdempsky opened this issue Jun 2, 2021 · 3 comments
Closed

cmd/compile: unsafe.{Add,Slice} should require -lang=go1.17 #46525

mdempsky opened this issue Jun 2, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@mdempsky
Copy link
Member

mdempsky commented Jun 2, 2021

Go 1.17 added unsafe.Add and unsafe.Slice. They shouldn't be available to packages targeting older releases.

@mdempsky mdempsky added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jun 2, 2021
@mdempsky mdempsky added this to the Go1.18 milestone Jun 2, 2021
@mdempsky mdempsky self-assigned this Jun 2, 2021
@mdempsky mdempsky modified the milestones: Go1.18, Go1.17 Jun 2, 2021
@mdempsky
Copy link
Member Author

mdempsky commented Jun 2, 2021

/cc @ianlancetaylor to confirm this.

We don't otherwise enforce that -lang prevents users from using new functionality available in imports, but package unsafe is specially enshrined in the Go spec, so it seems like a case we should detect and emit an error for.

@gopherbot
Copy link

Change https://golang.org/cl/324369 mentions this issue: cmd/compile: restrict use of unsafe.{Add,Slice} to go1.17 or newer

@ianlancetaylor
Copy link
Contributor

Seems reasonable to me.

@golang golang locked and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants