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

Fixed std.algorithm imports in std.format #4467

Merged
merged 1 commit into from
Jul 8, 2016

Conversation

JackStouffer
Copy link
Member

No description provided.

@@ -668,7 +668,7 @@ struct FormatSpec(Char)
if (is(Unqual!Char == Char))
{
import std.ascii : isDigit;
import std.algorithm : startsWith;
import std.algorithm.searching : startsWith;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not move this to top, ie alphabetize, as long as you're changing it?

@JackStouffer
Copy link
Member Author

It seems I created an import cycle. I'm not really sure how this was introduced given the nature of the import changes.

@schveiguy
Copy link
Member

schveiguy commented Jun 27, 2016

@JackStouffer usually the cause of this is a weird trait of importing a module that has templated unit tests. But I don't see why your change would cause that.

The only way I've been able to fix this is to hunt down unit tests that are inside templates and remove them from the templates. There's no easy way to do this.

@JackStouffer
Copy link
Member Author

The only way I've been able to fix this is to hunt down unit tests that are inside templates and remove them from the templates. There's no easy way to do this.

Great

@schveiguy
Copy link
Member

Sorry, I was wrong on what I said. It's not templated unit tests, but templated module constructors. See bug report here: https://issues.dlang.org/show_bug.cgi?id=14517

@schveiguy
Copy link
Member

schveiguy commented Jun 27, 2016

OK, so the * in the error indicate the modules which have static ctors/dtors.

These are legitimately marked (std.encoding + std.parallelism), as both of those have static ctors (and neither have templated ones).

What I don't understand at this point is why it works if you include std.algorithm, but not if you include the specific submodule. The cycles should still exist.

@JackStouffer
Copy link
Member Author

@schveiguy I removed the std.range import from std.parallelism here #4481

Perhaps that will remove the cycle. I can't test on my machine because the tests pass locally.

@schveiguy
Copy link
Member

I can't test on my machine because the tests pass locally

Then something is really strange. The cycle detection should be deterministic. Indeed I see sometimes the tests pass! This could be a bug in the cycle detection code.

@schveiguy
Copy link
Member

Manually went through the cycle -- it exists without your changes. There's definitely something wrong with the cycle code. I'll have to diagnose it and get back to you. Likely we are in for some painful changes to fix this...

@joakim-noah
Copy link
Contributor

I ran into this cycle bug on a similar PR before, #4379, just broke the cycle in std.functional to work around it.

@schveiguy
Copy link
Member

Ran some more brute force cycle detection -- the cycle showing up in this PR is actually not because of your PR, it's already in Phobos. There must be a bug in the cycle detection. I'm going to fix the bug, and then we will have to eliminate the cycles, and THEN your PR should work :) So hold off for a while. I'll let you know when I figure it out.

@JackStouffer
Copy link
Member Author

Ok, thanks!

@schveiguy
Copy link
Member

Yep, somebody screwed up the algorithm after I fixed it... https://issues.dlang.org/show_bug.cgi?id=16211

@schveiguy schveiguy mentioned this pull request Jun 28, 2016
@schveiguy
Copy link
Member

See #4493, should allow merging this (but I am going to fix the cycle detection code too, it can be done separately, as the phobos change is a prerequisite anyway).

@schveiguy
Copy link
Member

And the druntime fix: dlang/druntime#1602

@WalterBright WalterBright merged commit e41d77d into dlang:master Jul 8, 2016
@JackStouffer JackStouffer deleted the format branch July 8, 2016 12:22
@JackStouffer
Copy link
Member Author

Thanks

atilaneves pushed a commit to atilaneves/phobos that referenced this pull request Jul 8, 2016
Fixed std.algorithm imports in std.format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants