Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ade671
[AIX] handle libunwind native_libs
daltenty Nov 7, 2024
7fc4b96
tests: Add regression test for self referential struct with cow as la…
Enselic Nov 26, 2024
685f189
Stabilize `extended_varargs_abi_support`
Soveu Apr 23, 2024
90ad2ad
Improve span handling in `parse_expr_bottom`.
nnethercote Nov 28, 2024
43c12ed
Bump `ruzstd` to 0.7.3
paolobarbolini Nov 28, 2024
8574f37
Do not call `extern_crate` on current trait on crate mismatch errors
estebank Nov 28, 2024
0c8e36b
Fix target_feature handling in freg of LoongArch inline assembly
taiki-e Nov 28, 2024
727f6a6
Add +forced-atomics feature to esp32s2
MabezDev Nov 28, 2024
c76f1f0
Doc comment custom MIR debuginfo.
cjgillot Oct 21, 2023
6e449e1
refine mir debuginfo docs
RalfJung Nov 29, 2024
e97e15d
Use rmake `diff` output in test
estebank Nov 29, 2024
998ff2f
Move the `crate-loading` test to use `diff` output
estebank Nov 29, 2024
ce98bf3
simplify how the `hir_typeck_pass_to_variadic_function` diagnostic is…
Nov 29, 2024
a9cb2d6
Add a comment
daltenty Nov 29, 2024
dd99f11
Rollup merge of #116161 - Soveu:varargs2, r=cjgillot
jieyouxu Nov 30, 2024
5192810
Rollup merge of #132750 - daltenty:daltenty/libs, r=jieyouxu
jieyouxu Nov 30, 2024
f1d9ba8
Rollup merge of #133488 - Enselic:recurse-2, r=BoxyUwU
jieyouxu Nov 30, 2024
5ec505f
Rollup merge of #133569 - paolobarbolini:ruzstd-0.7.3, r=Mark-Simulacrum
jieyouxu Nov 30, 2024
70e71f5
Rollup merge of #133585 - estebank:issue-133563, r=jieyouxu
jieyouxu Nov 30, 2024
ab4588a
Rollup merge of #133587 - taiki-e:loongarch-asm-freg, r=Amanieu
jieyouxu Nov 30, 2024
46f826c
Rollup merge of #133599 - esp-rs:target/esp32s2-forced-atomics, r=Ama…
jieyouxu Nov 30, 2024
c112195
Rollup merge of #133620 - dev-ardi:simplify-hir_typeck_pass_to_variad…
jieyouxu Nov 30, 2024
ea72c19
Rollup merge of #133623 - nnethercote:parse_expr_bottom-spans, r=comp…
jieyouxu Nov 30, 2024
6512836
Rollup merge of #133625 - RalfJung:custom-mir-debug-info, r=compiler-…
jieyouxu Nov 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions library/core/src/intrinsics/mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,39 @@
//! `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
//!
//! Debuginfo associates source code variable names (of variables that may not exist any more) with
//! MIR expressions that indicate where the value of that variable is stored. The syntax to do so
//! is:
//! ```text
//! debug source_var_name => expression;
//! ```
//! Both places and constants are supported in the `expression`.
//!
//! ```rust
//! #![allow(internal_features)]
//! #![feature(core_intrinsics, custom_mir)]
//!
//! use core::intrinsics::mir::*;
//!
//! #[custom_mir(dialect = "built")]
//! fn debuginfo(arg: Option<&i32>) {
//! mir!(
//! // Debuginfo for a source variable `plain_local` that just duplicates `arg`.
//! debug plain_local => arg;
//! // Debuginfo for a source variable `projection` that can be computed by dereferencing
//! // a field of `arg`.
//! debug projection => *Field::<&i32>(Variant(arg, 1), 0);
//! // Debuginfo for a source variable `constant` that always holds the value `5`.
//! debug constant => 5_usize;
//! {
//! Return()
//! }
//! )
//! }
//! ```

#![unstable(
feature = "custom_mir",
Expand Down
10 changes: 10 additions & 0 deletions tests/mir-opt/building/custom/debuginfo.constant.built.after.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// MIR for `constant` after built

fn constant() -> () {
debug scalar => const 5_usize;
let mut _0: ();

bb0: {
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

fn numbered(_1: (u32, i32)) -> () {
debug first => (_1.0: u32);
debug second => (_1.0: u32);
debug second => (_1.1: i32);
let mut _0: ();

bb0: {
Expand Down
29 changes: 27 additions & 2 deletions tests/mir-opt/building/custom/debuginfo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// skip-filecheck
#![feature(custom_mir, core_intrinsics)]

extern crate core;
Expand All @@ -7,6 +6,8 @@ use core::intrinsics::mir::*;
// EMIT_MIR debuginfo.pointee.built.after.mir
#[custom_mir(dialect = "built")]
fn pointee(opt: &mut Option<i32>) {
// CHECK-LABEL: fn pointee(
// CHECK: debug foo => (((*_1) as variant#1).0: i32);
mir! {
debug foo => Field::<i32>(Variant(*opt, 1), 0);
{
Expand All @@ -18,9 +19,12 @@ fn pointee(opt: &mut Option<i32>) {
// EMIT_MIR debuginfo.numbered.built.after.mir
#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
fn numbered(i: (u32, i32)) {
// CHECK-LABEL: fn numbered(
// CHECK: debug first => (_1.0: u32);
// CHECK: debug second => (_1.1: i32);
mir! {
debug first => i.0;
debug second => i.0;
debug second => i.1;
{
Return()
}
Expand All @@ -34,6 +38,8 @@ struct S {
// EMIT_MIR debuginfo.structured.built.after.mir
#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
fn structured(i: S) {
// CHECK-LABEL: fn structured(
// CHECK: debug x => (_1.0: f32);
mir! {
debug x => i.x;
{
Expand All @@ -45,6 +51,8 @@ fn structured(i: S) {
// EMIT_MIR debuginfo.variant.built.after.mir
#[custom_mir(dialect = "built")]
fn variant(opt: Option<i32>) {
// CHECK-LABEL: fn variant(
// CHECK: debug inner => ((_1 as variant#1).0: i32);
mir! {
debug inner => Field::<i32>(Variant(opt, 1), 0);
{
Expand All @@ -56,6 +64,9 @@ fn variant(opt: Option<i32>) {
// EMIT_MIR debuginfo.variant_deref.built.after.mir
#[custom_mir(dialect = "built")]
fn variant_deref(opt: Option<&i32>) {
// CHECK-LABEL: fn variant_deref(
// CHECK: debug pointer => ((_1 as variant#1).0: &i32);
// CHECK: debug deref => (*((_1 as variant#1).0: &i32));
mir! {
debug pointer => Field::<&i32>(Variant(opt, 1), 0);
debug deref => *Field::<&i32>(Variant(opt, 1), 0);
Expand All @@ -65,10 +76,24 @@ fn variant_deref(opt: Option<&i32>) {
}
}

// EMIT_MIR debuginfo.constant.built.after.mir
#[custom_mir(dialect = "built")]
fn constant() {
// CHECK-LABEL: fn constant(
// CHECK: debug scalar => const 5_usize;
mir!(
debug scalar => 5_usize;
{
Return()
}
)
}

fn main() {
numbered((5, 6));
structured(S { x: 5. });
variant(Some(5));
variant_deref(Some(&5));
pointee(&mut Some(5));
constant();
}
Loading