]> git.lizzy.rs Git - rust.git/commitdiff
fix assertion - trait object pointers don't have infinite fields
authorAlexis Beingessner <a.beingessner@gmail.com>
Tue, 8 Aug 2017 14:08:08 +0000 (10:08 -0400)
committerAlexis Beingessner <a.beingessner@gmail.com>
Tue, 8 Aug 2017 14:08:08 +0000 (10:08 -0400)
src/librustc/ty/layout.rs

index e770f1d55dcfdcc08dd35bb96557c7ee84d23dbb..4ee9b2e65a782ac79c88ad3062caaeb6e7cb8df3 100644 (file)
@@ -2197,8 +2197,8 @@ pub fn field_type<C: LayoutTyper<'tcx>>(&self, cx: C, i: usize) -> Ty<'tcx> {
         let tcx = cx.tcx();
 
         let ptr_field_type = |pointee: Ty<'tcx>| {
+            assert!(i < 2);
             let slice = |element: Ty<'tcx>| {
-                assert!(i < 2);
                 if i == 0 {
                     tcx.mk_mut_ptr(element)
                 } else {