Skip to content

Fix 24051 - Safety attrib inference of enum/immut/const decls - #15434

Merged
WalterBright merged 3 commits into
dlang:masterfrom
dkorpel:system-var-enum-init
Jul 27, 2023
Merged

WalterBright merged 3 commits into
dlang:masterfrom
dkorpel:system-var-enum-init

Conversation

@dkorpel

@dkorpel dkorpel commented Jul 20, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@dlang-bot

Copy link
Copy Markdown

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
✓ 24051 normal Safety attrib inference of enum/immut/const decls inconsistent with mutable static variable decls

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#15434"

@dkorpel

dkorpel commented Jul 20, 2023 •

Copy link
Copy Markdown
Contributor Author

On Windows, there's:

enum HANDLE INVALID_HANDLE_VALUE = cast(HANDLE) (-1);

With HANDLE being void*. Comparing against this is no longer @safe, making Phobos fail to compile. I can update Phobos, but since it's evidently a breaking change, I guess there could be an exception made for void* since it can't be dereferenced in @safe code, but it's a bit ugly.

@RazvanN7

Copy link
Copy Markdown
Contributor

Technically, it's not a breaking change, it's a deprecation. phobos is compiled with -de so we just need to fix phobos and we're fine.

@dkorpel
dkorpel force-pushed the system-var-enum-init branch from b241074 to 5f87e90 Compare July 20, 2023 13:34
Comment thread compiler/src/dmd/func.d Resolved
Comment thread compiler/src/dmd/dsymbolsem.d Resolved
@dkorpel
dkorpel force-pushed the system-var-enum-init branch from 5f87e90 to f4277e0 Compare July 26, 2023 09:39
@maxhaton

maxhaton commented Jul 26, 2023 •

Copy link
Copy Markdown
Member

Changelog please hmm maybe not. A supplemental error would be good tho.

@WalterBright
WalterBright merged commit fd14379 into dlang:master Jul 27, 2023
dkorpel added a commit to dkorpel/dmd that referenced this pull request Jul 27, 2023
…15434)

* Fix 24051 - Safety attrib inference of enum/immut/const decls

* Make `INVALID_HANDLE_VALUE` @trusted

* Push and pop scopes
@dkorpel
dkorpel deleted the system-var-enum-init branch July 27, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants