Exporter: panic: `binder.rs`: "out of range when instantiating"
The exporter panics with messages like type parameter T/#1 (T/#1/1) out of range when instantiating, args=[typenum::UTerm] or const parameter'file/#2 ('file/#2/2) out of range when instantiating args=[read::any::File<'data/#0, R/#1>, 'data/#0].
That comes from rustc_type_ir/src/binder.rs:697:9 (for type parameters) and rustc_type_ir/src/binder.rs:769:9 (for const parameters).
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:697:9:
type parameter `T/#1` (T/#1/1) out of range when instantiating, args=[typenum::UTerm]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'file/#2` ('file/#2/2) out of range when instantiating args=[read::any::File<'data/#0, R/#1>, 'data/#0]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'w/#1` ('w/#1/1) out of range when instantiating args=[&'_/#0 mut T/#1]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[core::option::Option<T/#0>]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:697:9:
type parameter `W/#1` (W/#1/1) out of range when instantiating, args=[Table<L/#0>]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[config_bag::storable::StoreReplace<U/#0>]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:697:9:
type parameter `T/#3` (T/#3/3) out of range when instantiating, args=[base::default_allocator::DefaultAllocator, base::dimension::Const<R/#0>, base::dimension::Const<C/#1>]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'conn/#3` ('conn/#3/3) out of range when instantiating args=[T/#0, Alias(Projection, AliasTy { args: [T/#0], def_id: DefId(0:315 ~ diesel[542a]::connection::Connection::Backend), .. }), B/#1]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'r/#1` ('r/#1/1) out of range when instantiating args=[database::Sqlite]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[protocol::wl_display::WlDisplay]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'r/#1` ('r/#1/1) out of range when instantiating args=[database::MySql]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'r/#1` ('r/#1/1) out of range when instantiating args=[database::Postgres]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[codec::bytes::BytesCodec]
Crate `[email protected]`
thread 'rustc' panicked at /rustc/86d69c705a552236a622eee3fdea94bf13c5f102/compiler/rustc_type_ir/src/binder.rs:769:9:
const parameter `'a/#1` ('a/#1/1) out of range when instantiating args=[str]
cc @Nadrieril, that might find this either (or both) amusing and depressing 😁
Can you minimize any of that? And are you sure this isn't related to GATs?
Sure, will try to minimize as soon as possible. I have no idea, those errors are new, just saw that this morning, I spent no time investigating. But that's very possible!
(looking at the names of the crates, that would not be so surprising to see GATs in there)
@Nadrieril, you're right, that's some bad owner id in HIR!
Repro:
trait Tr {
type Ty<X>;
}
impl Tr for () {
type Ty<X> = Option<X>;
}
Open this code snippet in the playground
Should be fairly easy to fix!
Maybe the easiest fix is to switch to FullDef :D
I'm looking a bit at it @Nadrieril, I can't find the "impl expr" information for associated types in FullDef, e.g. impl X for ... { type T = Something; } where trait X {type T: Super;}, it's somewhere already?
It's either in AssocItem or it's one of the last missing things.
I added this info in https://github.com/hacspec/hax/pull/1069
Great, thank you! Will try to switch to FullDef asap :)
This issue has been marked as stale due to a lack of activity for 60 days. If you believe this issue is still relevant, please provide an update or comment to keep it open. Otherwise, it will be closed in 7 days.