Skip to content

Add missing feature gate for reverse mappings in PHF implementation#4

Open
krobbi wants to merge 1 commit intottys3:mainfrom
krobbi:phf-feature-gate
Open

Add missing feature gate for reverse mappings in PHF implementation#4
krobbi wants to merge 1 commit intottys3:mainfrom
krobbi:phf-feature-gate

Conversation

@krobbi
Copy link

@krobbi krobbi commented Sep 12, 2025

User description

Previously the library would not compile with PHF enabled and default features disabled due to missing constants in the PHF implementation of get_extensions. This adds the feature gate found in the binary search implementation.


PR Type

Bug fix


Description

  • Add missing rev-map feature gate to PHF implementation

  • Fix compilation error when PHF enabled with default features disabled

  • Align PHF implementation with binary search implementation


Diagram Walkthrough

flowchart LR
  A["PHF Implementation"] -- "add feature gate" --> B["get_extensions function"]
  B -- "matches" --> C["Binary Search Implementation"]
Loading

File Walkthrough

Relevant files
Bug fix
impl_phf.rs
Add feature gate to get_extensions function                           

src/impl_phf.rs

  • Add #[cfg(feature = "rev-map")] attribute to get_extensions function
  • Ensures compilation compatibility when PHF is enabled without default
    features
+1/-0     

Previously the library would not compile with PHF enabled and default features disabled due to missing constants in the PHF implementation of get_extensions. This adds the feature gate found in the binary search implementation.
@qodo-free-for-open-source-projects

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Feature Gate

Ensure all call sites and public exports expect get_extensions to exist only when the rev-map feature is enabled, and that other implementations are gated consistently. Validate build across feature combinations (e.g., phf only, phf+rev-map).

#[cfg(feature = "rev-map")]
pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> {

@qodo-free-for-open-source-projects

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant