-
Notifications
You must be signed in to change notification settings - Fork 1.7k
subst.rs
"index out of bounds: the len is 1 but the index is 1"
#9639
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
Comments
Ok, I have a small repro in github. If I load this project in vscode on Windows, open the "lib.rs" file, and wait a few seconds, I get the error consistently. (The repro uses a peg parser macro. I tried replacing the code with the result of |
More update:
|
More more update: it repros on Linux (using the version in
|
Minimized test case: fn infix_parse<T, S>(_state: S, _level_code: &Fn(S)) -> T {
todo!()
}
fn parse_arule() {
infix_parse((), &(|_recurse| ()))
} Interestingly, it doesn't happen with |
That is interesting. Might be a problem with the lowering code then. Bare traits get lowered here: Whereas Might be instructive to create a test for this and compare the lowered types. Edit: The bare trait code also doesn't seem to be handling assoc type bindings? 🤔 |
--- bare
+++ dyn
@@ -1,4 +1,4 @@
-[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(60)<1<[?0 := !0_0]>>)] + 'static
+[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(60)<1<[?0 := !0_0]>>), for<> AliasEq(AliasTy(?) = 0<[]>)] + 'static
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(71))] + 'static
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(71)), for<> Implemented(^1.0: TraitId(24))] + 'static
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(71)), for<> Implemented(^1.0: TraitId(24)), for<> Implemented(^1.0: TraitId(30))] + 'static
@@ -24,4 +24,4 @@
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(175))] + 'static
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(175)), for<> Implemented(^1.0: TraitId(24))] + 'static
[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(175)), for<> Implemented(^1.0: TraitId(24)), for<> Implemented(^1.0: TraitId(30))] + 'static
-[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(60)<1<[?0 := ^1.1]>>)] + 'static
+[WARN hir_ty::lower] dyn for<type> [for<> Implemented(^1.0: TraitId(60)<1<[?0 := ^2.1]>>), for<> AliasEq(AliasTy(?) = 0<[]>)] + 'static |
Yeah, so we drop the associated type bindings (bad, but not the cause of the crash), and we mess up the binders (the 2 vs. 1 in the second difference). |
@flodiebold feel free to look into this, I tried some random combinations of shifting the binders, but failed miserably. |
I can look into it next week probably, but my current guess would be wrapping the |
Doing only that fixes this case, but introduces other panics ("unexpected free variable with depth |
9794: Fix binders with bare dyn trait r=flodiebold a=flodiebold Fixes #9639. Co-authored-by: Florian Diebold <[email protected]>
…homcc test_get_dbpath_for_term(): handle non-utf8 paths (fix FIXME) Removes a FIXME for rust-lang#9639 Part of #44366 which is E-help-wanted The remaining two FIXMEs for rust-lang#9639 are considerably more complicated, so I will create separate PRs for them.
…homcc test_get_dbpath_for_term(): handle non-utf8 paths (fix FIXME) Removes a FIXME for rust-lang#9639 Part of #44366 which is E-help-wanted The remaining two FIXMEs for rust-lang#9639 are considerably more complicated, so I will create separate PRs for them.
This is with rust-analyzer using the vscode client on Windows.
I get this error frequently:
Unfortunately I don't have an easy repro. It happens after I've been working in the project for a while (in multiple different projects), and once it happens the server is effectively dead (just keeps repeating this error).
Restarting vscode and/or rust-analyzer does not fix it, but[Edit: that was true of similar problems I've run into, but this particular example seems to reproduce reliably and is unaffected by cargo clean.]cargo clean
does.If there's some way I can get better diagnostic info to help debug it I'd be glad to do that, but I can't even seem to get RUST_BACKTRACE to work. I have
RUST_BACKTRACE=full
set in both my system environment variables and via setting"rust-analyzer.server.extraEnv": {"RUST_BACKTRACE": "full"}
, but I still get the short panic message as shown above.(I don't think this is a dup of #5366 since the error location is different.)
The text was updated successfully, but these errors were encountered: