Expand description
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 --explaincommand. - 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Β§
EnumsΒ§
- Compilation
- Whether to stop or continue compilation.
- Handled
Options
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Β§
FunctionsΒ§
- catch_
fatal_ errors - Runs a closure and catches unwinds triggered by fatal errors.
- catch_
with_ exit_ code - Variant of
catch_fatal_errorsfor theinterface::Resultreturn 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_loggerit 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 toinit_logger, it allows you to add a custom tracing layer viabuild_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
ctrlchandler, which setsrustc_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
colorisalwaysorauto, try to print pretty (formatted & colorized) markdown. If that fails orcolorisnever, print the raw markdown. - usage π
- warn_
on_ πconfusing_ output_ filename_ flag - Warn if
-ois used without a space between the flag name and the value and the value is a high-value confusables, e.g.-optimizeinstead of-o optimize, see issue #142812.