Skip to content

Conversation

@edi33416
Copy link
Contributor

@edi33416 edi33416 commented Apr 3, 2018

…it was set before getter was called at least once

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @edi33416! 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
17806 normal processAllocator getter will override set value if it was set before getter was called at least once

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

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Please don't introduce new module constructors. A lot of recent work has tried to remove them (for the reasons you see in the CI failures)

_processAllocator = sharedAllocatorObject(GCAllocator.instance);
}

unittest
Copy link
Contributor

Choose a reason for hiding this comment

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

std/experimental/allocator/package.d(235:1)[warn]: A unittest should be annotated with at least @safe or @System

public import std.experimental.allocator.common,
std.experimental.allocator.typed;

shared static this()
Copy link
Contributor

Choose a reason for hiding this comment

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

object.Error@src/rt/minfo.d(371): Cyclic dependency between module std.experimental.allocator and std.parallelism
std.experimental.allocator* ->
std.algorithm.comparison ->
std.parallelism* ->
std.file ->
std.experimental.checkedint ->
std.experimental.allocator.common ->
std.experimental.allocator*

…it was set before getter was called at least once
// in order to ensure that we use the `processAllocator` setter before the getter
@system unittest
{
import std.experimental.allocator.mallocator: Mallocator;
Copy link
Contributor

Choose a reason for hiding this comment

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

spacing between :
From the CI:

std/experimental/allocator/package.d:233:    import std.experimental.allocator.mallocator: Mallocator;

auto newAlloc = sharedAllocatorObject(Mallocator.instance);
processAllocator = newAlloc;
assert(processAllocator is newAlloc);
processAllocator = sharedAllocatorObject(GCAllocator.instance);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe not implicitly assume that it was the GCAllocator before and just reset it to the old value?

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 would require the setter to return the previous allocator, which it currently doesn't. In order to change the API to do this, we'd need to guard with a lock. We can regard this as a best effort.

Copy link
Member

Choose a reason for hiding this comment

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

This would require the setter to return the previous allocator, which it currently doesn't.

That would also be a potential landmine since for basic types the result of (a = b) is the post-modification value of a, not the pre-modification value of a.

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

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

please mind reviews

@dlang-bot dlang-bot merged commit 832ace0 into dlang:master Apr 25, 2018
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.

6 participants