Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

thread 'rustc' panicked at 'internal error: entered unreachable code', src/traverse.rs:763:29 #271

Open
hlb8122 opened this issue Feb 21, 2022 · 5 comments
Labels

Comments

@hlb8122
Copy link

hlb8122 commented Feb 21, 2022

Using latest master causes thread 'rustc' panicked at 'internal error: entered unreachable code', src/traverse.rs:763:29.

@JohnTitor
Copy link
Member

Could you provide your code (if it's public), backtrace, and/or environment? It's hard to debug with only the error message.

@hlb8122
Copy link
Author

hlb8122 commented Feb 25, 2022

Really sorry not able to divulge much more than my environment.

System:    Kernel: 5.4.0-99-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 5.2.7 
           wm: muffin dm: LightDM Distro: Linux Mint 20.3 Una base: Ubuntu 20.04 focal 

@dario23
Copy link
Contributor

dario23 commented May 8, 2022

would you be willing/able to run with RUSTC_LOG=debug and check some things in the output?

do you know which part of the code this crashes on, and can't share for some reason, or not sure where it crashes either?

src/traverse.rs:763 is line 776 in current master, which is the case when neither the old nor the new item being compared has any lifetime in the type, but that comparison only goes until max(old.count_lifetimes, new.count_lifetimes), so one of the sides has to have a lifetime or the loop isn't entered in the first place; so i think unless we can get a bit more info on what the input looks like here, we won't be able to do much about it.

@leavelet
Copy link

I also encountered this problem. The code is at casbin/casbin-rs
Could you please take a look?

@dario23
Copy link
Contributor

dario23 commented May 13, 2022

i think i found what goes wrong here: the async-trait crate/#[async_trait] attribute do rewriting on functions, so they end up having has_self set to true, but the rewrite removes the &self param/lifetime, so we off-by-one in the loop in which we compare the lifetimes due to wrongly setting self_add == 1. (we index out of bounds of the generics entries, but due to using Vec::get and returning None for both "index out of bounds" and "the ith generic param is not a lifetime" this didn't pop up immediately at the location where it went wrong.)

i have pushed a workaround to #295, but i'm not happy with it as a fix. still, please test if that fixes things for you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants