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

Problem with @safe and hashing self-referential structs #738

Closed
AndrejMitrovic opened this issue Apr 7, 2020 · 5 comments
Closed

Problem with @safe and hashing self-referential structs #738

AndrejMitrovic opened this issue Apr 7, 2020 · 5 comments
Labels
res-duplicate There is an existing Github issue for this type-bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense

Comments

@AndrejMitrovic
Copy link
Contributor

@safe unittest
{
    struct Foo
    {
        Foo[] foo;
    }

    Foo foo;
    hashFull(foo);
}

source/agora/common/Hash.d(181,17): Error: @safe function agora.common.Hash.hashPart!(Foo).hashPart cannot call @system function agora.common.Hash.hashPart!(Foo).hashPart

The problem is:

But it calls https://github.com/bpfkorea/agora/blob/05bfe591aec457544bfe9fc8b799f592d4d6b303/source/agora/common/Hash.d#L126

And this one is not @safe.

cc @Geod24

@AndrejMitrovic AndrejMitrovic added the type-bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense label Apr 7, 2020
@AndrejMitrovic
Copy link
Contributor Author

Safety should be inferred here, hashPart is templated. But somehow it's not safe..

@Geod24
Copy link
Collaborator

Geod24 commented Apr 7, 2020

Upstream bug ? Can you reduce it ?

@AndrejMitrovic
Copy link
Contributor Author

I'll reduce it soon.

@AndrejMitrovic
Copy link
Contributor Author

@Geod24
Copy link
Collaborator

Geod24 commented Jun 19, 2020

Moved to #561

@Geod24 Geod24 closed this as completed Jun 19, 2020
@Geod24 Geod24 added the res-duplicate There is an existing Github issue for this label Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
res-duplicate There is an existing Github issue for this type-bug Things don't work as they were intended to, or the way they were intended to work doesn't make sense
Projects
None yet
Development

No branches or pull requests

2 participants