]> git.lizzy.rs Git - rust.git/commitdiff
Move ty::print methods to Drop-based scope guards
authorMark Rousskov <mark.simulacrum@gmail.com>
Wed, 16 Feb 2022 18:04:48 +0000 (13:04 -0500)
committerMark Rousskov <mark.simulacrum@gmail.com>
Wed, 16 Feb 2022 22:24:23 +0000 (17:24 -0500)
src/intrinsics/mod.rs

index 55c9b4d9ba12d7ded09ce5c00410b529f37aef4f..42717ad0ae0e1e1f0d86e038ee45ad18db2fec02 100644 (file)
@@ -779,29 +779,35 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
         assert_inhabited | assert_zero_valid | assert_uninit_valid, <T> () {
             let layout = fx.layout_of(T);
             if layout.abi.is_uninhabited() {
-                with_no_trimmed_paths(|| crate::base::codegen_panic(
-                    fx,
-                    &format!("attempted to instantiate uninhabited type `{}`", T),
-                    span,
-                ));
+                with_no_trimmed_paths!({
+                    crate::base::codegen_panic(
+                        fx,
+                        &format!("attempted to instantiate uninhabited type `{}`", T),
+                        span,
+                    )
+                });
                 return;
             }
 
             if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
-                with_no_trimmed_paths(|| crate::base::codegen_panic(
-                    fx,
-                    &format!("attempted to zero-initialize type `{}`, which is invalid", T),
-                    span,
-                ));
+                with_no_trimmed_paths!({
+                    crate::base::codegen_panic(
+                        fx,
+                        &format!("attempted to zero-initialize type `{}`, which is invalid", T),
+                        span,
+                    );
+                });
                 return;
             }
 
             if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
-                with_no_trimmed_paths(|| crate::base::codegen_panic(
-                    fx,
-                    &format!("attempted to leave type `{}` uninitialized, which is invalid", T),
-                    span,
-                ));
+                with_no_trimmed_paths!({
+                    crate::base::codegen_panic(
+                        fx,
+                        &format!("attempted to leave type `{}` uninitialized, which is invalid", T),
+                        span,
+                    )
+                });
                 return;
             }
         };