Skip to content

Commit bc66500

Browse files
cjgillotgitbot
authored and
gitbot
committed
Doc comment custom MIR debuginfo.
and add a test for the constant case
1 parent 0981b93 commit bc66500

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

core/src/intrinsics/mir.rs

+24
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,30 @@
249249
//! `Call(ret_val = function(arg1, arg2, ...), ReturnTo(next_block), UnwindContinue())`.
250250
//! - [`TailCall`] does not have a return destination or next block, so its syntax is just
251251
//! `TailCall(function(arg1, arg2, ...))`.
252+
//!
253+
//! #### Debuginfo
254+
//!
255+
//! - A debuginfo name can be given to a local using `debug my_name => contents;`.
256+
//! For `contents`, we use the same syntax as operands, to support both places and constants.
257+
//!
258+
//! ```rust
259+
//! #![allow(internal_features)]
260+
//! #![feature(core_intrinsics, custom_mir)]
261+
//!
262+
//! use core::intrinsics::mir::*;
263+
//!
264+
//! #[custom_mir(dialect = "built")]
265+
//! fn debuginfo(option: Option<&i32>) {
266+
//! mir!(
267+
//! debug option => option;
268+
//! debug projection => *Field::<&i32>(Variant(option, 1), 0);
269+
//! debug constant => 5_usize;
270+
//! {
271+
//! Return()
272+
//! }
273+
//! )
274+
//! }
275+
//! ```
252276
253277
#![unstable(
254278
feature = "custom_mir",

0 commit comments

Comments
 (0)