ICE: internal compiler error: no type-dependent def for method call · Issue #138166 · rust-lang/rust (original) (raw)

code

#![feature(min_generic_const_args)] #![feature(inherent_associated_types)] struct a(Box<[u8; Box::b]>); impl a { fn c(self) { self.0.d() } } fn main() {}

Version information

rustc 1.87.0-nightly (b74da9613 2025-03-06)
binary: rustc
commit-hash: b74da9613a8cb5ba67a985f71325be0b7b16c0dd
commit-date: 2025-03-06
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:1:12
  |
1 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:2:12
  |
2 | #![feature(inherent_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information

warning: type `a` should have an upper camel case name
 --> a.rs:3:8
  |
3 | struct a(Box<[u8; Box::b]>);
  |        ^ help: convert the identifier to upper camel case: `A`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

warning: struct `a` is never constructed
 --> a.rs:3:8
  |
3 | struct a(Box<[u8; Box::b]>);
  |        ^
  |
  = note: `#[warn(dead_code)]` on by default

warning: method `c` is never used
 --> a.rs:5:6
  |
4 | impl a {
  | ------ method in this implementation
5 |   fn c(self) { self.0.d() }
  |      ^

warning: 5 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: bad placeholder type
 --> a.rs:3:19
  |
3 | struct a(Box<[u8; Box::b]>);
  |                   ^^^
  |
note: delayed at compiler/rustc_hir_analysis/src/collect.rs:422:9 - disabled backtrace
 --> a.rs:3:19
  |
3 | struct a(Box<[u8; Box::b]>);
  |                   ^^^

error: internal compiler error: no type-dependent def for method call
 --> a.rs:5:16
  |
5 |   fn c(self) { self.0.d() }
  |                ^^^^^^^^^^
  |
note: delayed at compiler/rustc_privacy/src/lib.rs:1237:26 - disabled backtrace
 --> a.rs:5:16
  |
5 |   fn c(self) { self.0.d() }
  |                ^^^^^^^^^^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/crashes/rustc-ice-2025-03-07T16_04_27-3398785.txt` to your bug report

query stack during panic:
end of query stack

@rustbot label +F-min_generic_const_args +F-inherent_associated_types