Filiprogrammer · GitHub

Code

#![feature(adt_const_params, min_generic_const_args)]
const fn bar() -> [u64; 1] {
    [42]
}
struct Foo<const P: [u64; 1]>(());
fn main() {
    let _ = Foo::<{ bar() }>;
}

Current output

error: tuple constructor with invalid base path
  --> src/main.rs:10:21
   |
10 |     let _ = Foo::<{ bar() }>;
   |                     ^^^

Desired output

error: complex const arguments must be placed inside of a `const` block
  --> src/main.rs:10:19
   |
10 |     let _ = Foo::<{ bar() }>;
   |                   ^^^^^^^^^

Rationale and extra context

#150603 changed the helpful error message complex const arguments must be placed inside of a const block to the less helpful tuple constructor with invalid base path for this code.

Other cases

Rust Version

# First version this issue started occurring on
$ rustc --version --verbose
rustc 1.94.0-nightly (4fa80a5e7 2026-01-05)
binary: rustc
commit-hash: 4fa80a5e733e2202d7ca4c203c2fdfda41cfe7dc
commit-date: 2026-01-05
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

Anything else?

No response

Read the original on github.com ↗