Skip to content

Commit 7e80bc3

Browse files
Move ty::print methods to Drop-based scope guards
1 parent 06bc64d commit 7e80bc3

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/intrinsics/mod.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -779,29 +779,35 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
779779
assert_inhabited | assert_zero_valid | assert_uninit_valid, <T> () {
780780
let layout = fx.layout_of(T);
781781
if layout.abi.is_uninhabited() {
782-
with_no_trimmed_paths(|| crate::base::codegen_panic(
783-
fx,
784-
&format!("attempted to instantiate uninhabited type `{}`", T),
785-
span,
786-
));
782+
with_no_trimmed_paths!({
783+
crate::base::codegen_panic(
784+
fx,
785+
&format!("attempted to instantiate uninhabited type `{}`", T),
786+
span,
787+
)
788+
});
787789
return;
788790
}
789791

790792
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
791-
with_no_trimmed_paths(|| crate::base::codegen_panic(
792-
fx,
793-
&format!("attempted to zero-initialize type `{}`, which is invalid", T),
794-
span,
795-
));
793+
with_no_trimmed_paths!({
794+
crate::base::codegen_panic(
795+
fx,
796+
&format!("attempted to zero-initialize type `{}`, which is invalid", T),
797+
span,
798+
);
799+
});
796800
return;
797801
}
798802

799803
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
800-
with_no_trimmed_paths(|| crate::base::codegen_panic(
801-
fx,
802-
&format!("attempted to leave type `{}` uninitialized, which is invalid", T),
803-
span,
804-
));
804+
with_no_trimmed_paths!({
805+
crate::base::codegen_panic(
806+
fx,
807+
&format!("attempted to leave type `{}` uninitialized, which is invalid", T),
808+
span,
809+
)
810+
});
805811
return;
806812
}
807813
};

0 commit comments

Comments
 (0)