Skip to content

Argus fails on serde example #73

@willcrichton

Description

@willcrichton

To reproduce:

# Cargo.toml
[package]
name = "example"
version = "0.1.0"
edition = "2024"

[dependencies]
index_vec = { version = "0.1.4", features = ["serde"] }
serde = { version = "1.0.219", features = ["derive", "rc"] }
// src/lib.rs
use std::{collections::HashMap, hash::Hash, sync::Arc};

use index_vec::{Idx, IndexVec, define_index_type};
use serde::Deserialize;

trait Indexed: Clone + PartialEq + Eq + Hash {
  type Index: Idx;
}

#[derive(Clone, PartialEq, Eq, Hash, Deserialize)]
struct Local;

define_index_type! {
  struct LocalIdx = u32;
}

impl Indexed for Local {
  type Index = LocalIdx;
}

#[derive(Deserialize)]
struct Domain<T: Indexed>(
  IndexVec<T::Index, T>, 
  #[serde(skip)] HashMap<T, T::Index>
);

#[derive(Deserialize)]
pub struct Foo {
  pub bar: Arc<Domain<Local>>,
}

Click <..>::visit_map then Deserialize then Arc<Domain<Local>>: Deserialize. Get the error:

Argus error: [INFO src/plugin.rs:238] - Starting rustc analysis... [INFO src/timer.rs:8] - rustc took 0.0122s [INFO src/timer.rs:8] - global_ctxt took 0.0000s [INFO src/find_bodies.rs:50] - Starting find_bodies... [INFO src/timer.rs:8] - find_bodies took 0.0015s [INFO src/plugin.rs:305] - analyzing BodyId { hir_id: HirId(DefId(0:156 ~ example[b333]::_#2).2) } [ERROR src/plugin.rs:309] - Error analyzing body BodyId { hir_id: HirId(DefId(0:156 ~ example[b333]::_#2).2) } could not find tree with full search Stack backtrace: 0: std::backtrace::Backtrace::create 1: anyhow::error::<impl anyhow::Error>::msg 2: argus_lib::analysis::entry::build_tree_output::{{closure}} 3: std::thread::local::LocalKey<T>::with 4: argus_lib::analysis::entry::build_tree_output 5: argus_lib::analysis::tree 6: <argus_cli::plugin::ArgusCallbacks<A,T,F> as rustc_driver_impl::Callbacks>::after_expansion::{{closure}} 7: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIte...

Unrelated error: Github seems to now be limiting URL lengths, so the "Report bug" functionality which pastes the entire message into the URL no longer works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions