diff options
author | John Hodge <tpg@mutabah.net> | 2018-12-29 20:01:46 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-12-29 20:01:46 +0800 |
commit | 4ed6aa06c15bf4d96f855c2508c0bed545b5b06b (patch) | |
tree | 1d3bc43c740d4956e741ba5040419d506f95778f /src | |
parent | 3c81276f5f8e6ba385dbe01d7aee9405a2bac350 (diff) | |
download | mrust-4ed6aa06c15bf4d96f855c2508c0bed545b5b06b.tar.gz |
Trans Enumerate - Handle 1.29 having generics on `lang_start`
Diffstat (limited to 'src')
-rw-r--r-- | src/trans/enumerate.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp index a94e302c..06ca92a3 100644 --- a/src/trans/enumerate.cpp +++ b/src/trans/enumerate.cpp @@ -63,21 +63,25 @@ TransList Trans_Enumerate_Main(const ::HIR::Crate& crate) auto c_start_path = crate.get_lang_item_path_opt("mrustc-start"); if( c_start_path == ::HIR::SimplePath() ) { + // user entrypoint + auto main_path = crate.get_lang_item_path(Span(), "mrustc-main"); + const auto& main_fcn = crate.get_function_by_path(sp, main_path); + + state.enum_fcn( main_path, main_fcn, {} ); + // "start" language item // - Takes main, and argc/argv as arguments { auto start_path = crate.get_lang_item_path(sp, "start"); const auto& fcn = crate.get_function_by_path(sp, start_path); - state.enum_fcn( start_path, fcn, {} ); - } - - // user entrypoint - { - auto main_path = crate.get_lang_item_path(Span(), "mrustc-main"); - const auto& fcn = crate.get_function_by_path(sp, main_path); - - state.enum_fcn( main_path, fcn, {} ); + Trans_Params lang_start_pp; + if( TARGETVER_1_29 ) + { + // With 1.29, this now takes main's return type as a type parameter + lang_start_pp.pp_method.m_types.push_back( main_fcn.m_return.clone() ); + } + state.enum_fcn( start_path, fcn, mv$(lang_start_pp) ); } } else |