diff options
| author | khyperia <github@khyperia.com> | 2020-09-18 13:06:53 +0200 |
|---|---|---|
| committer | khyperia <github@khyperia.com> | 2020-09-18 13:11:59 +0200 |
| commit | 0bc405e3521d84cfaef7d94f1ae40c6c16796c8b (patch) | |
| tree | 4e0d5091a86c6debd8513a2a1ab9dd8e69f0daca /compiler/rustc_codegen_ssa/src/base.rs | |
| parent | a0925fba747b4cf910592540aa1f817778dc315c (diff) | |
| download | rust-0bc405e3521d84cfaef7d94f1ae40c6c16796c8b.tar.gz rust-0bc405e3521d84cfaef7d94f1ae40c6c16796c8b.zip | |
Remove DeclareMethods
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 6fc849969a4..d82fc2c9f63 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -407,16 +407,18 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // listing. let main_ret_ty = cx.tcx().erase_regions(&main_ret_ty.no_bound_vars().unwrap()); - if cx.get_declared_value("main").is_some() { - // FIXME: We should be smart and show a better diagnostic here. - cx.sess() - .struct_span_err(sp, "entry symbol `main` declared multiple times") - .help("did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead") - .emit(); - cx.sess().abort_if_errors(); - bug!(); - } - let llfn = cx.declare_cfn("main", llfty); + let llfn = match cx.declare_c_main(llfty) { + Some(llfn) => llfn, + None => { + // FIXME: We should be smart and show a better diagnostic here. + cx.sess() + .struct_span_err(sp, "entry symbol `main` declared multiple times") + .help("did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead") + .emit(); + cx.sess().abort_if_errors(); + bug!(); + } + }; // `main` should respect same config for frame pointer elimination as rest of code cx.set_frame_pointer_elimination(llfn); |
