From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- library/core/src/intrinsics/mir.rs | 45 +++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'library/core/src/intrinsics') diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index ef0a2fd4e..cab195dad 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -12,9 +12,10 @@ //! //! Typical usage will look like this: //! -//! ```rust +#![cfg_attr(bootstrap, doc = "```rust,ignore")] +#![cfg_attr(not(bootstrap), doc = "```rust")] //! #![feature(core_intrinsics, custom_mir)] -#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")] +//! #![allow(internal_features)] //! //! use core::intrinsics::mir::*; //! @@ -62,9 +63,10 @@ //! //! # Examples //! -//! ```rust +#![cfg_attr(bootstrap, doc = "```rust,ignore")] +#![cfg_attr(not(bootstrap), doc = "```rust")] //! #![feature(core_intrinsics, custom_mir)] -#![cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")] +//! #![allow(internal_features)] //! //! use core::intrinsics::mir::*; //! @@ -317,8 +319,9 @@ define!( /// /// # Examples /// - /// ```rust - #[cfg_attr(not(bootstrap), doc = "#![allow(internal_features)]")] + #[cfg_attr(bootstrap, doc = "```rust,ignore")] + #[cfg_attr(not(bootstrap), doc = "```rust")] + /// #![allow(internal_features)] /// #![feature(custom_mir, core_intrinsics)] /// /// use core::intrinsics::mir::*; @@ -361,6 +364,11 @@ define!( #[doc(hidden)] fn __internal_make_place(place: T) -> *mut T ); +define!( + "mir_debuginfo", + #[doc(hidden)] + fn __debuginfo(name: &'static str, s: T) +); /// Macro for generating custom MIR. /// @@ -371,6 +379,7 @@ pub macro mir { ( $(type RET = $ret_ty:ty ;)? $(let $local_decl:ident $(: $local_decl_ty:ty)? ;)* + $(debug $dbg_name:ident => $dbg_data:expr ;)* { $($entry:tt)* @@ -394,26 +403,32 @@ pub macro mir { $( let $local_decl $(: $local_decl_ty)? ; )* - ::core::intrinsics::mir::__internal_extract_let!($($entry)*); $( ::core::intrinsics::mir::__internal_extract_let!($($block)*); )* { - // Finally, the contents of the basic blocks - ::core::intrinsics::mir::__internal_remove_let!({ - {} - { $($entry)* } - }); + // Now debuginfo $( + __debuginfo(stringify!($dbg_name), $dbg_data); + )* + + { + // Finally, the contents of the basic blocks ::core::intrinsics::mir::__internal_remove_let!({ {} - { $($block)* } + { $($entry)* } }); - )* + $( + ::core::intrinsics::mir::__internal_remove_let!({ + {} + { $($block)* } + }); + )* - RET + RET + } } } }} -- cgit v1.2.3