]> git.lizzy.rs Git - rust.git/commitdiff
fix typo and deduplicate comment
authorRalf Jung <post@ralfj.de>
Sat, 14 Mar 2020 11:05:25 +0000 (12:05 +0100)
committerRalf Jung <post@ralfj.de>
Sat, 14 Mar 2020 11:05:25 +0000 (12:05 +0100)
src/shims/intrinsics.rs

index 622e237ebb0a8963ef5ed764f25b14142570e4f8..3815ed5164446175d2f5b3ca0ead8e004a62c1de 100644 (file)
@@ -443,16 +443,14 @@ fn call_intrinsic(
             "assert_uninit_valid" => {
                 let ty = substs.type_at(0);
                 let layout = this.layout_of(ty)?;
+                // Return here because we panicked instead of returning normally from the intrinsic.
                 if layout.abi.is_uninhabited() {
-                    // Return here because we paniced instead of returning normally from the intrinsic.
                     return this.start_panic(&format!("attempted to instantiate uninhabited type `{}`", ty), unwind);
                 }
                 if intrinsic_name == "assert_zero_valid" && !layout.might_permit_raw_init(this, /*zero:*/ true).unwrap() {
-                    // Return here because we paniced instead of returning normally from the intrinsic.
                     return this.start_panic(&format!("attempted to zero-initialize type `{}`, which is invalid", ty), unwind);
                 }
                 if intrinsic_name == "assert_uninit_valid" && !layout.might_permit_raw_init(this, /*zero:*/ false).unwrap() {
-                    // Return here because we paniced instead of returning normally from the intrinsic.
                     return this.start_panic(&format!("attempted to leave type `{}` uninitialized, which is invalid", ty), unwind);
                 }
             }