Skip to content

async fn in trait: ICE with 2 generic params in method #102310

Closed
@Dirbaio

Description

@Dirbaio

playground

pub trait SpiDevice {
    async fn transaction<F, R>(&mut self);
}

impl SpiDevice for () {
    async fn transaction<F, R>(&mut self) {}
}

gives

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:674:9: expected type for `R/#1` (R/1) but found Lifetime(ReFree(DefId(0:11 ~ embedded_hal_async[dae4]::spi::{impl#0}::transaction), BrNamed(DefId(0:16 ~ embedded_hal_async[dae4]::spi::SpiDevice::transaction::'_), '_))) when substituting, substs=[R, ReFree(DefId(0:11 ~ embedded_hal_async[dae4]::spi::{impl#0}::transaction), BrNamed(DefId(0:16 ~ embedded_hal_async[dae4]::spi::SpiDevice::transaction::'_), '_)), ReFree(DefId(0:11 ~ embedded_hal_async[dae4]::spi::{impl#0}::transaction), BrNamed(DefId(0:16 ~ embedded_hal_async[dae4]::spi::SpiDevice::transaction::'_), '_))]

full stack trace

happens with either

rustc 1.66.0-dev (21265dd)
1.66.0-nightly (2022-09-25 f5193a9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-async_fn_in_traitStatic async fn in traitsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions