Skip to content

error: internal compiler error: Encountered anon const with inference variable args but no error reported #139376

Closed as duplicate of#133199
@listentodella

Description

@listentodella

Code

#![no_std]
#![no_main]

use core::fmt::Write;
use core::str::from_utf8;

use cortex_m_rt::entry;
use defmt::*;
use embassy_executor::Executor;
use embassy_stm32::mode::Async;
use embassy_stm32::time::mhz;
use embassy_stm32::{spi, Config};
use heapless::String;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};use embassy_time::Delay;

use embassy_executor::Spawner;
use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Speed};
use icm426xx;

static EXECUTOR: StaticCell<Executor> = StaticCell::new();

#[embassy_executor::main]
async fn main(_spawner:Spawner) {
    info!("Hello World!");

    let mut config = Config::default();
    {
        use embassy_stm32::rcc::*;
        config.rcc.hsi = Some(HSIPrescaler::DIV1);
        config.rcc.csi = true;
        config.rcc.pll1 = Some(Pll {
            source: PllSource::HSI,
            prediv: PllPreDiv::DIV4,
            mul: PllMul::MUL50,
            divp: Some(PllDiv::DIV2),
            divq: Some(PllDiv::DIV8), // used by SPI3. 100Mhz.
            divr: None,
        });
        config.rcc.sys = Sysclk::PLL1_P; // 400 Mhz
        config.rcc.ahb_pre = AHBPrescaler::DIV2; // 200 Mhz
        config.rcc.apb1_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb2_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb3_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb4_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.voltage_scale = VoltageScale::Scale1;
    }
    let p = embassy_stm32::init(config);

    let mut spi_config = spi::Config::default();
    spi_config.frequency = mhz(1);

    let mut spi = spi::Spi::new(p.SPI3, p.PB3, p.PB5, p.PB4, p.DMA1_CH3, p.DMA1_CH4, spi_config);

    let spidev = embedded_hal_bus::spi::ExclusiveDevice::new_no_delay(spi, cs).unwrap();
    let mut icm = icm426xx::ICM42688::new(spidev);

    let mut icm = icm.initialize(Delay).await.unwrap();
    let mut bank = icm.ll().bank::<{icm426xx::register_bank::BANK0}>();
    // if I uncomment this line, the issue can be reproduced
    // let who_am_i = bank.who_am_i().async_read().await.unwrap().value(); //<<<<<----- it seems that this line cause the error
    info!("get chipid = 0x{:#x}", who_am_i);

    loop {

    }
}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (00095b3da 2025-04-03)
binary: rustc
commit-hash: 00095b3da4f23d9b3e7a809ac6a4e2b2530df84c
commit-date: 2025-04-03
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Error output

error: internal compiler error: Encountered anon const with inference variable args but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/mod.rs:596:27 - disabled backtrace

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 `/home/leo/work/embassy/examples/stm32h7/rustc-ice-2025-04-04T14_42_48-31640.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 -C debug-assertions=on -C link-arg=--nmagic -C link-arg=-Tlink.x -C lin
k-arg=-Tdefmt.x

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `embassy-stm32h7-examples` (bin "spi_dma") generated 11 warnings (run `cargo fix --bin "spi_dma"` to apply 9 suggestions)
error: could not compile `embassy-stm32h7-examples` (bin "spi_dma"); 11 warnings emitted

Caused by:
  process didn't exit successfully: `/home/leo/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name spi_dma --edition=2021 src/bin/spi_dma.rs --error-format=
json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=179 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -
C debuginfo=2 -C debug-assertions=on --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=2bdb7c4fd593f481 -C extra-filename=-86719187e8012ce3 --out-dir
 /home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps --target thumbv7em-none-eabihf -L dependency=/home/leo/work/embassy/examples/stm32h7/target/thumbv
7em-none-eabihf/debug/deps -L dependency=/home/leo/work/embassy/examples/stm32h7/target/debug/deps --extern assign_resources=/home/leo/work/embassy/examples/stm32h7/target/thumbv7
em-none-eabihf/debug/deps/libassign_resources-a8ad23844ca8282e.rlib --extern chrono=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libchrono-e1173
b2a55b51fbf.rlib --extern cortex_m=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libcortex_m-d96d34f7713cfde1.rlib --extern cortex_m_rt=/home/leo
/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libcortex_m_rt-436b434cafd666a5.rlib --extern critical_section=/home/leo/work/embassy/examples/stm32h7/targe
t/thumbv7em-none-eabihf/debug/deps/libcritical_section-85b6d083eff1692d.rlib --extern defmt=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libdefm
t-b15d774c8616d99c.rlib --extern defmt_rtt=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libdefmt_rtt-60a210810af7c078.rlib --extern embassy_embe
dded_hal=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembassy_embedded_hal-bd212896216db6b1.rlib --extern embassy_executor=/home/leo/work/emb
assy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembassy_executor-a4508d60ae1f7b29.rlib --extern embassy_futures=/home/leo/work/embassy/examples/stm32h7/target/thu
mbv7em-none-eabihf/debug/deps/libembassy_futures-673fa8760bb06c6f.rlib --extern embassy_net=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libemba
ssy_net-99d5f9de0f762709.rlib --extern embassy_stm32=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembassy_stm32-10289614d195af4f.rlib --exter
n embassy_sync=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembassy_sync-29ae7d830ba7f4ac.rlib --extern embassy_time=/home/leo/work/embassy/e
xamples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembassy_time-685bc263d447be95.rlib --extern embassy_usb=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-ea
bihf/debug/deps/libembassy_usb-b2f6bca3be9ae1bd.rlib --extern embedded_hal=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembedded_hal-550dc44a
5338bf01.rlib --extern embedded_hal_1=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembedded_hal-40bd8cf5da55c092.rlib --extern embedded_hal_a
sync=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembedded_hal_async-66e44975dced0295.rlib --extern embedded_hal_bus=/home/leo/work/embassy/e
xamples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembedded_hal_bus-ee06384c4502eceb.rlib --extern embedded_io_async=/home/leo/work/embassy/examples/stm32h7/target/thumbv7
em-none-eabihf/debug/deps/libembedded_io_async-8dc4af71ed8f38f4.rlib --extern embedded_nal_async=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/li
bembedded_nal_async-8805cff95a22ee77.rlib --extern embedded_storage=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libembedded_storage-ddef47d58c0
9c877.rlib --extern grounded=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libgrounded-af89f5fd33915bfe.rlib --extern heapless=/home/leo/work/emb
assy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libheapless-fcb499525897e55d.rlib --extern icm426xx=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eab
ihf/debug/deps/libicm426xx-e7284d93b6741366.rlib --extern micromath=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libmicromath-08c3463a94f165ff.r
lib --extern panic_probe=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libpanic_probe-3c78894b1b265f51.rlib --extern rand_core=/home/leo/work/emb
assy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/librand_core-2359442b6839047b.rlib --extern static_cell=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none
-eabihf/debug/deps/libstatic_cell-c70e5aa98a2c3668.rlib --extern stm32_fmc=/home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/deps/libstm32_fmc-0a20c37b4c8
1f3bb.rlib -L /home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/build/embassy-stm32h7-examples-2ccab6f71a7cafbb/out -C link-arg=--nmagic -C link-arg=-Tlin
k.x -C link-arg=-Tdefmt.x -L /home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/build/cortex-m-781aa842728db867/out -L /home/leo/work/embassy/examples/stm3
2h7/target/thumbv7em-none-eabihf/debug/build/cortex-m-rt-9adfe51c2d4b61cf/out -L /home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/build/defmt-0fe16b8168f
5dcd2/out -L /home/leo/work/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/build/embassy-stm32-87b75f0ebfe9c21f/out -L /home/leo/.cargo/registry/src/index.crates.io-1
949cf8c6b5b557f/stm32-metapac-16.0.0/src/chips/stm32h750vb` (exit status: 101)

Backtrace

<backtrace>

rustc-ice-2025-04-04T14_42_48-31640.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-incomplete-featuresThis issue requires the use of incomplete features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions