about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-02-24 21:42:16 +0100
committerGitHub <noreply@github.com>2022-02-24 21:42:16 +0100
commit787c6f3365f9327e3d6c59d7ec157b390606a402 (patch)
tree2c20b850c4b0480e9382943f761f1c45b4829697 /compiler/rustc_codegen_ssa/src
parent6b03a46f27821ef5986bd8ab12e5e65cb98fa790 (diff)
parentf047af24b3b90f19b89fac80822acd69613b89ec (diff)
Rollup merge of #94308 - tmiasko:normalize-main-ret-ty, r=oli-obk
Normalize main return type during mono item collection & codegen

The issue can be observed with `-Zprint-mono-items=lazy` in:

```rust
#![feature(termination_trait_lib)]
fn main() -> impl std::process::Termination { }
```
```
BEFORE: MONO_ITEM fn std::rt::lang_start::<impl std::process::Termination> ````@@```` t.93933fa2-cgu.2[External]
AFTER:  MONO_ITEM fn std::rt::lang_start::<()> ````@@```` t.df56e625-cgu.1[External]
```
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/base.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index ed6c156547e..11f32d92e44 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -407,7 +407,10 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
         // late-bound regions, since late-bound
         // regions must appear in the argument
         // listing.
-        let main_ret_ty = cx.tcx().erase_regions(main_ret_ty.no_bound_vars().unwrap());
+        let main_ret_ty = cx.tcx().normalize_erasing_regions(
+            ty::ParamEnv::reveal_all(),
+            main_ret_ty.no_bound_vars().unwrap(),
+        );
 
         let Some(llfn) = cx.declare_c_main(llfty) else {
             // FIXME: We should be smart and show a better diagnostic here.