8000 More bare file execution by udoprog · Pull Request #780 · rune-rs/rune · GitHub
[go: up one dir, main page]

Skip to content

More bare file execution #780

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

Merged
merged 4 commits into from
Jul 27, 2024
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo run --bin rune -- fmt --experimental --recursive --verbose --check tools scripts
- run: cargo run --bin rune -- fmt --recursive --verbose --check

clippy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -156,6 +156,5 @@ jobs:
- run: cargo build -p rune --no-default-features --features alloc
- run: cargo test --all-targets
- run: cargo test --doc
- run: cargo run --bin rune -- check --recursive --experimental --path scripts
- run: cargo run --bin rune -- test --recursive --experimental --path scripts
- run: cargo run --bin rune -- check --recursive scripts
- run: cargo run --bin rune -- test -O test-std=true
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-targets
- run: cargo test --doc
- run: cargo run --bin rune -- check --recursive --experimental --path scripts
- run: cargo run --bin rune -- test --recursive --experimental --path scripts
- run: cargo run --bin rune -- check --recursive --path scripts
- run: cargo run --bin rune -- test --recursive --path scripts

build:
runs-on: ${{matrix.os}}
Expand Down
10 changes: 5 additions & 5 deletions book/src/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A typical example would be if we want to perform multiple HTTP requests at once:
```

```text
$> cargo run --bin rune -- run scripts/book/async/async_http.rn
$> cargo run -- run scripts/book/async/async_http.rn
200 OK
200 OK
```
Expand All @@ -37,7 +37,7 @@ timeout:
```

```text
$> cargo run --bin rune -- run scripts/book/async/async_http_timeout.rn
$> cargo run -- run scripts/book/async/async_http_timeout.rn
200 OK
Request timed out!
```
Expand All @@ -63,7 +63,7 @@ is only permitted inside of `async` functions and closures.
```

```text
$> cargo run --bin rune -- run scripts/book/async/async_http_concurrent.rn
$> cargo run -- run scripts/book/async/async_http_concurrent.rn
Result: 200 OK
Request timed out!
```
Expand All @@ -78,7 +78,7 @@ produce a future.
```

```text
$> cargo run --bin rune -- run scripts/book/async/async_closure.rn
$> cargo run -- run scripts/book/async/async_closure.rn
Status: 200 OK
```

Expand All @@ -92,6 +92,6 @@ can capture variables the same way as closures do, but take no arguments.
```

```text
$> cargo run --bin rune -- run scripts/book/async/async_blocks.rn
$> cargo run -- run scripts/book/async/async_blocks.rn
Status: 200 OK
```
2 changes: 1 addition & 1 deletion book/src/call_frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To look close at the mechanism, let's trace the following program:
```

```text
$> cargo run --bin rune -- run scripts/book/the_stack/call_and_add.rn --trace --dump-stack
$> cargo run -- run scripts/book/the_stack/call_and_add.rn --trace --dump-stack
fn main() (0xe7fc1d6083100dcd):
0005 = integer 3
0+0 = 3
Expand Down
6 changes: 3 additions & 3 deletions book/src/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ represents the operation you want another function to use.
```

```text
$> cargo run --bin rune -- run scripts/book/closures/function_pointers.rn
$> cargo run -- run scripts/book/closures/function_pointers.rn
Result: 3
Result: -1
```
Expand All @@ -36,7 +36,7 @@ them to be used when the function is being called.
```

```text
$> cargo run --bin rune -- run scripts/book/closures/basic_closure.rn
$> cargo run -- run scripts/book/closures/basic_closure.rn
Result: 4
Result: 3
```
Expand Down Expand Up @@ -76,7 +76,7 @@ cause a compile error.
```

```text
$> cargo run --bin rune -- run scripts/book/closures/closure_move.rn.fail
$> cargo run -- run scripts/book/closures/closure_move.rn.fail
error: compile error
┌─ scripts/book/closures/closure_move.rn.fail:7:33
Expand Down
8 changes: 4 additions & 4 deletions book/src/compiler_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Consider the following unit:
Let's dump all dynamic functions in it:

```text
$> cargo run --bin rune -- run scripts/book/compiler_guide/dead_code.rn --dump-functions
$> cargo run -- run scripts/book/compiler_guide/dead_code.rn --dump-functions --warnings
# dynamic functions
0xe7fc1d6083100dcd = main()
0x20c6d8dd92b51018 = main::$0::foo()
0x0 = {root}()
0x481411c4bd0a5f6 = foo()
---
== 2 (59.8µs)
```
Expand Down Expand Up @@ -106,7 +106,7 @@ script:
```

```text
$> cargo run --bin rune -- run scripts/book/compiler_guide/closures.rn --emit-instructions --dump-functions
$> cargo run -- run scripts/book/compiler_guide/closures.rn --emit-instructions --dump-functions
# instructions
fn main() (0x1c69d5964e831fc1):
0000 = load-fn hash=0xbef6d5f6276cd45e // closure `3`
Expand Down
10 changes: 5 additions & 5 deletions book/src/control_flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ what the function returns by default unless a `return` is specified.
```

```text
$> cargo run --bin rune -- run scripts/book/control_flow/numbers_game.rn
$> cargo run -- run scripts/book/control_flow/numbers_game.rn
less than one
something else
```
Expand All @@ -33,7 +33,7 @@ If the condition is `true`, the provided block of code will run.
```

```text
$> cargo run --bin rune -- run scripts/book/control_flow/conditional.rn
$> cargo run -- run scripts/book/control_flow/conditional.rn
The number *is* smaller than 5
```

Expand All @@ -45,7 +45,7 @@ the condition is false.
```

```text
$> cargo run --bin rune -- run scripts/book/control_flow/conditional_else.rn
$> cargo run -- run scripts/book/control_flow/conditional_else.rn
the number is smaller than 5
```

Expand All @@ -57,7 +57,7 @@ specify many different conditions.
```

```text
$> cargo run --bin rune -- run scripts/book/control_flow/conditional_else_ifs.rn
$> cargo run -- run scripts/book/control_flow/conditional_else_ifs.rn
the number is smaller than 5
```

Expand All @@ -71,6 +71,6 @@ This will be covered in a later section, but here is a sneak peek:
```

```text
$> cargo run --bin rune -- run scripts/book/control_flow/first_match.rn
$> cargo run -- run scripts/book/control_flow/first_match.rn
the number is smaller than 5
```
2 changes: 1 addition & 1 deletion book/src/dynamic_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ The following is a quick example of a `struct`:
```

```text
$> cargo run --bin rune -- run scripts/book/dynamic_types/greeting.rn
$> cargo run -- run scripts/book/dynamic_types/greeting.rn
Greetings from John-John Tedro, and good luck with this section!
```
2 changes: 1 addition & 1 deletion book/src/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ absent with `Option::None`.
```

```text
$> cargo run --bin rune -- run scripts/book/enums/count_numbers.rn
$> cargo run -- run scripts/book/enums/count_numbers.rn
First count!
Count: 0
Count: 1
Expand Down
4 changes: 2 additions & 2 deletions book/src/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ simply what the Rune cli looks for when deciding what to execute.
```

```text
$> cargo run --bin rune -- run scripts/book/functions/main_function.rn
$> cargo run -- run scripts/book/functions/main_function.rn
Hello World
```

Expand All @@ -34,7 +34,7 @@ anything, even completely distinct types.
```

```text
$> cargo run --bin rune -- run scripts/book/functions/return_value.rn
$> cargo run -- run scripts/book/functions/return_value.rn
Hello
1
```
Expand Down
14 changes: 7 additions & 7 deletions book/src/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ numbers.
```

```text
$> cargo run --bin rune -- run scripts/book/generators/fib_generator.rn
$> cargo run -- run scripts/book/generators/fib_generator.rn
0
1
1
Expand Down Expand Up @@ -44,7 +44,7 @@ allowing the calling procedure to send values to the generator.
```

```text
$> cargo run --bin rune -- run scripts/book/generators/send_values.rn
$> cargo run -- run scripts/book/generators/send_values.rn
"John"
(1, 2, 3)
```
Expand All @@ -61,7 +61,7 @@ instrumenting our code a little.
```

```text
$> cargo run --bin rune -- run scripts/book/generators/bootup.rn
$> cargo run -- run scripts/book/generators/bootup.rn
firing off the printer...
waiting for value...
ready to go!
Expand All @@ -83,7 +83,7 @@ possible states a generator can suspend itself into.
```

```text
$> cargo run --bin rune -- run scripts/book/generators/states.rn
$> cargo run -- run scripts/book/generators/states.rn
Yielded(1)
"John"
Complete(2)
Expand All @@ -103,14 +103,14 @@ error.
```

```text
$> cargo run --bin rune -- run scripts/book/generators/error.rn
$> cargo run -- run scripts/book/generators/error.rn
Generator { completed: false }
Yielded(1)
Complete("John")
Generator { completed: true }
error: virtual machine error
┌─ scripts/book/generators/error.rn:11:9
11 │ dbg(printer.resume(()));
│ ^^^^^^^^^^^^^^^^^^ cannot resume a generator that has completed
11 │ dbg!(printer.resume(()));
^^^^^^^^^^^^^^^^^^ cannot resume a generator that has completed
```
4 changes: 2 additions & 2 deletions book/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ be provided to it, and it will do its best to describe it.
> **Note**: by convention Rune uses files ending in .rn.

```text
$> cargo run --bin rune -- run scripts/book/getting_started/dbg.rn
$> cargo run -- run scripts/book/getting_started/dbg.rn
[1, 2, 3]
'今'
dynamic function (at: 0x1a)
Expand All @@ -36,7 +36,7 @@ So for a more formal introduction, here is the official Rune `"Hello World"`:
```

```text
$> cargo run --bin rune -- run scripts/book/getting_started/hello_world.rn
$> cargo run -- run scripts/book/getting_started/hello_world.rn
Hello World
```

Expand Down
2 changes: 1 addition & 1 deletion book/src/instance_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ instance functions must be looked up at runtime.
```

```text
$> cargo run --bin rune -- run scripts/book/instance_functions/missing_instance_fn.rn
$> cargo run -- run scripts/book/instance_functions/missing_instance_fn.rn
error: virtual machine error
┌─ scripts/book/instance_functions/missing_instance_fn.rn:11:5
Expand Down
10 changes: 5 additions & 5 deletions book/src/items_imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ statement:
```

```text
$> cargo run --bin rune -- run scripts/book/items_imports/example_import.rn
$> cargo run -- run scripts/book/items_imports/example_import.rn
std::iter::Range
```

Expand All @@ -33,7 +33,7 @@ Trying to use an item which doesn't exist results in a compile error:
```

```text
$> cargo run --bin rune -- run scripts/book/items_imports/missing_item.rn.fail
$> cargo run -- run scripts/book/items_imports/missing_item.rn.fail
error: compile error
┌─ scripts/book/items_imports/missing_item.rn.fail:2:15
Expand All @@ -58,7 +58,7 @@ The following is an example of an *inline* module:
```

```text
$> cargo run --bin rune -- run scripts/book/items_imports/inline_modules.rn
$> cargo run -- run scripts/book/items_imports/inline_modules.rn
3
```

Expand All @@ -80,7 +80,7 @@ separate files:
```

```text
$> cargo run --bin rune -- run scripts/book/items_imports/modules.rn
$> cargo run -- run scripts/book/items_imports/modules.rn
3
```

Expand All @@ -100,7 +100,7 @@ To this end Rune supports the following Rust keywords:
```

```text
$> cargo run --bin rune -- run scripts/book/items_imports/item_keywords.rn
$> cargo run -- run scripts/book/items_imports/item_keywords.rn
7
```

Expand Down
6 changes: 3 additions & 3 deletions book/src/loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ currently in and continue running right after it.
```

```text
$> cargo run --bin rune -- run scripts/book/loops/while_loop.rn
$> cargo run -- run scripts/book/loops/while_loop.rn
The value is 50
```

Expand All @@ -33,7 +33,7 @@ control flow operator like a `break` or a `return`.
```

```text
$> cargo run --bin rune -- run scripts/book/loops/loop_forever.rn
$> cargo run -- run scripts/book/loops/loop_forever.rn
Hello forever!
Hello forever!
Hello forever!
Expand All @@ -53,6 +53,6 @@ When broken out of, loops produce the value provided as an argument to the
```

```text
$> cargo run --bin rune -- run scripts/book/loops/loop_break.rn
$> cargo run -- run scripts/book/loops/loop_break.rn
The final count is: 11
```
Loading
Loading
0