File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 252
252
//!
253
253
//! #### Debuginfo
254
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.
255
+ //! Debuginfo associates source code variable names (of variables that may not exist any more) with
256
+ //! MIR expressions that indicate where the value of that variable is stored. The syntax to do so
257
+ //! is:
258
+ //! ```text
259
+ //! debug source_var_name => expression;
260
+ //! ```
261
+ //! Both places and constants are supported in the `expression`.
257
262
//!
258
263
//! ```rust
259
264
//! #![allow(internal_features)]
262
267
//! use core::intrinsics::mir::*;
263
268
//!
264
269
//! #[custom_mir(dialect = "built")]
265
- //! fn debuginfo(option : Option<&i32>) {
270
+ //! fn debuginfo(arg : Option<&i32>) {
266
271
//! mir!(
267
- //! debug option => option;
268
- //! debug projection => *Field::<&i32>(Variant(option, 1), 0);
272
+ //! // Debuginfo for a source variable `plain_local` that just duplicates `arg`.
273
+ //! debug plain_local => arg;
274
+ //! // Debuginfo for a source variable `projection` that can be computed by dereferencing
275
+ //! // a field of `arg`.
276
+ //! debug projection => *Field::<&i32>(Variant(arg, 1), 0);
277
+ //! // Debuginfo for a source variable `constant` that always holds the value `5`.
269
278
//! debug constant => 5_usize;
270
279
//! {
271
280
//! Return()
You can’t perform that action at this time.
0 commit comments