-
-
Notifications
You must be signed in to change notification settings - Fork 608
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 issues 22130, 17635 - pure factory functions #12890
Conversation
|
Thanks for your pull request and interest in making D better, @aG0aep6G! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR breaks a number of projects on buildkite (with warnings as errors), most of the error seem to be of the form
src\object.d(3824): Warning: calling `object.dup!(Sunsafe).dup` without side effects discards return value of type `Sunsafe[]`; prepend a `cast(void)` if intentional
src\object.d(3875): Warning: calling `object.dup!(Sunsafe).dup` without side effects discards return value of type `Sunsafe[]`; prepend a `cast(void)` if intentional
src/dmd/link.d(707): Warning: calling `dmd.root.rmem.Mem.error` without side effects discards return value of type `void*`; prepend a `cast(void)` if intentional
/src/ocean/core/SmartUnion.d(549): Warning: calling `ocean.core.SmartUnion.SmartUnion!(HasDuplicates).SmartUnion.opCall` without side effects discards return value of type `SmartUnion!(HasDuplicates)`; prepend a `cast(void)` if intentional
and a number of segfaults (which may just be OOMs)
|
the static void* error() pure nothrow @nogc @safe
{
onOutOfMemoryError();
assert(0);
}used like static void* check(void* p) pure nothrow @nogc
{
return p ? p : error();
}Not sure about the other. |
|
Lines 705 to 707 in 1a1b81d
to a call to Mem.check() that should fix that problem
|
Sounds good. Done. |
|
Dependant PRs merged |
|
Some test results seem to be outdated. E.g., the Azure pipelines show warnings in druntime that I already addressed. Others I can't reproduce locally. E.g., CyberShadow/DAutoTest says that dlang.org's test_dspec fails with "double free or corruption", but it works for me locally. How do I push this forward? |
|
Im pretty sure you'll need to restart the pipelines by rebasing (or force pushing) as for the doublefree IDK |
|
The outdated test results are gone. But I'm still stuck at the ones I can't reproduce locally. Looking at buildkite, there seems to be memory corruption related to |
Buildkite fails on this dmd PR: dlang/dmd#12890 ``` ./submodules/ocean/src/ocean/core/SmartUnion.d(549): Warning: calling `ocean.core.SmartUnion.SmartUnion!(HasDuplicates).SmartUnion.opCall` without side effects discards return value of type `SmartUnion!(HasDuplicates)`; prepend a `cast(void)` if intentional ```
| @@ -302,8 +302,7 @@ public: | |||
| //property(name, "impure"); | |||
| break; | |||
| case PURE.weak: return property(name, "weak"); | |||
| case PURE.const_: return property(name, "const"); | |||
| case PURE.strong: return property(name, "strong"); | |||
| case PURE.const_: return property(name, "strong"); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mismatch deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mismatch deliberate?
You mean "const_" vs "strong"? I can rename the enum if you like. I just kept it as "PURE.const_" to make sure that I'm not missing "PURE.strong" being used with the old meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think PURE.strong is a better name, but I'm fine with this as well for this PR, it can easily be renamed later. I just wanted to make sure this wasn't a mistake.
| return 1; | ||
| } | ||
|
|
||
| /* The rest of this is too strict; fix later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation of this comment (and others) is off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation of this comment (and others) is off
fixed
| * Determine mutability of indirections in (ref) t. | ||
| * | ||
| * Returns: When the type has any mutable indirections, returns 0. | ||
| * When all indirections are immutable, returns 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a Params: section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a
Params:section
fixed
Buildkite fails on this dmd PR: dlang/dmd#12890 ``` ./submodules/ocean/src/ocean/core/SmartUnion.d(549): Warning: calling `ocean.core.SmartUnion.SmartUnion!(HasDuplicates).SmartUnion.opCall` without side effects discards return value of type `SmartUnion!(HasDuplicates)`; prepend a `cast(void)` if intentional ```
|
The PR for 'ocean' is merged, a rebase should make buildkite green now. |
rebased |
|
What's the plan here ? I personally don't like this warning, because, like every warnings, it can have a high number of false positives. Did it find any issue(s) in the project that are tested ? |
Issue 22130 - [REG2.080.1][DIP1000] pure factory functions stopped working Issue 17635 - [REG 2.066.0] cannot convert unique immutable(int)** to immutable Immutable parameters are not needed for strong purity. Const is enough. Mutability in the return type is an additional condition on top of strong purity when considering side effects. The test case for issue 17635 was inverted without good reason in <dlang#8048>. Flipping again to revert that mistake.
like it used to be
My plan is to fix issues 22130 and 17635. I don't care about the warning. |
The warning was always there, this PR just makes it more accurate. It's similar to when |
|
@RazvanN7 Can you help advance this PR? It's blocked by buildkite because swarm and turtle need to use the newest version of ocean (see sociomantic-tsunami/ocean#857), but I can't get any answer from anyone at sociomantic on GitHub or Slack and I've been trying for weeks now. I also thought maybe the buildkite configuration could be changed to not treat warnings as errors, but I don't see buildkite configuration files in this repository, so it seems I need a buildkite account with access before I can look at that. |
The BuildKite configuration is stored in the CI repo, i.e. the |
Issue 22130 - [REG2.080.1][DIP1000] pure factory functions stopped working
Issue 17635 - [REG 2.066.0] cannot convert unique immutable(int)** to
immutable
Immutable parameters are not needed for strong purity. Const is enough.
Mutability in the return type is an additional condition on top of strong
purity when considering side effects.
The test case for issue 17635 was inverted without good reason in
#8048. Flipping again to revert that
mistake.