Skip to main content

Crate rustc_driver_impl

Crate rustc_driver_impl 

Source
Expand description

The Rust compiler.

Β§Note

This API is completely unstable and subject to change.

Re-exportsΒ§

pub(crate) use std::fmt::Write as _; πŸ”’
pub(crate) use rustc_index as _; πŸ”’
pub(crate) use do_not_use_print as print; πŸ”’
pub(crate) use do_not_use_print as println; πŸ”’
pub(crate) use crate::diagnostics::CantEmitMIR; πŸ”’
pub(crate) use crate::diagnostics::RLinkEmptyVersionNumber; πŸ”’
pub(crate) use crate::diagnostics::RLinkEncodingVersionMismatch; πŸ”’
pub(crate) use crate::diagnostics::RLinkRustcVersionMismatch; πŸ”’
pub(crate) use crate::diagnostics::RLinkWrongFileType; πŸ”’
pub(crate) use crate::diagnostics::RlinkCorruptFile; πŸ”’
pub(crate) use crate::diagnostics::RlinkNotAFile; πŸ”’
pub(crate) use crate::diagnostics::RlinkUnableToRead; πŸ”’
pub(crate) use crate::diagnostics::UnstableFeatureUsage; πŸ”’
pub(crate) use std::cmp::max; πŸ”’
pub(crate) use BTreeMap; πŸ”’
pub(crate) use BTreeSet; πŸ”’
pub(crate) use std::ffi::OsString; πŸ”’
pub(crate) use fs; πŸ”’
pub(crate) use File; πŸ”’
pub(crate) use io; πŸ”’
pub(crate) use IsTerminal; πŸ”’
pub(crate) use Read; πŸ”’
pub(crate) use Write; πŸ”’
pub(crate) use panic; πŸ”’
pub(crate) use PanicHookInfo; πŸ”’
pub(crate) use Path; πŸ”’
pub(crate) use PathBuf; πŸ”’
pub(crate) use Command; πŸ”’
pub(crate) use ExitCode; πŸ”’
pub(crate) use Stdio; πŸ”’
pub(crate) use Termination; πŸ”’
pub(crate) use std::sync::OnceLock; πŸ”’
pub(crate) use AtomicBool; πŸ”’
pub(crate) use Ordering; πŸ”’
pub(crate) use std::time::Instant; πŸ”’
pub(crate) use env; πŸ”’
pub(crate) use env; πŸ”’
pub(crate) use str; πŸ”’
pub(crate) use rustc_ast as ast; πŸ”’
pub(crate) use rustc_codegen_ssa::traits::CodegenBackend; πŸ”’
pub(crate) use CodegenError; πŸ”’
pub(crate) use CompiledModules; πŸ”’
pub(crate) use TimePassesFormat; πŸ”’
pub(crate) use get_resident_set_size; πŸ”’
pub(crate) use print_time_passes_entry; πŸ”’
pub(crate) use rustc_errors::emitter::stderr_destination; πŸ”’
pub(crate) use ColorConfig; πŸ”’
pub(crate) use DiagCtxt; πŸ”’
pub(crate) use DiagCtxtHandle; πŸ”’
pub(crate) use ErrCode; πŸ”’
pub(crate) use PResult; πŸ”’
pub(crate) use markdown; πŸ”’
pub(crate) use rustc_feature::find_gated_cfg; πŸ”’
pub(crate) use rustc_interface::passes::collect_crate_types; πŸ”’
pub(crate) use util; πŸ”’
pub(crate) use get_codegen_backend; πŸ”’
pub(crate) use Linker; πŸ”’
pub(crate) use create_and_enter_global_ctxt; πŸ”’
pub(crate) use interface; πŸ”’
pub(crate) use passes; πŸ”’
pub(crate) use rustc_lint::unerased_lint_store; πŸ”’
pub(crate) use Lint; πŸ”’
pub(crate) use LintId; πŸ”’
pub(crate) use rustc_metadata::creader::MetadataLoader; πŸ”’
pub(crate) use rustc_metadata::locator; πŸ”’
pub(crate) use rustc_middle::ty::TyCtxt; πŸ”’
pub(crate) use rustc_parse::lexer::StripTokens; πŸ”’
pub(crate) use new_parser_from_file; πŸ”’
pub(crate) use new_parser_from_source_str; πŸ”’
pub(crate) use unwrap_or_emit_fatal; πŸ”’
pub(crate) use CG_OPTIONS; πŸ”’
pub(crate) use ErrorOutputType; πŸ”’
pub(crate) use Input; πŸ”’
pub(crate) use OptionDesc; πŸ”’
pub(crate) use OutFileName; πŸ”’
pub(crate) use OutputType; πŸ”’
pub(crate) use Sysroot; πŸ”’
pub(crate) use UnstableOptions; πŸ”’
pub(crate) use Z_OPTIONS; πŸ”’
pub(crate) use nightly_options; πŸ”’
pub(crate) use parse_target_triple; πŸ”’
pub(crate) use getopts; πŸ”’
pub(crate) use Matches; πŸ”’
pub(crate) use rustc_session::output::invalid_output_for_target; πŸ”’
pub(crate) use EarlyDiagCtxt; πŸ”’
pub(crate) use Session; πŸ”’
pub(crate) use config; πŸ”’
pub(crate) use rustc_span::def_id::LOCAL_CRATE; πŸ”’
pub(crate) use DUMMY_SP; πŸ”’
pub(crate) use FileName; πŸ”’
pub(crate) use CrateType; πŸ”’
pub(crate) use LintName; πŸ”’
pub(crate) use rustc_target::json::ToJson; πŸ”’
pub(crate) use Target; πŸ”’
pub(crate) use TargetTuple; πŸ”’
pub(crate) use tracing::trace; πŸ”’

ModulesΒ§

allocator πŸ”’
args
diagnostics πŸ”’
highlighter
This module provides a syntax highlighter for Rust code. It is used by the rustc --explain command.
pretty
The various pretty-printing routines.
print πŸ”’
signal_handler πŸ”’
Signal handler for rustc Primarily used to extract a backtrace from stack overflow

MacrosΒ§

do_not_use_print πŸ”’
do_not_use_safe_print πŸ”’
override_c_allocator_in_binary
This macro overrides the C allocator (i.e., malloc) in final binaries by linking jemalloc with the override feature enabled. The C allocator is used by the default Rust allocator (alloc::System) on Unix targets but not on Windows targets.
version
Prints version information

StructsΒ§

TimePassesCallbacks

EnumsΒ§

Compilation
Whether to stop or continue compilation.
HandledOptions

ConstantsΒ§

DEFAULT_BUG_REPORT_URL
EXIT_FAILURE
Exit status code used for compilation failures and invalid flags.
EXIT_SUCCESS
Exit status code used for successful compilation and help output.

StaticsΒ§

ICE_COLOR πŸ”’
ICE_PATH πŸ”’
USING_INTERNAL_FEATURES

TraitsΒ§

Callbacks

FunctionsΒ§

catch_fatal_errors
Runs a closure and catches unwinds triggered by fatal errors.
catch_with_exit_code
Variant of catch_fatal_errors for the interface::Result return type that also computes the exit code.
compiler_entrypoint
This is the primary entry point for rustc.
describe_codegen_flags πŸ”’
describe_flag_categories
Show help for flag categories shared between rustdoc and rustc.
describe_lints
Write to stdout lint command options, together with a list of all available lints
describe_unstable_flags πŸ”’
dump_feature_usage_metrics πŸ”’
get_backend_from_raw_matches πŸ”’
Get the codegen backend based on the raw Matches.
handle_explain πŸ”’
handle_help
Handle help options in the order they are provided, ignoring other flags. Returns if any options were handled Handled options:
handle_options
Process command line options. Emits messages as appropriate. If compilation should continue, returns a getopts::Matches object parsed from args, otherwise returns None.
ice_path πŸ”’
ice_path_with_config πŸ”’
init_logger
This allows tools to enable rust logging without having to magically match rustc’s tracing crate version. In contrast to init_rustc_env_logger it allows you to choose the logger config directly rather than having to set an environment variable.
init_logger_with_additional_layer
This allows tools to enable rust logging without having to magically match rustc’s tracing crate version. In contrast to init_rustc_env_logger, it allows you to choose the logger config directly rather than having to set an environment variable. Moreover, in contrast to init_logger, it allows you to add a custom tracing layer via build_subscriber, for example || Registry::default().with(custom_layer).
init_rustc_env_logger
This allows tools to enable rust logging without having to magically match rustc’s tracing crate version.
install_ctrlc_handler
Install our usual ctrlc handler, which sets rustc_const_eval::CTRL_C_RECEIVED. Making this handler optional lets tools can install a different handler, if they wish.
install_ice_hook
Installs a panic hook that will print the ICE message on unexpected panics.
list_metadata πŸ”’
main
make_input πŸ”’
Extract input (string or file and optional path) from matches. This handles reading from stdin if - is provided.
make_output πŸ”’
Extract output directory and file from matches.
parse_crate_attrs πŸ”’
print_crate_info
print_flag_list πŸ”’
print_wall_help πŸ”’
process_rlink πŸ”’
report_ice πŸ”’
Prints the ICE message, including query stack, but without backtrace.
show_colored_md_content πŸ”’
Prints the markdown content with colored output.
show_md_content_with_pager πŸ”’
If color is always or auto, try to print pretty (formatted & colorized) markdown. If that fails or color is never, print the raw markdown.
usage πŸ”’
warn_on_confusing_output_filename_flag πŸ”’
Warn if -o is used without a space between the flag name and the value and the value is a high-value confusables, e.g. -optimize instead of -o optimize, see issue #142812.