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

Improve doctests #848

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export NATIVE_DEBUG_TRAP_AT_STMT=10
The trap instruction may not end up exactly where the statement is.

If we want to manually set the breakpoint (for example, when executing a particular libfunc), then we can use the `DebugUtils` metadata in the code.
```rust,ignore
```rust,no_run
#[cfg(feature = "with-debug-utils")]
{
metadata.get_mut::<DebugUtils>()
Expand Down Expand Up @@ -65,7 +65,7 @@ export RUST_LOG="cairo_native=trace"
- Try to find the minimal program to reproduce an issue, the more isolated the easier to test.
- Use the `debug_utils` print utilities, more info [here](https://lambdaclass.github.io/cairo_native/cairo_native/metadata/debug_utils/struct.DebugUtils.html):

```rust,ignore
```rust,no_run
#[cfg(feature = "with-debug-utils")]
{
metadata.get_mut::<DebugUtils>()
Expand Down Expand Up @@ -139,7 +139,7 @@ hash, but a chain of contract/library calls.
To know which contract is being called we can add some debugging prints in
the replay that logs contract executions. For example:

```rust,ignore
```rust,no_run
impl StarknetSyscallHandler for ReplaySyscallHandler {
// ...

Expand Down Expand Up @@ -204,7 +204,7 @@ An idea on how to do that is modifying Cairo native so that it adds a
breakpoint every time a constant with that error message is generated.
For example:

```rust,ignore
```rust,no_run
/// Generate MLIR operations for the `felt252_const` libfunc.
pub fn build_const<'ctx, 'this>(
context: &'ctx Context,
Expand Down
2 changes: 1 addition & 1 deletion docs/execution_walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Given the following Cairo program:

```rust,ignore
```rust
// This is the cairo program. It just adds two numbers together and returns the
// result in an enum whose variant is selected using the result's parity.
enum Parity<T> {
Expand Down
4 changes: 2 additions & 2 deletions docs/gas_builtin_accounting.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ amount being withdrawn.
### Example
Let's illustrate this with a simple example using the following Cairo 1 code:

```rust,ignore
```rust,no_run
fn run_test() {
let mut i: u8 = 0;
let mut val = 0;
Expand Down Expand Up @@ -174,7 +174,7 @@ called from within the program.
### Example
Let us consider the following Cairo program which uses the `pedersen` builtin:

```rust,ignore
```rust,no_run
use core::integer::bitwise;
use core::pedersen::pedersen;

Expand Down
4 changes: 2 additions & 2 deletions docs/implementing_libfuncs.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Libfuncs are implemented under `src/libfuncs.rs` and

Using the `src/libfuncs/felt252.rs` libfuncs as a aid:

```rust,ignore
```rust,no_run
/// Select and call the correct libfunc builder function from the selector.
pub fn build<'ctx, 'this, TType, TLibfunc>(
context: &'ctx Context,
Expand Down Expand Up @@ -107,7 +107,7 @@ the `src/libfuncs.rs` match statement.
### Example libfunc implementation: u8_to_felt252
An example libfunc, converting a u8 to a felt252, extensively commented:

```rust,ignore
```rust,no_run
/// Generate MLIR operations for the `u8_to_felt252` libfunc.
pub fn build_to_felt252<'ctx, 'this, TType, TLibfunc>(
// The Context from MLIR, this is like the heart of the MLIR API, its required to create most stuff like types.
Expand Down
6 changes: 3 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ lowering to LLVM.
compiled sierra programs from an entrypoint. Programs and JIT states can be
cached in contexts where their execution will be done multiple times.

```rust,ignore
```rust,no_run
use starknet_types_core::felt::Felt;
use cairo_native::context::NativeContext;
use cairo_native::executor::JitNativeExecutor;
Expand Down Expand Up @@ -182,7 +182,7 @@ execute a program using the JIT.

Example code to run a program:

```rust,ignore
```rust,no_run
use starknet_types_core::felt::Felt;
use cairo_native::context::NativeContext;
use cairo_native::executor::NativeExecutor;
Expand Down Expand Up @@ -225,7 +225,7 @@ fn main() {

Example code to run a Starknet contract:

```rust,ignore
```rust,no_run
use starknet_types_core::felt::Felt;
use cairo_lang_compiler::CompilerConfig;
use cairo_lang_starknet::contract_class::compile_path;
Expand Down
2 changes: 1 addition & 1 deletion src/metadata/debug_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! ## Example
//!
//! ```rust,ignore
//! ```rust,no_run
//! # use cairo_lang_sierra::{
//! # extensions::{
//! # core::{CoreLibfunc, CoreType},
Expand Down
Loading