Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework how associated function meta is structured #512

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 50 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,31 @@ on:
- main

jobs:
msrv:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo build --workspace
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check

test:
runefmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --bin rune -- fmt --experimental --recursive --verbose --workspace tools scripts

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo build -p rune --no-default-features
- run: cargo build -p rune --no-default-features --features capture-io
- run: cargo test --workspace --exclude no-std-examples --all-targets
- run: cargo test --workspace --exclude no-std-examples --doc
- run: cargo run --bin rune -- check --recursive --experimental scripts
- run: cargo run --bin rune -- test --recursive --experimental scripts
- run: cargo clippy --workspace --exclude no-std-examples --exclude generate --all-features --all-targets -- -D warnings

docs:
runs-on: ubuntu-latest
Expand All @@ -39,38 +44,57 @@ jobs:
RUSTFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs

wasm:
msrv:
runs-on: ubuntu-latest
needs: [rustfmt, runefmt, clippy, docs]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo build -p rune-wasm --target wasm32-unknown-unknown
- run: cargo build --workspace

rustfmt:
no_default_features:
runs-on: ubuntu-latest
needs: [rustfmt, runefmt, clippy, docs]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
- uses: Swatinem/rust-cache@v2
- run: cargo build -p rune --no-default-features

runefmt:
build_feature:
runs-on: ubuntu-latest
needs: [rustfmt, runefmt, clippy, docs]
strategy:
fail-fast: false
matrix:
feature: [capture-io, doc, cli, workspace]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --bin rune -- fmt --experimental --recursive --verbose --workspace tools scripts
- uses: Swatinem/rust-cache@v2
- run: cargo build -p rune --no-default-features --features ${{matrix.feature}}

clippy:
wasm:
runs-on: ubuntu-latest
needs: [rustfmt, runefmt, clippy, docs]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.68
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace --exclude no-std-examples --exclude generate --all-features --all-targets -- -D warnings
- run: cargo build -p rune-wasm --target wasm32-unknown-unknown

test:
runs-on: ubuntu-latest
needs: [no_default_features, build_feature, docs, msrv, wasm]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build -p rune --no-default-features
- run: cargo test --workspace --exclude no-std-examples --all-targets
- run: cargo test --workspace --exclude no-std-examples --doc
- run: cargo run --bin rune -- check --recursive --experimental scripts
- run: cargo run --bin rune -- test --recursive --experimental scripts
8 changes: 4 additions & 4 deletions crates/rune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ categories = ["parser-implementations"]

[features]
default = ["emit", "std"]
emit = ["codespan-reporting"]
emit = ["std", "codespan-reporting"]
bench = []
workspace = ["toml", "semver", "relative-path", "serde-hashkey", "linked-hash-map"]
doc = ["rust-embed", "handlebars", "pulldown-cmark", "syntect", "sha2", "base64", "rune-core/doc"]
cli = ["doc", "bincode", "atty", "tracing-subscriber", "clap", "webbrowser", "capture-io", "disable-io", "languageserver", "fmt", "similar"]
workspace = ["std", "toml", "semver", "relative-path", "serde-hashkey", "linked-hash-map"]
doc = ["std", "rust-embed", "handlebars", "pulldown-cmark", "syntect", "sha2", "base64", "rune-core/doc", "relative-path"]
cli = ["std", "emit", "doc", "bincode", "atty", "tracing-subscriber", "clap", "webbrowser", "capture-io", "disable-io", "languageserver", "fmt", "similar"]
languageserver = ["lsp", "ropey", "percent-encoding", "url", "serde_json", "tokio", "tokio/macros", "tokio/io-std", "workspace", "doc"]
capture-io = ["parking_lot"]
disable-io = []
Expand Down
6 changes: 4 additions & 2 deletions crates/rune/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ pub(super) async fn run(
if args.dump_native_functions {
writeln!(io.stdout, "# functions")?;

for (i, (hash, f)) in context.iter_functions().enumerate() {
writeln!(io.stdout, "{:04} = {} ({})", i, f, hash)?;
for (i, (meta, _)) in context.iter_functions().enumerate() {
if let Some(item) = &meta.item {
writeln!(io.stdout, "{:04} = {} ({})", i, item, meta.hash)?;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rune/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) mod meta_info;
pub use meta_info::MetaInfo;

mod docs;
pub use self::docs::Docs;
pub(crate) use self::docs::Docs;

mod prelude;
pub(crate) use self::prelude::Prelude;
Expand Down
Loading