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 17084 - Can't sort array of structs with alias this #6472

Merged
merged 1 commit into from Apr 24, 2018
Merged

fix issue 17084 - Can't sort array of structs with alias this #6472

merged 1 commit into from Apr 24, 2018

Conversation

ghost
Copy link

@ghost ghost commented Apr 22, 2018

This fix is actually more a workaround. I propose it because it's verifiable by hand that doesPointTo is well @nogc.

@ghost ghost requested a review from andralex as a code owner April 22, 2018 11:01
@dlang-bot
Copy link
Contributor

dlang-bot commented Apr 22, 2018

Thanks for your pull request and interest in making D better, @bbasile! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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
17084 normal Can't sort array of structs with alias this: swap can't call non-@nogc function doesPointTo

Testing this PR locally

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

dub fetch digger
dub run digger -- build "master + phobos#6472"

@wilzbach
Copy link
Member

Hmm, how about using assumeNoGC for the line the compiler can't infer correctly?
(though it looks like this should be better fixed in dmd)

@ghost
Copy link
Author

ghost commented Apr 23, 2018

I don't know. It uses a delegate, meaning an indirection. AssumeNoGC is rather used when the attribute cant even be put at all.

std/exception.d Outdated
version(unittest)
{
// 17084 : bug doesn't happen if these declaration are local (even static)
struct Page17084
Copy link
Contributor

@edi33416 edi33416 Apr 23, 2018

Choose a reason for hiding this comment

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

Can these be made private or is this what you meant by local?

Copy link
Author

Choose a reason for hiding this comment

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

they can be made private. by

local even static

i meant inside the unittest block. Will make the comment less ambiguous.

Copy link
Contributor

@edi33416 edi33416 left a comment

Choose a reason for hiding this comment

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

LGTM

@edi33416
Copy link
Contributor

@bbasile could you squash the commits?

Also, what about the doesPointTo overload for shared objects? Would that also require @nogc or is it able to infer it?

@ghost
Copy link
Author

ghost commented Apr 24, 2018

what about the doesPointTo overload for shared objects?

Added a test, it works without explicit @nogc.

@edi33416 edi33416 merged commit 5d2590e into dlang:master Apr 24, 2018
@ghost ghost deleted the issue-17084 branch April 24, 2018 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants