File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
library/core/src/intrinsics
tests/mir-opt/building/custom Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 254
254
//! - A debuginfo name can be given to a local using `debug my_name => contents;`.
255
255
//! For `contents`, we use the same syntax as operands, to support both places and constants.
256
256
//!
257
+ //! ```rust
258
+ //! #![allow(internal_features)]
259
+ //! #![feature(core_intrinsics, custom_mir)]
260
+ //!
261
+ //! use core::intrinsics::mir::*;
262
+ //!
263
+ //! #[custom_mir(dialect = "built")]
264
+ //! fn debuginfo(option: Option<&i32>) {
265
+ //! mir!(
266
+ //! debug option => option;
267
+ //! debug projection => *Field::<&i32>(Variant(option, 1), 0);
268
+ //! debug constant => 5_usize;
269
+ //! {
270
+ //! Return()
271
+ //! }
272
+ //! )
273
+ //! }
274
+ //! ```
257
275
258
276
#![ unstable(
259
277
feature = "custom_mir" ,
Original file line number Diff line number Diff line change @@ -63,10 +63,22 @@ fn variant_deref(opt: Option<&i32>) {
63
63
)
64
64
}
65
65
66
+ // EMIT_MIR debuginfo.constant.built.after.mir
67
+ #[ custom_mir( dialect = "built" ) ]
68
+ fn constant ( ) {
69
+ mir ! (
70
+ debug scalar => 5_usize ;
71
+ {
72
+ Return ( )
73
+ }
74
+ )
75
+ }
76
+
66
77
fn main ( ) {
67
78
numbered ( ( 5 , 6 ) ) ;
68
79
structured ( S { x : 5. } ) ;
69
80
variant ( Some ( 5 ) ) ;
70
81
variant_deref ( Some ( & 5 ) ) ;
71
82
pointee ( & mut Some ( 5 ) ) ;
83
+ constant ( ) ;
72
84
}
You can’t perform that action at this time.
0 commit comments