Skip to content

Commit

Permalink
chore: Add missing feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Aug 5, 2024
1 parent de84152 commit 87b355d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
strategy:
fail-fast: false
matrix:
feature: [capture-io, "cli,doc", "cli,fmt", cli, workspace, languageserver, byte-code]
feature: [capture-io, "cli,doc", "cli,fmt", cli, workspace, languageserver, byte-code, emit]
env:
RUSTFLAGS: -D warnings
steps:
Expand Down
8 changes: 4 additions & 4 deletions crates/rune/src/compile/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl Context {
}

/// Lookup meta by its hash.
#[cfg(any(feature = "cli", feature = "languageserver"))]
#[cfg(any(feature = "cli", feature = "languageserver", feature = "emit"))]
pub(crate) fn lookup_meta_by_hash(
&self,
hash: Hash,
Expand Down Expand Up @@ -508,7 +508,7 @@ impl Context {
}

/// Get all associated types for the given hash.
#[cfg(feature = "doc")]
#[cfg(feature = "cli")]
pub(crate) fn associated(&self, hash: Hash) -> impl Iterator<Item = Hash> + '_ {
self.associated
.get(&hash)
Expand All @@ -519,7 +519,7 @@ impl Context {
}

/// Get all traits implemented for the given hash.
#[cfg(feature = "doc")]
#[cfg(feature = "cli")]
pub(crate) fn traits(&self, hash: Hash) -> impl Iterator<Item = Hash> + '_ {
self.implemented_traits
.get(&hash)
Expand All @@ -546,7 +546,7 @@ impl Context {
}

/// Iterate over available crates.
#[cfg(feature = "doc")]
#[cfg(feature = "cli")]
pub(crate) fn iter_crates(&self) -> impl Iterator<Item = &str> {
self.crates.iter().map(|s| s.as_ref())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rune/src/compile/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Docs {
}

/// Get lines of documentation.
#[cfg(feature = "doc")]
#[cfg(all(feature = "doc", any(feature = "languageserver", feature = "cli")))]
pub(crate) fn lines(&self) -> &[String] {
&self.docs
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rune/src/compile/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub enum Kind {

impl Kind {
/// Access the underlying signature of the kind, if available.
#[cfg(feature = "doc")]
#[cfg(all(feature = "doc", any(feature = "languageserver", feature = "cli")))]
pub(crate) fn as_signature(&self) -> Option<&Signature> {
match self {
Kind::Struct { constructor, .. } => constructor.as_ref(),
Expand Down Expand Up @@ -424,7 +424,7 @@ pub(crate) enum DocName {
Index(#[try_clone(copy)] usize),
}

#[cfg(feature = "doc")]
#[cfg(feature = "cli")]
impl DocName {
pub(crate) fn is_self(&self) -> bool {
match self {
Expand Down
9 changes: 9 additions & 0 deletions crates/rune/src/doc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
//! Helper to generate documentation from a context.
#[cfg(feature = "cli")]
mod context;
#[cfg(feature = "cli")]
use self::context::Context;

#[cfg(feature = "cli")]
mod artifacts;
#[cfg(feature = "cli")]
pub(crate) use self::artifacts::{Artifacts, TestParams};

#[cfg(feature = "cli")]
mod templating;

#[cfg(feature = "cli")]
mod build;
#[cfg(feature = "cli")]
pub(crate) use self::build::build;

#[cfg(any(feature = "languageserver", feature = "cli"))]
mod visitor;
#[cfg(any(feature = "languageserver", feature = "cli"))]
pub(crate) use self::visitor::{Visitor, VisitorData};
4 changes: 4 additions & 0 deletions crates/rune/src/doc/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ use crate::item::IntoComponent;
use crate::{Hash, Item, ItemBuf};

pub(crate) struct VisitorData {
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
pub(crate) item: ItemBuf,
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
pub(crate) hash: Hash,
pub(crate) kind: Option<meta::Kind>,
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
pub(crate) deprecated: Option<String>,
pub(crate) docs: Vec<String>,
pub(crate) field_docs: HashMap<Box<str>, Vec<String>>,
Expand Down Expand Up @@ -71,6 +74,7 @@ impl Visitor {
}

/// Get meta by item.
#[cfg(feature = "cli")]
pub(crate) fn get(&self, item: &Item) -> Option<&VisitorData> {
let hash = self.item_to_hash.get(item)?;
self.data.get(hash)
Expand Down
1 change: 1 addition & 0 deletions crates/rune/src/runtime/unit/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ cfg_std! {
enum EncodeErrorKind {
#[cfg(feature = "byte-code")]
StorageError {
#[cfg_attr(not(feature = "std"), allow(dead_code))]
error: storage::Error,
},
AllocError {
Expand Down

0 comments on commit 87b355d

Please sign in to comment.