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

fix issue 20655 - attribute inference accepts unsafe union access as @safe #14827

Merged
merged 1 commit into from Aug 3, 2023

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Jan 16, 2023

Reboot of #10884

@dlang-bot
Copy link
Contributor

dlang-bot commented Jan 16, 2023

Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20655 regression [REG: 2.072] attribute inference accepts unsafe union access as @safe

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#14827"

@ibuclaw
Copy link
Member

ibuclaw commented Jan 16, 2023

Well, that failed. :-)

@dkorpel
Copy link
Contributor Author

dkorpel commented Aug 1, 2023

It's now mostly working, but D-YAML, excel-d, taggedalgebraic, and serialized depend on inferred @safe despite union access, so I'll turn this into a deprecation.

@dlang-bot dlang-bot removed the stalled label Aug 1, 2023
@dkorpel dkorpel force-pushed the unsafe-union-access branch 3 times, most recently from 8cab38b to 753de6a Compare August 1, 2023 17:21
@dkorpel dkorpel force-pushed the unsafe-union-access branch 2 times, most recently from a2638a8 to b006928 Compare August 1, 2023 17:22
@dkorpel dkorpel marked this pull request as ready for review August 1, 2023 19:02
@dkorpel dkorpel force-pushed the unsafe-union-access branch 2 times, most recently from 7192c43 to a331584 Compare August 3, 2023 11:49
@dlang-bot dlang-bot merged commit 19899e9 into dlang:master Aug 3, 2023
44 checks passed
@dkorpel dkorpel deleted the unsafe-union-access branch August 3, 2023 13:51
// To turn into an error, remove `isSafeBypassingInference` check in the
// above if statement and remove the else branch
sc.setUnsafePreview(FeatureState.default_, !printmsg, e.loc,
"field `%s.%s` cannot access pointers in `@safe` code that overlap other fields", ad, v);
Copy link
Member

@maxhaton maxhaton Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message isn't great. The field isn't the thing doing the access

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR isn't about the message

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