Skip to content

Commit 174ee2f

Browse files
committed
Support most constant kinds in custom mir
1 parent 60ee62d commit 174ee2f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

core/src/intrinsics/mir.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ pub macro __internal_extract_let {
151151
let $var $(: $ty)?;
152152
::core::intrinsics::mir::__internal_extract_let!($($rest)*);
153153
},
154+
// Due to #86730, we have to handle const blocks separately
155+
(
156+
let $var:ident $(: $ty:ty)? = const $block:block; $($rest:tt)*
157+
) => {
158+
let $var $(: $ty)?;
159+
::core::intrinsics::mir::__internal_extract_let!($($rest)*);
160+
},
154161
// Otherwise, output nothing
155162
(
156163
$stmt:stmt; $($rest:tt)*
@@ -218,6 +225,28 @@ pub macro __internal_remove_let {
218225
}
219226
}
220227
)},
228+
// Due to #86730 , we have to handle const blocks separately
229+
(
230+
{
231+
{
232+
$($already_parsed:tt)*
233+
}
234+
{
235+
let $var:ident $(: $ty:ty)? = const $block:block;
236+
$($rest:tt)*
237+
}
238+
}
239+
) => { ::core::intrinsics::mir::__internal_remove_let!(
240+
{
241+
{
242+
$($already_parsed)*
243+
$var = const $block;
244+
}
245+
{
246+
$($rest)*
247+
}
248+
}
249+
)},
221250
// Otherwise, keep going
222251
(
223252
{

0 commit comments

Comments
 (0)