Files
oxc-project__oxc/crates/oxc_semantic/Cargo.toml
camc314 50201a465e chore(semantic): gate cfg example behind feature (#25609)
Before, when running semantic's CFG example, we would get a cryptic message talking about the problem.
```
$ cargo run -p oxc_semantic --example cfg --
   Compiling oxc_semantic v0.144.0 (/Users/cameron/.codex/worktrees/6012/oxc/crates/oxc_semantic)
error[E0601]: `main` function not found in crate `cfg`
   --> crates/oxc_semantic/examples/cfg.rs:169:2
    |
169 | }
    |  ^ consider adding a `main` function to `crates/oxc_semantic/examples/cfg.rs`

For more information about this error, try `rustc --explain E0601`.
error: could not compile `oxc_semantic` (example "cfg") due to 1 previous error
```

After, we get a clear message explaining how to fix the issue and run the example.
```
$ cargo run -p oxc_semantic --example cfg --
error: target `cfg` in package `oxc_semantic` requires the features: `cfg`
Consider enabling them by passing, e.g., `--features="cfg
```

Docs: https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-required-features-field
2026-08-13 16:16:04 +00:00

58 lines
1.4 KiB
TOML

[package]
name = "oxc_semantic"
version = "0.144.0"
authors.workspace = true
categories.workspace = true
edition.workspace = true
homepage.workspace = true
include = ["/examples", "/src"]
keywords.workspace = true
license.workspace = true
publish = true
repository.workspace = true
rust-version.workspace = true
description.workspace = true
[lints]
workspace = true
[lib]
doctest = true
[[example]]
name = "cfg"
required-features = ["cfg"]
[dependencies]
oxc_allocator = { workspace = true, features = ["bitset"] }
oxc_ast = { workspace = true }
oxc_ast_visit = { workspace = true }
oxc_cfg = { workspace = true, optional = true }
oxc_data_structures = { workspace = true }
oxc_diagnostics = { workspace = true }
oxc_ecmascript = { workspace = true }
oxc_index = { workspace = true }
oxc_jsdoc = { workspace = true, optional = true }
oxc_span = { workspace = true }
oxc_str = { workspace = true }
oxc_syntax = { workspace = true, features = ["to_js_string"] }
itertools = { workspace = true }
memchr = { workspace = true }
rustc-hash = { workspace = true }
self_cell = { workspace = true }
smallvec = { workspace = true }
[dev-dependencies]
insta = { workspace = true, features = ["glob"] }
oxc_parser = { workspace = true }
rustc-hash = { workspace = true }
serde_json = { workspace = true }
[features]
default = []
cfg = ["dep:oxc_cfg"]
jsdoc = ["dep:oxc_jsdoc"]
linter = ["jsdoc"]
serialize = ["oxc_span/serialize", "oxc_syntax/serialize"]