1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Bug Reproducer: ISSUE-002 - Incorrect Feature Guards in Examples
//!
//! ## Root Cause
//!
//! Examples use `#[cfg(all(feature = "string_split", not(feature = "no_std")))]`
//! guards, but the default feature set includes BOTH `string_split` AND `no_std`.
//! This causes all example code to be excluded from compilation even when the
//! features are available.
//!
//! ## Why Not Caught
//!
//! - Examples compile successfully (empty main functions are valid)
//! - No automated testing of example execution
//! - Feature guard logic is subtle and easy to misunderstand
//! - Default feature combinations not tested
//!
//! ## Fix Applied
//!
//! Updated feature guards to one of:
//! 1. `#[cfg(feature = "string_split")]` - Most common case
//! 2. `#[cfg(all(feature = "string_split", feature = "std"))]` - When std required
//! 3. `#[cfg(not(feature = "no_std"))]` - When checking for std environment
//!
//! ## Prevention
//!
//! - Add CI check that examples produce expected output
//! - Test examples with default features, not just `--all-features`
//! - Document feature guard patterns in contribution guidelines
//! - Use feature guard validation in pre-commit hooks
//!
//! ## Pitfall
//!
//! **Never use `not(feature = "no_std")` with other feature requirements in `all()`**
//! - Rationale: `no_std` is often included in default features for portability
//! - Pattern `all(feature = "X", not(feature = "no_std"))` excludes defaults
//! - Use `feature = "std"` explicitly if std environment required
//! - Use `feature = "X"` alone if feature works in both `no_std` and std
// test_kind: bug_reproducer(issue-002)