diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 9c2157aa2b31b..b0acc6f20e691 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -12,6 +12,7 @@ use hir::map as hir_map; use hir::def_id::{CRATE_DEF_INDEX}; use session::{config, Session}; +use session::config::EntryFnType; use syntax::ast::NodeId; use syntax::attr; use syntax::entry::EntryPointType; @@ -155,11 +156,11 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) { fn configure_main(this: &mut EntryContext, crate_name: &str) { if let Some((node_id, span)) = this.start_fn { - this.session.entry_fn.set(Some((node_id, span, config::EntryStart))); + this.session.entry_fn.set(Some((node_id, span, EntryFnType::Start))); } else if let Some((node_id, span)) = this.attr_main_fn { - this.session.entry_fn.set(Some((node_id, span, config::EntryMain))); + this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main))); } else if let Some((node_id, span)) = this.main_fn { - this.session.entry_fn.set(Some((node_id, span, config::EntryMain))); + this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main))); } else { // No main function this.session.entry_fn.set(None); diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 7d4508e0eea2a..e69e6215ba14b 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -11,7 +11,6 @@ //! Contains infrastructure for configuring the compiler, including parsing //! command line options. -pub use self::EntryFnType::*; pub use self::DebugInfoLevel::*; use std::str::FromStr; @@ -662,8 +661,8 @@ impl Options { // functions #[derive(Copy, Clone, PartialEq)] pub enum EntryFnType { - EntryMain, - EntryStart, + Main, + Start, } #[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)] diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 8fb3670e5ed9b..d98a8981da724 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -46,7 +46,7 @@ use rustc::middle::cstore::{self, LinkMeta, LinkagePreference}; use rustc::middle::exported_symbols; use rustc::util::common::{time, print_time_passes_entry}; use rustc::util::profiling::ProfileCategory; -use rustc::session::config::{self, NoDebugInfo}; +use rustc::session::config::{self, NoDebugInfo, EntryFnType}; use rustc::session::Session; use rustc_incremental; use allocator; @@ -560,8 +560,8 @@ fn maybe_create_entry_wrapper(cx: &CodegenCx) { let et = cx.sess().entry_fn.get().map(|e| e.2); match et { - Some(config::EntryMain) => create_entry_fn(cx, span, main_llfn, main_def_id, true), - Some(config::EntryStart) => create_entry_fn(cx, span, main_llfn, main_def_id, false), + Some(EntryFnType::Main) => create_entry_fn(cx, span, main_llfn, main_def_id, true), + Some(EntryFnType::Start) => create_entry_fn(cx, span, main_llfn, main_def_id, false), None => {} // Do nothing. } diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 97f1f2a76ca2b..7f5851734fe85 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1047,7 +1047,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { /// the return type of `main`. This is not needed when /// the user writes their own `start` manually. fn push_extra_entry_roots(&mut self) { - if self.tcx.sess.entry_fn.get().map(|e| e.2) != Some(config::EntryMain) { + if self.tcx.sess.entry_fn.get().map(|e| e.2) != Some(config::EntryFnType::Main) { return } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 4cde171f1bfd4..8c47df8b04221 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1111,7 +1111,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, if let Some((id, _, entry_type)) = *fcx.tcx.sess.entry_fn.borrow() { if id == fn_id { match entry_type { - config::EntryMain => { + config::EntryFnType::Main => { let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]); let trait_ref = ty::TraitRef::new(term_id, substs); let return_ty_span = decl.output.span(); @@ -1122,7 +1122,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, traits::Obligation::new( cause, param_env, trait_ref.to_predicate())); }, - config::EntryStart => {}, + config::EntryFnType::Start => {}, } } } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 4f1609455178b..9fd5db16fb108 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -318,8 +318,8 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { if let Some((id, sp, entry_type)) = *tcx.sess.entry_fn.borrow() { match entry_type { - config::EntryMain => check_main_fn_ty(tcx, id, sp), - config::EntryStart => check_start_fn_ty(tcx, id, sp), + config::EntryFnType::Main => check_main_fn_ty(tcx, id, sp), + config::EntryFnType::Start => check_start_fn_ty(tcx, id, sp), } } }