Skip to content

Commit

Permalink
doc(runtime-c-api) Declare the example as C, so that they are not tes…
Browse files Browse the repository at this point in the history
…ted.

Those examples contain C code. They must not be run by `rustdoc` as
tests.
  • Loading branch information
Hywan committed Mar 6, 2019
1 parent 365d009 commit d709191
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/runtime-c-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,8 @@ fn take_last_error() -> Option<Box<Error>> {
/// bytes needed to store a message.
///
/// # Example
/// ```
///
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// ```
Expand All @@ -1517,7 +1518,8 @@ pub extern "C" fn wasmer_last_error_length() -> c_int {
/// Returns `-1` if an error occurs.
///
/// # Example
/// ```
///
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// wasmer_last_error_message(error_str, error_len);
Expand Down
4 changes: 2 additions & 2 deletions lib/runtime-c-api/wasmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ wasmer_result_t wasmer_instantiate(wasmer_instance_t **instance,
* This can be used to dynamically allocate a buffer with the correct number of
* bytes needed to store a message.
* # Example
* ```
* ```c
* int error_len = wasmer_last_error_length();
* char *error_str = malloc(error_len);
* ```
Expand All @@ -430,7 +430,7 @@ int wasmer_last_error_length(void);
* Returns the length of the string in bytes.
* Returns `-1` if an error occurs.
* # Example
* ```
* ```c
* int error_len = wasmer_last_error_length();
* char *error_str = malloc(error_len);
* wasmer_last_error_message(error_str, error_len);
Expand Down
4 changes: 2 additions & 2 deletions lib/runtime-c-api/wasmer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ wasmer_result_t wasmer_instantiate(wasmer_instance_t **instance,
/// This can be used to dynamically allocate a buffer with the correct number of
/// bytes needed to store a message.
/// # Example
/// ```
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// ```
Expand All @@ -344,7 +344,7 @@ int wasmer_last_error_length();
/// Returns the length of the string in bytes.
/// Returns `-1` if an error occurs.
/// # Example
/// ```
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// wasmer_last_error_message(error_str, error_len);
Expand Down

0 comments on commit d709191

Please sign in to comment.