Skip to content

Commit

Permalink
Doc comment custom MIR debuginfo.
Browse files Browse the repository at this point in the history
and add a test for the constant case
  • Loading branch information
cjgillot authored and gitbot committed Feb 20, 2025
1 parent ba3ecc8 commit fcb2927
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,30 @@
//! `Call(ret_val = function(arg1, arg2, ...), ReturnTo(next_block), UnwindContinue())`.
//! - [`TailCall`] does not have a return destination or next block, so its syntax is just
//! `TailCall(function(arg1, arg2, ...))`.
//!
//! #### Debuginfo
//!
//! - A debuginfo name can be given to a local using `debug my_name => contents;`.
//! For `contents`, we use the same syntax as operands, to support both places and constants.
//!
//! ```rust
//! #![allow(internal_features)]
//! #![feature(core_intrinsics, custom_mir)]
//!
//! use core::intrinsics::mir::*;
//!
//! #[custom_mir(dialect = "built")]
//! fn debuginfo(option: Option<&i32>) {
//! mir!(
//! debug option => option;
//! debug projection => *Field::<&i32>(Variant(option, 1), 0);
//! debug constant => 5_usize;
//! {
//! Return()
//! }
//! )
//! }
//! ```
#![unstable(
feature = "custom_mir",
Expand Down

0 comments on commit fcb2927

Please sign in to comment.