Info: Usage of `#[allow(...)]` suppresses compiler lints. Ensure the allowance is justified, well-scoped, and ideally temporary. Overuse can hide potential issues.
/// #[allow(dead_code)]
1use rustc_span::{Symbol, sym};23#[derive(Debug)]4pub enum EntryPointType {5 /// This function is not an entrypoint.6 None,7 /// This is a function called `main` at the root level.8 /// ```9 /// fn main() {}10 /// ```11 MainNamed,12 /// This is a function with the `#[rustc_main]` attribute.13 /// Used by the testing harness to create the test entrypoint.14 /// ```ignore (clashes with test entrypoint)15 /// #[rustc_main]16 /// fn main() {}17 /// ```18 RustcMainAttr,19 /// This function is **not** an entrypoint but simply named `main` (not at the root).20 /// This is only used for diagnostics.21 /// ```22 /// #[allow(dead_code)]23 /// mod meow {24 /// fn main() {}25 /// }26 /// ```27 OtherMain,28}2930pub fn entry_point_type(31 has_rustc_main: bool,32 at_root: bool,33 name: Option<Symbol>,34) -> EntryPointType {35 if has_rustc_main {36 EntryPointType::RustcMainAttr37 } else if let Some(name) = name38 && name == sym::main39 {40 if at_root {41 // This is a top-level function so it can be `main`.42 EntryPointType::MainNamed43 } else {44 EntryPointType::OtherMain45 }46 } else {47 EntryPointType::None48 }49}
Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.