/// Get a list of extra command-line flags provided by the user, as strings.
///
/// This function is used during ICEs to show more information useful for
/// debugging, since some ICEs only happens with non-default compiler flags
/// (and the users don't always report them).
Get a list of extra command-line flags provided by the user, as strings.
This function is used during ICEs to show more information useful for
debugging, since some ICEs only happens with non-default compiler flags
(and the users don't always report them).
Get a list of extra command - line flags provided by the user as strings . This function is used during ICEs to show more information useful for debugging since some ICEs only happens with non - default compiler flags ( and the users don ' t always report them ) .
fn extra_compiler_flags() -> Option<(Vec<String>, bool)> {
    let args = env::args_os().map(|arg| arg.to_string_lossy().to_string()).collect::<Vec<_>>();
    // Avoid printing help because of empty args. This can suggest the compiler
    // itself is not the program root (consider RLS).
    if args.len() < 2 {
        return None;
    }
    let matches = if let Some(matches) = handle_options(&args) {
        matches
    } else {
        return None;
    };
    let mut result = Vec::new();
    let mut excluded_cargo_defaults = false;
    for flag in ICE_REPORT_COMPILER_FLAGS {
        let prefix = if flag.len() == 1 { "-" } else { "--" };
        for content in &matches.opt_strs(flag) {
            // Split always returns the first element
            let name = if let Some(first) = content.split('=').next() {
                first
            } else {
                &content
            };
            let content = if ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE.contains(&name) {
                name
            } else {
                content
            };
            if !ICE_REPORT_COMPILER_FLAGS_EXCLUDE.contains(&name) {
                result.push(format!("{}{} {}", prefix, flag, content));
            } else {
                excluded_cargo_defaults = true;
            }
        }
    }
    if result.len() > 0 {
        Some((result, excluded_cargo_defaults))
    } else {
        None
    }
}
fn extra_compiler_flags ( ) -> Option < ( Vec < String > , bool ) > { let args = env :: args_os ( ) . map ( | arg | arg . to_string_lossy ( ) . to_string ( ) ) . collect :: < Vec < _ > > ( ) ; // Avoid printing help because of empty args. This can suggest the compiler // itself is not the program root (consider RLS). if args . len ( ) < 2 { return None ; } let matches = if let Some ( matches ) = handle_options ( & args ) { matches } else { return None ; } ; let mut result = Vec :: new ( ) ; let mut excluded_cargo_defaults = false ; for flag in ICE_REPORT_COMPILER_FLAGS { let prefix = if flag . len ( ) == 1 { " " } else { " " } ; for content in & matches . opt_strs ( flag ) { // Split always returns the first element let name = if let Some ( first ) = content . split ( '=' ) . next ( ) { first } else { & content } ; let content = if ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE . contains ( & name ) { name } else { content } ; if ! ICE_REPORT_COMPILER_FLAGS_EXCLUDE . contains ( & name ) { result . push ( format ! ( " " prefix flag content ) ) ; } else { excluded_cargo_defaults = true ; } } } if result . len ( ) > 0 { Some ( ( result , excluded_cargo_defaults ) ) } else { None } }
Get a list of extra command-line flags provided by the user, as strings.
Get a list of extra command - line flags provided by the user as strings .