Skip to content

A different case of "implementation of FnOnce is not general enough" #129291

Closed as not planned
@0x8f701

Description

@0x8f701

I tried this code:

async fn new_trace_lde<E: FieldElement<BaseField = Felt>>(
    &self,
    trace_info: &TraceInfo,
    main_trace: &ColMatrix<Felt>,
    domain: &StarkDomain<Felt>,
) -> (Self::TraceLde<E>, TracePolyTable<E>) {
    // Error: implementation of FnOnce is not general enough
    WebGPUTraceLde::new(trace_info, main_trace, domain, self.webgpu_hash_fn).await
}

// WebGPUTraceLde::new
pub async fn new(
    trace_info: &TraceInfo,
    main_trace: &ColMatrix<Felt>,
    domain: &StarkDomain<Felt>,
    webgpu_hash_fn: HashFn,
) -> (Self, TracePolyTable<E>) {
    // extend the main execution trace and build a Merkle tree from the extended trace
    let (main_segment_lde, main_segment_tree, main_segment_polys) =
        build_trace_commitment(main_trace, domain, webgpu_hash_fn).await;

    let trace_poly_table = TracePolyTable::new(main_segment_polys);
    let trace_lde = WebGPUTraceLde {
        main_segment_lde,
        main_segment_tree,
        aux_segment_lde: None,
        aux_segment_tree: None,
        blowup: domain.trace_to_lde_blowup(),
        trace_info: trace_info.clone(),
        webgpu_hash_fn,
    };

    (trace_lde, trace_poly_table)
}

I expected to see this happen: No error

Instead, this happened:

implementation of `FnOnce` is not general enough
closure with signature `fn(&'0 [Felt]) -> Vec<Felt>` must implement `FnOnce<(&'1 [Felt],)>`, for any two lifetimes `'0` and `'1`...
...but it actually implements `FnOnce<(&[Felt],)>` (rustc)*

Meta

rustc --version --verbose:

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: aarch64-apple-darwin
release: 1.80.1
LLVM version: 18.1.7

error: implementation of `FnOnce` is not general enough
   --> prover/src/gpu/webgpu/mod.rs:177:49
    |
177 |       ) -> (Self::TraceLde<E>, TracePolyTable<E>) {
    |  _________________________________________________^
178 | |         WebGPUTraceLde::new(trace_info, main_trace, domain, self.webgpu_hash_fn).await
179 | |     }
    | |_____^ implementation of `FnOnce` is not general enough
    |
    = note: closure with signature `fn(&'0 [Felt]) -> Vec<Felt>` must implement `FnOnce<(&'1 [Felt],)>`, for any two lifetimes `'0` and `'1`...
    = note: ...but it actually implements `FnOnce<(&[Felt],)>`

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions