]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #43741 - Gankro:fix-assert, r=eddyb
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 11 Aug 2017 08:20:23 +0000 (10:20 +0200)
committerGitHub <noreply@github.com>
Fri, 11 Aug 2017 08:20:23 +0000 (10:20 +0200)
fix assertion - trait object pointers don't have infinite fields

r? @eddyb

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 {