Skip to content

Conversation

@Biotronic
Copy link
Contributor

…rays > 32(/16) bytes

@dlang-bot
Copy link
Contributor

dlang-bot commented Apr 16, 2016

Thanks for your pull request, @Biotronic! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
10879 std.variant Variant/Algebraic: Can't store static arrays > 32(/16) bytes

@Biotronic Biotronic force-pushed the fix-10879 branch 2 times, most recently from 3258c5b to 6e18dce Compare April 16, 2016 13:46
std/variant.d Outdated
return !tryPutting(null, *cast(TypeInfo*) parm, null);
case OpID.compare:
case OpID.equals:
import std.stdio;
Copy link
Member

Choose a reason for hiding this comment

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

Debugging leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea what you're talking about.

@Biotronic
Copy link
Contributor Author

It could be argued that this bug should be fixed in DMD rather than Phobos, in that 'new T' should work for any T, even something like int[10].

@DmitryOlshansky
Copy link
Member

LGTM though better fix DMD

@Biotronic
Copy link
Contributor Author

I made a fix in DMD as well. If dlang/dmd#5688 is accepted, this pull can be ignored.

@wilzbach
Copy link
Contributor

LGTM though better fix DMD

can we have one of those "decision blocked" labels? thanks!

@tramker
Copy link
Contributor

tramker commented Nov 6, 2016

Anything new ? Since the dmd pull has stalled, maybe this can be pulled ?

@MetaLang
Copy link
Member

@tramker sorry this got stalled. If you rebase onto the latest version of master I will review it.

@Biotronic Biotronic requested a review from andralex as a code owner July 31, 2017 21:09
@Biotronic Biotronic force-pushed the fix-10879 branch 3 times, most recently from c501deb to 72212e3 Compare August 1, 2017 03:11
Copy link
Member

@MetaLang MetaLang left a comment

Choose a reason for hiding this comment

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

I really wish Github would notify me when a PR I've commented on is rebased.

std/variant.d Outdated
v2 = arr;
assert(v1 == arr);
assert(v2 == arr);
foreach (i, e; arr) {
Copy link
Member

Choose a reason for hiding this comment

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

Please put braces on their own line.

std/variant.d Outdated
assert(v1[i] == e);
assert(v2[i] == e);
}
static struct LargeStruct {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

std/variant.d Outdated
{
static if (is(A a == U[n], U, size_t n))
{
pragma(msg, "A");
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this.

std/variant.d Outdated
}
else
{
pragma(msg, "B");
Copy link
Member

Choose a reason for hiding this comment

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

ditto

std/variant.d Outdated
if (target.type.tsize < A.sizeof)
*cast(A**)&target.store = new A;
{
static if (is(A a == U[n], U, size_t n))
Copy link
Member

Choose a reason for hiding this comment

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

This can be shortened to is(A == U[n], U, size_t n)) (a is never used).

static if (is(A a == U[n], U, size_t n))
{
pragma(msg, "A");
A* p = cast(A*)(new U[n]).ptr;
Copy link
Member

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but if A == U[n] then typeof((new U[n]).ptr) is already A* and thus there's no need for this cast.

std/variant.d Outdated
{
auto p = new T(rhs);
}
else static if (is(T t == U[n], U, size_t n))
Copy link
Member

Choose a reason for hiding this comment

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

See my above comment for line 343.

}
else static if (is(T t == U[n], U, size_t n))
{
auto p = cast(T*)(new U[n]).ptr;
Copy link
Member

Choose a reason for hiding this comment

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

See my above comment for line 346.

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.

thx

std/variant.d Outdated
{
int[100] data;
}
LargeStruct l;
Copy link
Member

Choose a reason for hiding this comment

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

Could you please choose a different name? l looks like 1. Thanks!

@Biotronic
Copy link
Contributor Author

No problem. I'm sorry for not testing it before I pushed the changes - I'm on vacation and my laptop is resistant to getting phobos to compile. :p

@Biotronic
Copy link
Contributor Author

Updated. The auto-tester failure looks like a fluke. CircleCI and Jenkins are red on basically every PR. Since the DMD PR is closed, could we get this thing going again?

@MetaLang
Copy link
Member

I'm not sure what's going on with the testers, but once they're sorted I'll merge this.

@wilzbach
Copy link
Contributor

I'm not sure what's going on with the testers

Jenkins: still having a lot of random failures :/
auto-tester: still running into out of memory issues:

make[1]: *** [generated/linux/release/32/unittest/std/regex/internal/tests.o] Killed
make[1]: *** Waiting for unfinished jobs....

CircleCi: known, but I still haven't had time to dig into this.

I restarted Jenkins + deleted the auto-tester job.

but once they're sorted I'll merge this.

Hehe, no please don't wait. Just add auto-merge, it will have a better visibility then.
I typically check the overview here: https://auto-tester.puremagic.com/pulls.ghtml?projectid=1
BTW dlang-bot won't merge automatically if there's a CI failing, but CircleCi + Jenkins aren't enforced, so if the failure looks spurious and everything else is green -> merge ahoy manually :)

@wilzbach
Copy link
Contributor

I typically check the overview here: https://auto-tester.puremagic.com/pulls.ghtml?projectid=1

And found this PR and restarted CircleCi as it has been fixed: #6099

@wilzbach wilzbach merged commit 1fd20cf into dlang:master Jan 31, 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.

9 participants