Skip to content

Commit 4484a9d

Browse files
committed
fix: make the stored_procs_slice change less breaking
1 parent 845f4a0 commit 4484a9d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ restricting time connection establishment.
2121
### Changed
2222
- `network::protocol::codec::IProtoType` uses C language representation
2323
- `cbus::sync::std::ThreadWaker` now uses internal thread FIFO queue when blocking threads on send.
24+
- `#[tarantool::proc]` attribute doesn't add procs to a global array unless
25+
`stored_procs_slice` feature is enabled.
26+
- `proc::all_procs` will now panic if `stored_procs_slice` feature is disabled.
2427

2528
### Fixed
2629
- `tlua::{Push, PushInto, LuaRead}` now work for HashSet & HashMap with custom hashers.

tarantool/src/proc.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ mod stored_procs_slice {
101101
// Linkme distributed_slice exports a symbol with the given name, so we must
102102
// make sure the name is unique, so as not to conflict with distributed slices
103103
// from other crates or any other global symbols.
104+
/// *INTERNAL API* It is only marked `pub` because it needs to be accessed
105+
/// from procedural macros.
104106
#[doc(hidden)]
105107
#[::linkme::distributed_slice]
106108
pub static TARANTOOL_MODULE_STORED_PROCS: [Proc] = [..];
@@ -111,11 +113,17 @@ mod stored_procs_slice {
111113
/// The order of procs in the slice is undefined.
112114
///
113115
/// [`tarantool::proc`]: macro@crate::proc
116+
#[inline(always)]
114117
pub fn all_procs() -> &'static [Proc] {
115118
&TARANTOOL_MODULE_STORED_PROCS
116119
}
117120
}
118121

122+
#[cfg(not(feature = "stored_procs_slice"))]
123+
pub fn all_procs() -> &'static [Proc] {
124+
panic!("`stored_procs_slice` feature is disabled, calling this function doesn't make sense");
125+
}
126+
119127
////////////////////////////////////////////////////////////////////////////////
120128
// module_name
121129
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)