1 use crate::ast::{Item, ItemKind};
3 use rustc_span::symbol::sym;
5 pub enum EntryPointType {
10 OtherMain, // Not an entry point, but some other function named main
13 // Beware, this is duplicated in librustc_middle/middle/entry.rs, make sure to keep
15 pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType {
18 if attr::contains_name(&item.attrs, sym::start) {
20 } else if attr::contains_name(&item.attrs, sym::main) {
21 EntryPointType::MainAttr
22 } else if item.ident.name == sym::main {
24 // This is a top-level function so can be 'main'
25 EntryPointType::MainNamed
27 EntryPointType::OtherMain
33 _ => EntryPointType::None,