From a331d32435536a4d8d419ddf5627846011d2676e Mon Sep 17 00:00:00 2001 From: Millione Date: Tue, 6 Aug 2024 14:50:26 +0800 Subject: [PATCH] fix: evaluate to dynamic when encountering cycle --- Cargo.lock | 2 +- pilota-build/Cargo.toml | 2 +- pilota-build/src/db.rs | 6 +++--- pilota-build/src/lib.rs | 7 ------- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 831d12ce..008c0a34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -805,7 +805,7 @@ dependencies = [ [[package]] name = "pilota-build" -version = "0.11.14" +version = "0.11.15" dependencies = [ "ahash", "anyhow", diff --git a/pilota-build/Cargo.toml b/pilota-build/Cargo.toml index 267e32e9..ecda95b9 100644 --- a/pilota-build/Cargo.toml +++ b/pilota-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pilota-build" -version = "0.11.14" +version = "0.11.15" edition = "2021" description = "Compile thrift and protobuf idl into rust code at compile-time." documentation = "https://docs.rs/pilota-build" diff --git a/pilota-build/src/db.rs b/pilota-build/src/db.rs index 14be61bf..bac9a727 100644 --- a/pilota-build/src/db.rs +++ b/pilota-build/src/db.rs @@ -12,7 +12,7 @@ use crate::{ }, symbol::{DefId, FileId}, tags::Tags, - TagId, MAX_RESOLVE_DEPTH, + TagId, }; #[derive(Default)] @@ -44,7 +44,7 @@ impl RootDatabase { visiting: &mut FxHashSet, depth: usize, ) { - if map.contains_key(&def_id) || depth > *MAX_RESOLVE_DEPTH { + if map.contains_key(&def_id) { return; } if !matches!(&*db.item(def_id).unwrap(), rir::Item::Mod(_)) { @@ -75,7 +75,7 @@ impl RootDatabase { DefLocation::Fixed(_, _) => false, DefLocation::Dynamic => true, }) - .unwrap_or_default() + .unwrap_or(true) { map.insert(def_id, DefLocation::Dynamic); break; diff --git a/pilota-build/src/lib.rs b/pilota-build/src/lib.rs index 871cfb7d..2d015fec 100644 --- a/pilota-build/src/lib.rs +++ b/pilota-build/src/lib.rs @@ -47,13 +47,6 @@ use salsa::Durability; pub use symbol::{DefId, IdentName}; pub use tags::TagId; -lazy_static::lazy_static! { - pub(crate) static ref MAX_RESOLVE_DEPTH: usize = std::env::var("MAX_RESOLVE_DEPTH") - .ok() - .and_then(|s| s.parse().ok()) - .unwrap_or(256); -} - pub trait MakeBackend: Sized { type Target: CodegenBackend; fn make_backend(self, context: Context) -> Self::Target;