- Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:1916:18: Ty::fn_sig() called on non-fn type: B thread 'rustc' panicked at 'Box<dyn Any>', /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/compiler/rustc_errors/src/lib.rs:1391:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new note: Clippy version: clippy 0.1.63 (4b91a6ea 2022-08-08) query stack during panic: #0 [analysis] running analysis passes on this crate end of query stack Minimal reproduction:
Cargo.toml
[package] name = "fluvio-ws-wasm" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] discard = "1.0.4" pin-project = "1.0.10" wasm-bindgen-futures = "0.4.33" futures-signals = "0.3.31" futures = "0.3.21" src/lib.rs
use discard::DiscardOnDrop; use futures_signals::signal_vec::{MutableSignalVec, MutableVec, SignalVec, VecDiff}; use futures_signals::{cancelable_future, CancelableFutureHandle}; use pin_project::pin_project; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use wasm_bindgen_futures::spawn_local; use futures::{Stream, StreamExt}; #[pin_project] struct CancelableSignalVec<S> { // This will automatically cancel the Future when the CancelableSignalVec struct is dropped _handle: DiscardOnDrop<CancelableFutureHandle>, #[pin] signal: S, } impl<A> CancelableSignalVec<MutableSignalVec<A>> where A: Clone + 'static, { async fn with_future_stream<E, F, S, B>(future: F, stream: S, mut eq: B) -> Result<Self, E> where F: Future<Output = Result<Vec<A>, E>>, S: Stream<Item = (Vec<A>, Vec<A>)> + Unpin + 'static, B: FnMut(&A, &A) -> bool + 'static, { let items = future.await?; // Skip first because it gets current state let skip = if items.is_empty() { 0 } else { 1 }; let output = MutableVec::new_with_values(items); let signal = output.signal_vec_cloned(); let (handle, future) = cancelable_future( async move { let mut changes = stream.skip(skip); // Get updates while let Some((added, deleted)) = changes.next().await { let mut lock = output.lock_mut(); lock.retain(|old| deleted.iter().find(|new| eq(old, new)).is_none()); for new in added { match lock.iter().position(|old| eq(old, &new)) { Some(index) => { lock.set_cloned(index, new); } None => { lock.push_cloned(new); } } } } }, || (), ); spawn_local(future); Ok(Self { _handle: handle, signal, }) } } impl<S> SignalVec for CancelableSignalVec<S> where S: SignalVec, { type Item = S::Item; fn poll_vec_change( self: Pin<&mut Self>, cx: &mut Context, ) -> Poll<Option<VecDiff<Self::Item>>> { self.project().signal.poll_vec_change(cx) } } Metadata
Metadata
Assignees
Labels
No labels