X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_mir_build%2Fsrc%2Fbuild%2Fmod.rs;h=1655e224ddbb5b68f16f9710bdf509f18607d922;hb=e19ae977ec4c8eaccd92c8e16da4ca4d6ca318d5;hp=f85831b4fc6b57c106881d557ae3b9e39cceba83;hpb=c89bb159f6d1e9049f9c42a3eb8d0f355524f029;p=rust.git diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index f85831b4fc6..1655e224ddb 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -439,6 +439,10 @@ fn construct_fn<'tcx>( let fn_id = tcx.hir().local_def_id_to_hir_id(fn_def.did); let generator_kind = tcx.generator_kind(fn_def.did); + // The representation of thir for `-Zunpretty=thir-tree` relies on + // the entry expression being the last element of `thir.exprs`. + assert_eq!(expr.as_usize(), thir.exprs.len() - 1); + // Figure out what primary body this item has. let body_id = tcx.hir().body_owned_by(fn_def.did); let span_with_body = tcx.hir().span_with_body(fn_id);