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

fix(frontend): make path_to breadth-first #730

Merged
merged 4 commits into from
Jul 29, 2024
Merged

fix(frontend): make path_to breadth-first #730

merged 4 commits into from
Jul 29, 2024

Conversation

W95Psp
Copy link
Collaborator

@W95Psp W95Psp commented Jun 20, 2024

Fixes #692

Status: seems like this is introducing a bug, I have to debug.
Some implementations cannot be found after the change

@W95Psp W95Psp self-assigned this Jun 20, 2024
@franziskuskiefer franziskuskiefer added the waiting-on-author Status: This is awaiting some action from the author. label Jun 21, 2024
@maximebuyse maximebuyse force-pushed the fix-loop-trait-bug branch 3 times, most recently from 2cb1f89 to a996280 Compare July 24, 2024 07:28
@maximebuyse
Copy link
Contributor

A first fix to this implementation (or to a bug revealed by it) is in #797

There is another problem remaining (reaching https://github.com/hacspec/hax/blob/main/frontend/exporter/src/traits.rs#L349)

@maximebuyse maximebuyse assigned maximebuyse and unassigned W95Psp Jul 25, 2024
@W95Psp W95Psp marked this pull request as ready for review July 25, 2024 08:40
@maximebuyse
Copy link
Contributor

A first fix to this implementation (or to a bug revealed by it) is in #797

There is another problem remaining (reaching https://github.com/hacspec/hax/blob/main/frontend/exporter/src/traits.rs#L349)

This bug introduced by the initial version of this PR is now fixed. It was just that switching from a recursive depth-first search to a breadth-first search with a queue meant the parents and associated traits had to be taken from the candidate path and not self. In other words we were only checking paths of length 1 with path_to.

Copy link
Collaborator Author

@W95Psp W95Psp left a comment

Choose a reason for hiding this comment

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

Nice, thank you @maximebuyse! That looks good to me, and @franziskuskiefer is currently trying to break it by throwing it on bigger crates 😅 🤞

@franziskuskiefer
Copy link
Member

The frontend panics now in most cases where it looped before.

thread 'rustc' panicked at /rustc/6b0f4b5ec3aa707ecaa78230722117324a4ce23c/compiler/rustc_type_ir/src/binder.rs:713:9:
type parameter `T/#1` (T/#1/1) out of range when instantiating, args=[Alias(Projection, AliasTy { args: [Self/#0], def_id: DefId(5:71 ~ crypto_common[e66d]::BlockSizeUser::BlockSize) })]

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jul 25, 2024

This is #683, which is not related. IMO we should merge that PR, that's fixing the looping issue

@franziskuskiefer
Copy link
Member

that's fixing the looping issue

How do we know that it is fixing the issue?

@maximebuyse
Copy link
Contributor

that's fixing the looping issue

How do we know that it is fixing the issue?

You're right, it doesn't work on #692 . The looping behavior was gone because the breadth-first search had a bug.

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jul 25, 2024

Oh, you mean that it's still looping? :/

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jul 25, 2024

I pushed make-instantiating-bug-nonfatal which is making the instantiating bug non-fatal. The looping behavior is gone on https://github.com/RustCrypto/traits/tree/master/cipher at least.

Copy link
Collaborator Author

@W95Psp W95Psp left a comment

Choose a reason for hiding this comment

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

LGTM, with a few nits!

frontend/exporter/src/traits.rs Outdated Show resolved Hide resolved
frontend/exporter/src/traits.rs Outdated Show resolved Hide resolved
frontend/exporter/src/traits.rs Outdated Show resolved Hide resolved
@maximebuyse
Copy link
Contributor

LGTM, with a few nits!

Thanks for the tips, I made the corrections.

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jul 29, 2024

Nice, thanks! Have you tried the patch on both #686 and #692? (I updated make-instantiating-bug-nonfatal)
If #692 goes through with make-instantiating-bug-nonfatal, let's document that and close it in favor of #747.

Also, you can resolve conversations on the comments I added, otherwise the PR will be blocked from merging :)

@maximebuyse
Copy link
Contributor

Nice, thanks! Have you tried the patch on both #686 and #692? (I updated make-instantiating-bug-nonfatal) If #692 goes through with make-instantiating-bug-nonfatal, let's document that and close it in favor of #747.

Also, you can resolve conversations on the comments I added, otherwise the PR will be blocked from merging :)

This seems to solve #692, I added a test with this example.
But for #686, no change (the memory consumption keeps increasing until I have to kill it). So it might be another problem.
I didn't try with make-instantiating-bug-non-fatal but I didn't get instantiating issues apparently.

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

Alright, then let's get this in and keep looking for the issue in #686.

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jul 29, 2024

Mmh, ok. Added a comment there: #686 (comment).

@W95Psp W95Psp added this pull request to the merge queue Jul 29, 2024
Merged via the queue into main with commit 64e34c9 Jul 29, 2024
13 checks passed
@W95Psp W95Psp deleted the fix-loop-trait-bug branch July 29, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author Status: This is awaiting some action from the author.
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Hax hangs on a recursive trait with associated type
3 participants