pub(crate) url: String,
pub(crate) display_name: String,
pub(crate) edition: Edition,
+ pub(crate) is_bin: bool,
}
pub(crate) type FnCallLocations = FxHashMap<PathBuf, CallData>;
cx: Context<'tcx>,
target_crates: Vec<CrateNum>,
calls: &'a mut AllCallLocations,
+ bin_crate: bool,
}
impl<'a, 'tcx> Visitor<'tcx> for FindCalls<'a, 'tcx>
let mk_call_data = || {
let display_name = file_path.display().to_string();
let edition = call_span.edition();
- CallData { locations: Vec::new(), url, display_name, edition }
+ let is_bin = self.bin_crate;
+
+ CallData { locations: Vec::new(), url, display_name, edition, is_bin }
};
let fn_key = tcx.def_path_hash(*def_id);
cache: formats::cache::Cache,
tcx: TyCtxt<'_>,
options: ScrapeExamplesOptions,
+ bin_crate: bool,
) -> interface::Result<()> {
let inner = move || -> Result<(), String> {
// Generates source files for examples
// Run call-finder on all items
let mut calls = FxHashMap::default();
- let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates };
+ let mut finder =
+ FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates, bin_crate };
tcx.hir().visit_all_item_likes_in_crate(&mut finder);
// The visitor might have found a type error, which we need to