Skip to content

Commit

Permalink
Mark example code blocks that we don't expect to be able to actually …
Browse files Browse the repository at this point in the history
…run in isolation with `ignore`.

Without this, `cargo test` tries to extract all rustdoc comments and run them as a unit test. For these snippets, we can't easily actually make such a snippet work, as they explain how codegen would be used.

PiperOrigin-RevId: 688643028
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Oct 22, 2024
1 parent c6753b9 commit 12c87c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rust/codegen_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ pub(crate) mod interop {
/// This takes a ref of a pointer so that a stack variable's lifetime
/// can be used for a safe lifetime; under most cases this is
/// the correct lifetime and this should be used as:
/// ```
/// ```ignore
/// fn called_from_cpp(msg: *const c_void) {
/// // `msg` is known live for the current stack frame, so view's
/// // lifetime is also tied to the current stack frame here:
/// let view = unsafe { __unstable_wrap_raw_message(&msg); }
/// let view = unsafe { __unstable_wrap_raw_message(&msg) };
/// do_something_with_view(view);
/// }
/// ```
Expand Down Expand Up @@ -205,11 +205,11 @@ pub(crate) mod interop {
/// This takes a ref of a pointer so that a stack variable's lifetime
/// can be used for a safe lifetime; under most cases this is
/// the correct lifetime and this should be used as:
/// ```
/// ```ignore
/// fn called_from_cpp(msg: *mut c_void) {
/// // `msg` is known live for the current stack frame, so mut's
/// // lifetime is also tied to the current stack frame here:
/// let m = unsafe { __unstable_wrap_raw_message_mut(&mut msg); }
/// let m = unsafe { __unstable_wrap_raw_message_mut(&mut msg) };
/// do_something_with_mut(m);
/// }
///
Expand Down

0 comments on commit 12c87c9

Please sign in to comment.