Skip to content

Commit f1fc572

Browse files
committed
chore: Add missing feature flag
1 parent de84152 commit f1fc572

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
strategy:
117117
fail-fast: false
118118
matrix:
119-
feature: [capture-io, "cli,doc", "cli,fmt", cli, workspace, languageserver, byte-code]
119+
feature: [capture-io, "cli,doc", "cli,fmt", cli, workspace, languageserver, byte-code, emit]
120120
env:
121121
RUSTFLAGS: -D warnings
122122
steps:

crates/rune/src/compile/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl Context {
478478
}
479479

480480
/// Lookup meta by its hash.
481-
#[cfg(any(feature = "cli", feature = "languageserver"))]
481+
#[cfg(any(feature = "cli", feature = "languageserver", feature = "emit"))]
482482
pub(crate) fn lookup_meta_by_hash(
483483
&self,
484484
hash: Hash,
@@ -508,7 +508,7 @@ impl Context {
508508
}
509509

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

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

548548
/// Iterate over available crates.
549-
#[cfg(feature = "doc")]
549+
#[cfg(all(feature = "doc", feature = "cli"))]
550550
pub(crate) fn iter_crates(&self) -> impl Iterator<Item = &str> {
551551
self.crates.iter().map(|s| s.as_ref())
552552
}

crates/rune/src/compile/docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Docs {
3232
}
3333

3434
/// Get lines of documentation.
35-
#[cfg(feature = "doc")]
35+
#[cfg(all(feature = "doc", any(feature = "languageserver", feature = "cli")))]
3636
pub(crate) fn lines(&self) -> &[String] {
3737
&self.docs
3838
}

crates/rune/src/compile/meta.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub enum Kind {
241241

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

427-
#[cfg(feature = "doc")]
427+
#[cfg(all(feature = "doc", feature = "cli"))]
428428
impl DocName {
429429
pub(crate) fn is_self(&self) -> bool {
430430
match self {

crates/rune/src/doc/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
//! Helper to generate documentation from a context.
22
3+
#[cfg(feature = "cli")]
34
mod context;
5+
#[cfg(feature = "cli")]
46
use self::context::Context;
57

8+
#[cfg(feature = "cli")]
69
mod artifacts;
10+
#[cfg(feature = "cli")]
711
pub(crate) use self::artifacts::{Artifacts, TestParams};
812

13+
#[cfg(feature = "cli")]
914
mod templating;
1015

16+
#[cfg(feature = "cli")]
1117
mod build;
18+
#[cfg(feature = "cli")]
1219
pub(crate) use self::build::build;
1320

21+
#[cfg(any(feature = "languageserver", feature = "cli"))]
1422
mod visitor;
23+
#[cfg(any(feature = "languageserver", feature = "cli"))]
1524
pub(crate) use self::visitor::{Visitor, VisitorData};

crates/rune/src/doc/visitor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ use crate::item::IntoComponent;
88
use crate::{Hash, Item, ItemBuf};
99

1010
pub(crate) struct VisitorData {
11+
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
1112
pub(crate) item: ItemBuf,
13+
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
1214
pub(crate) hash: Hash,
1315
pub(crate) kind: Option<meta::Kind>,
16+
#[cfg_attr(not(feature = "cli"), allow(dead_code))]
1417
pub(crate) deprecated: Option<String>,
1518
pub(crate) docs: Vec<String>,
1619
pub(crate) field_docs: HashMap<Box<str>, Vec<String>>,
@@ -71,6 +74,7 @@ impl Visitor {
7174
}
7275

7376
/// Get meta by item.
77+
#[cfg(feature = "cli")]
7478
pub(crate) fn get(&self, item: &Item) -> Option<&VisitorData> {
7579
let hash = self.item_to_hash.get(item)?;
7680
self.data.get(hash)

crates/rune/src/runtime/unit/storage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ cfg_std! {
197197
enum EncodeErrorKind {
198198
#[cfg(feature = "byte-code")]
199199
StorageError {
200+
#[cfg_attr(not(feature = "std"), allow(dead_code))]
200201
error: storage::Error,
201202
},
202203
AllocError {

0 commit comments

Comments
 (0)