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

Adds assert messages to std.algorithm.sorting #7091

Merged

Conversation

burner
Copy link
Member

@burner burner commented Jun 25, 2019

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @burner!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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

@@ -617,7 +617,8 @@ size_t pivotPartition(alias less = "a < b", Range)
(Range r, size_t pivot)
if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && hasAssignableElements!Range)
{
assert(pivot < r.length || r.length == 0 && pivot == 0);
assert(pivot < r.length || r.length == 0 && pivot == 0, "pivot must be"
~ " less then the length of r or r must be empty and pivot zero");
Copy link
Contributor

Choose a reason for hiding this comment

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

less then

less th_a_n

Copy link
Member Author

Choose a reason for hiding this comment

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

this always happens to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

No it isn't.

Copy link
Member Author

Choose a reason for hiding this comment

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

it helps to commit, my bad

@@ -1682,7 +1683,7 @@ private void shortSort(alias less, Range)(Range r)
break;
}

assert(r.length >= 6);
assert(r.length >= 6, "r must be longer than 5");
Copy link
Contributor

Choose a reason for hiding this comment

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

r must have more than 5 elements

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@burner burner force-pushed the std.algorithm.sorting_assert_messages branch from 73bba90 to 8e0e2ca Compare June 26, 2019 07:04
@burner burner force-pushed the std.algorithm.sorting_assert_messages branch from 8e0e2ca to dbf9d93 Compare June 26, 2019 07:37
@burner
Copy link
Member Author

burner commented Jun 26, 2019

thanks, sorry for the noise

@dlang-bot dlang-bot merged commit b239506 into dlang:master Jun 26, 2019
@WalterBright
Copy link
Member

@burner @thewilsonator please do not use format in assert messages. format expands to a truly epic blizzard of template instantiations, which causes lots of problems with debug and unittest builds. It also causes problems by making problems hard to isolated, due to depending on most of the rest of Phobos.

assert messages should be as lightweight as possible, and should not instantiate templates. sprintf can be used for formatting.

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.

4 participants