From 35967ca38d52fb138dd41837df5db8dd93ec1087 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 16 Mar 2023 13:06:18 -0400 Subject: [PATCH] circmgr: Declare builder() unconditionally. (Still, only expose it when experimental-api is enabled.) --- Cargo.lock | 1 + crates/tor-circmgr/Cargo.toml | 20 +++++++++++++++----- crates/tor-circmgr/src/lib.rs | 5 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18868f0f7..5f30c1a6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3769,6 +3769,7 @@ dependencies = [ "tor-rtcompat", "tor-rtmock", "tracing", + "visibility", "weak-table", ] diff --git a/crates/tor-circmgr/Cargo.toml b/crates/tor-circmgr/Cargo.toml index 64d2fcd12..0783bc2aa 100644 --- a/crates/tor-circmgr/Cargo.toml +++ b/crates/tor-circmgr/Cargo.toml @@ -26,7 +26,7 @@ testing = [] # These APIs are not covered by semantic versioning. Using this # feature voids your "semver warrantee". experimental = ["experimental-api", "hs-client", "hs-service"] -experimental-api = [] +experimental-api = ["visibility"] hs-client = ["hs-common"] hs-service = ["hs-common"] hs-common = ["tor-hscrypto"] @@ -63,15 +63,25 @@ tor-persist = { path = "../tor-persist", version = "0.6.2" } tor-proto = { path = "../tor-proto", version = "0.9.0" } tor-rtcompat = { path = "../tor-rtcompat", version = "0.8.1" } tracing = "0.1.18" +visibility = { version = "0.0.1", optional = true } weak-table = "0.3.0" [dev-dependencies] futures-await-test = "0.3.0" -tor-guardmgr = { path = "../tor-guardmgr", version = "0.8.2", features = ["testing"] } +tor-guardmgr = { path = "../tor-guardmgr", version = "0.8.2", features = [ + "testing", +] } tor-llcrypto = { path = "../tor-llcrypto", version = "0.4.2" } -tor-netdir = { path = "../tor-netdir", version = "0.8.0", features = ["testing"] } -tor-persist = { path = "../tor-persist", version = "0.6.2", features = ["testing"] } -tor-rtcompat = { path = "../tor-rtcompat", version = "0.8.1", features = ["tokio", "native-tls"] } +tor-netdir = { path = "../tor-netdir", version = "0.8.0", features = [ + "testing", +] } +tor-persist = { path = "../tor-persist", version = "0.6.2", features = [ + "testing", +] } +tor-rtcompat = { path = "../tor-rtcompat", version = "0.8.1", features = [ + "tokio", + "native-tls", +] } tor-rtmock = { path = "../tor-rtmock", version = "0.7.0" } [package.metadata.docs.rs] all-features = true diff --git a/crates/tor-circmgr/src/lib.rs b/crates/tor-circmgr/src/lib.rs index 1bbaed7d9..6b9d2d431 100644 --- a/crates/tor-circmgr/src/lib.rs +++ b/crates/tor-circmgr/src/lib.rs @@ -526,8 +526,9 @@ impl CircMgr { /// Return a reference to the associated CircuitBuilder that this CircMgr /// will use to create its circuits. #[cfg_attr(docsrs, doc(cfg(feature = "experimental-api")))] - #[cfg(feature = "experimental-api")] - pub fn builder(&self) -> &build::CircuitBuilder { + #[cfg_attr(feature = "experimental-api", visibility::make(pub))] + #[allow(dead_code)] + pub(crate) fn builder(&self) -> &build::CircuitBuilder { self.mgr.peek_builder() }