Skip to content

Commit 442a474

Browse files
Normalize EntryFnType variants to standard style
1 parent b3267dc commit 442a474

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/librustc/middle/entry.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use hir::map as hir_map;
1313
use hir::def_id::{CRATE_DEF_INDEX};
1414
use session::{config, Session};
15+
use session::config::EntryFnType;
1516
use syntax::ast::NodeId;
1617
use syntax::attr;
1718
use syntax::entry::EntryPointType;
@@ -155,11 +156,11 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
155156

156157
fn configure_main(this: &mut EntryContext, crate_name: &str) {
157158
if let Some((node_id, span)) = this.start_fn {
158-
this.session.entry_fn.set(Some((node_id, span, config::EntryStart)));
159+
this.session.entry_fn.set(Some((node_id, span, EntryFnType::Start)));
159160
} else if let Some((node_id, span)) = this.attr_main_fn {
160-
this.session.entry_fn.set(Some((node_id, span, config::EntryMain)));
161+
this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main)));
161162
} else if let Some((node_id, span)) = this.main_fn {
162-
this.session.entry_fn.set(Some((node_id, span, config::EntryMain)));
163+
this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main)));
163164
} else {
164165
// No main function
165166
this.session.entry_fn.set(None);

src/librustc/session/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! Contains infrastructure for configuring the compiler, including parsing
1212
//! command line options.
1313
14-
pub use self::EntryFnType::*;
1514
pub use self::DebugInfoLevel::*;
1615

1716
use std::str::FromStr;
@@ -662,8 +661,8 @@ impl Options {
662661
// functions
663662
#[derive(Copy, Clone, PartialEq)]
664663
pub enum EntryFnType {
665-
EntryMain,
666-
EntryStart,
664+
Main,
665+
Start,
667666
}
668667

669668
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)]

src/librustc_codegen_llvm/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use rustc::middle::cstore::{self, LinkMeta, LinkagePreference};
4646
use rustc::middle::exported_symbols;
4747
use rustc::util::common::{time, print_time_passes_entry};
4848
use rustc::util::profiling::ProfileCategory;
49-
use rustc::session::config::{self, NoDebugInfo};
49+
use rustc::session::config::{self, NoDebugInfo, EntryFnType};
5050
use rustc::session::Session;
5151
use rustc_incremental;
5252
use allocator;
@@ -560,8 +560,8 @@ fn maybe_create_entry_wrapper(cx: &CodegenCx) {
560560

561561
let et = cx.sess().entry_fn.get().map(|e| e.2);
562562
match et {
563-
Some(config::EntryMain) => create_entry_fn(cx, span, main_llfn, main_def_id, true),
564-
Some(config::EntryStart) => create_entry_fn(cx, span, main_llfn, main_def_id, false),
563+
Some(EntryFnType::Main) => create_entry_fn(cx, span, main_llfn, main_def_id, true),
564+
Some(EntryFnType::Start) => create_entry_fn(cx, span, main_llfn, main_def_id, false),
565565
None => {} // Do nothing.
566566
}
567567

src/librustc_mir/monomorphize/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> {
10471047
/// the return type of `main`. This is not needed when
10481048
/// the user writes their own `start` manually.
10491049
fn push_extra_entry_roots(&mut self) {
1050-
if self.tcx.sess.entry_fn.get().map(|e| e.2) != Some(config::EntryMain) {
1050+
if self.tcx.sess.entry_fn.get().map(|e| e.2) != Some(config::EntryFnType::Main) {
10511051
return
10521052
}
10531053

src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
11111111
if let Some((id, _, entry_type)) = *fcx.tcx.sess.entry_fn.borrow() {
11121112
if id == fn_id {
11131113
match entry_type {
1114-
config::EntryMain => {
1114+
config::EntryFnType::Main => {
11151115
let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]);
11161116
let trait_ref = ty::TraitRef::new(term_id, substs);
11171117
let return_ty_span = decl.output.span();
@@ -1122,7 +1122,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
11221122
traits::Obligation::new(
11231123
cause, param_env, trait_ref.to_predicate()));
11241124
},
1125-
config::EntryStart => {},
1125+
config::EntryFnType::Start => {},
11261126
}
11271127
}
11281128
}

src/librustc_typeck/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
318318
fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
319319
if let Some((id, sp, entry_type)) = *tcx.sess.entry_fn.borrow() {
320320
match entry_type {
321-
config::EntryMain => check_main_fn_ty(tcx, id, sp),
322-
config::EntryStart => check_start_fn_ty(tcx, id, sp),
321+
config::EntryFnType::Main => check_main_fn_ty(tcx, id, sp),
322+
config::EntryFnType::Start => check_start_fn_ty(tcx, id, sp),
323323
}
324324
}
325325
}

0 commit comments

Comments
 (0)