diff --git a/crates/paralegal-flow/src/ana/inline_judge.rs b/crates/paralegal-flow/src/ana/inline_judge.rs index 742e360b2a..75437daa49 100644 --- a/crates/paralegal-flow/src/ana/inline_judge.rs +++ b/crates/paralegal-flow/src/ana/inline_judge.rs @@ -14,7 +14,7 @@ use rustc_type_ir::TyKind; use crate::{ ana::Print, ann::db::MarkerDatabase, - args::{FlowModel, InliningDepth}, + args::{InliningDepth, Stub}, Args, MarkerCtx, TyCtxt, }; @@ -37,7 +37,7 @@ pub enum InlineJudgement { /// Construct a graph for the called function and merge it Inline, /// Use a flow model to abstract the call - UseFlowModel(&'static FlowModel), + UseFlowModel(&'static Stub), /// Abstract the call via type signature AbstractViaType(&'static str), } diff --git a/crates/paralegal-flow/src/ana/mod.rs b/crates/paralegal-flow/src/ana/mod.rs index 353d1973bf..c623795fde 100644 --- a/crates/paralegal-flow/src/ana/mod.rs +++ b/crates/paralegal-flow/src/ana/mod.rs @@ -6,7 +6,7 @@ use crate::{ ann::{Annotation, MarkerAnnotation}, - args::FlowModel, + args::Stub, desc::*, discover::FnToAnalyze, stats::{Stats, TimedStat}, @@ -412,7 +412,7 @@ struct MyCallback<'tcx> { tcx: TyCtxt<'tcx>, } -impl FlowModel { +impl Stub { /// Performs the effects of this model on the provided function. /// /// `function` is what was to be called but for which a flow model exists, @@ -428,7 +428,7 @@ impl FlowModel { at: RustSpan, ) -> Result<(Instance<'tcx>, CallingConvention<'tcx>), ErrorGuaranteed> { match self { - FlowModel::SubClosure { generic_name } | FlowModel::SubFuture { generic_name } => { + Stub::SubClosure { generic_name } | Stub::SubFuture { generic_name } => { let name = Symbol::intern(generic_name); let generics = tcx.generics_of(function.def_id()); let Some(param_index) = (0..generics.count()).find(|&idx| { @@ -448,7 +448,7 @@ impl FlowModel { .unwrap(); let expect_indirect = match self { - FlowModel::SubClosure { .. } => { + Stub::SubClosure { .. } => { use rustc_hir::def::DefKind; match tcx.def_kind(def_id) { DefKind::Closure => true, @@ -461,7 +461,7 @@ impl FlowModel { } } } - FlowModel::SubFuture { .. } => { + Stub::SubFuture { .. } => { assert!(tcx.generator_is_async(def_id)); true } diff --git a/crates/paralegal-flow/src/ann/db.rs b/crates/paralegal-flow/src/ann/db.rs index a610d5f3c9..5a9940226e 100644 --- a/crates/paralegal-flow/src/ann/db.rs +++ b/crates/paralegal-flow/src/ann/db.rs @@ -12,7 +12,7 @@ use crate::{ ann::{Annotation, MarkerAnnotation}, - args::{Args, FlowModel}, + args::{Args, Stub}, utils::{ func_of_term, resolve::expect_resolve_string_to_def_id, FunctionKind, InstanceExt, IntoDefId, TyExt, @@ -494,7 +494,7 @@ impl<'tcx> MarkerCtx<'tcx> { cache.keys().copied().collect::>() } - pub fn has_flow_model(&self, def_id: DefId) -> Option<&'static FlowModel> { + pub fn has_flow_model(&self, def_id: DefId) -> Option<&'static Stub> { [def_id] .into_iter() .chain( @@ -566,7 +566,7 @@ pub struct MarkerDatabase<'tcx> { type_markers: Cache, Box>, body_cache: Rc>, included_crates: FxHashSet, - flow_models: FxHashMap, + flow_models: FxHashMap, } impl<'tcx> MarkerDatabase<'tcx> { @@ -579,7 +579,7 @@ impl<'tcx> MarkerDatabase<'tcx> { ) -> Self { let flow_models = args .build_config() - .flow_models + .stubs .iter() .filter_map(|(k, v)| { let res = expect_resolve_string_to_def_id(tcx, k, args.relaxed()); diff --git a/crates/paralegal-flow/src/args.rs b/crates/paralegal-flow/src/args.rs index 9009c822f3..93d48df7e1 100644 --- a/crates/paralegal-flow/src/args.rs +++ b/crates/paralegal-flow/src/args.rs @@ -581,7 +581,7 @@ pub struct DepConfig { #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(tag = "mode", rename_all = "kebab-case")] -pub enum FlowModel { +pub enum Stub { #[serde(rename_all = "kebab-case")] /// Replaces the result of a call to a higher-order function with a call to /// the input closure. @@ -601,5 +601,5 @@ pub struct BuildConfig { #[serde(default)] pub include: Vec, #[serde(default)] - pub flow_models: HashMap, + pub stubs: HashMap, } diff --git a/crates/paralegal-flow/tests/flow-models/Paralegal.toml b/crates/paralegal-flow/tests/flow-models/Paralegal.toml index ddf456bc97..80391dce09 100644 --- a/crates/paralegal-flow/tests/flow-models/Paralegal.toml +++ b/crates/paralegal-flow/tests/flow-models/Paralegal.toml @@ -2,14 +2,14 @@ rust-features = ["saturating_int_impl"] -[flow-models."std::thread::spawn"] +[stubs."std::thread::spawn"] mode = "sub-closure" generic-name = "F" -[flow-models."tokio::spawn"] +[stubs."tokio::spawn"] mode = "sub-future" generic-name = "F" -[flow-models."actix_web::web::block"] +[stubs."actix_web::web::block"] mode = "sub-closure" generic-name = "F"