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
Assignees
Milestone

Comments

@mdempsky
Copy link
Member

@mdempsky 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 this to the Go1.18 milestone Jun 2, 2021
@mdempsky mdempsky self-assigned this Jun 2, 2021
@mdempsky mdempsky removed this from the Go1.18 milestone Jun 2, 2021
@mdempsky mdempsky added this to the Go1.17 milestone Jun 2, 2021
@mdempsky
Copy link
Member Author

@mdempsky 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.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 2, 2021

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

Loading

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 2, 2021

Seems reasonable to me.

Loading

@gopherbot gopherbot closed this in 962d5c9 Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants