Run rustfmt --file-lines ... for changes from previous commits.
This commit is contained in:
parent
21ac960334
commit
fff08cb043
176 changed files with 2212 additions and 2132 deletions
|
|
@ -46,10 +46,10 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor
|
|||
}
|
||||
}
|
||||
|
||||
fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cnum: CrateNum)
|
||||
-> &'tcx DefIdMap<SymbolExportLevel>
|
||||
{
|
||||
fn reachable_non_generics_provider<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cnum: CrateNum,
|
||||
) -> &'tcx DefIdMap<SymbolExportLevel> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
|
|
@ -157,9 +157,7 @@ fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
tcx.arena.alloc(reachable_non_generics)
|
||||
}
|
||||
|
||||
fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> bool {
|
||||
fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
let export_threshold = threshold(tcx);
|
||||
|
||||
if let Some(&level) = tcx.reachable_non_generics(def_id.krate).get(&def_id) {
|
||||
|
|
@ -169,17 +167,14 @@ fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> bool {
|
||||
fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
|
||||
tcx.reachable_non_generics(def_id.krate).contains_key(&def_id)
|
||||
}
|
||||
|
||||
fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cnum: CrateNum)
|
||||
-> Arc<Vec<(ExportedSymbol<'tcx>,
|
||||
SymbolExportLevel)>>
|
||||
{
|
||||
fn exported_symbols_provider_local<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cnum: CrateNum,
|
||||
) -> Arc<Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)>> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
|
|
@ -280,9 +275,8 @@ fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
|
||||
fn upstream_monomorphizations_provider<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cnum: CrateNum)
|
||||
-> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>>
|
||||
{
|
||||
cnum: CrateNum,
|
||||
) -> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> {
|
||||
debug_assert!(cnum == LOCAL_CRATE);
|
||||
|
||||
let cnums = tcx.all_crate_nums(LOCAL_CRATE);
|
||||
|
|
@ -330,9 +324,8 @@ fn upstream_monomorphizations_provider<'tcx>(
|
|||
|
||||
fn upstream_monomorphizations_for_provider<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>>
|
||||
{
|
||||
def_id: DefId,
|
||||
) -> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>> {
|
||||
debug_assert!(!def_id.is_local());
|
||||
tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
|
|||
tcx: TyCtxt<'_, '_>,
|
||||
metadata: EncodedMetadata,
|
||||
coordinator_receive: Receiver<Box<dyn Any + Send>>,
|
||||
total_cgus: usize
|
||||
total_cgus: usize,
|
||||
) -> OngoingCodegen<B> {
|
||||
let sess = tcx.sess;
|
||||
let crate_name = tcx.crate_name(LOCAL_CRATE);
|
||||
|
|
@ -1005,7 +1005,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
|||
jobserver: Client,
|
||||
modules_config: Arc<ModuleConfig>,
|
||||
metadata_config: Arc<ModuleConfig>,
|
||||
allocator_config: Arc<ModuleConfig>
|
||||
allocator_config: Arc<ModuleConfig>,
|
||||
) -> thread::JoinHandle<Result<CompiledModules, ()>> {
|
||||
let coordinator_send = tcx.tx_to_llvm_workers.lock().clone();
|
||||
let sess = tcx.sess;
|
||||
|
|
@ -1861,9 +1861,11 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
|
|||
}, work_products)
|
||||
}
|
||||
|
||||
pub fn submit_pre_codegened_module_to_llvm(&self,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
module: ModuleCodegen<B::Module>) {
|
||||
pub fn submit_pre_codegened_module_to_llvm(
|
||||
&self,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
module: ModuleCodegen<B::Module>,
|
||||
) {
|
||||
self.wait_for_signal_to_codegen_item();
|
||||
self.check_for_errors(tcx.sess);
|
||||
|
||||
|
|
@ -1913,7 +1915,7 @@ pub fn submit_codegened_module_to_llvm<B: ExtraBackendMethods>(
|
|||
_backend: &B,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
module: ModuleCodegen<B::Module>,
|
||||
cost: u64
|
||||
cost: u64,
|
||||
) {
|
||||
let llvm_work_item = WorkItem::Optimize(module);
|
||||
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone::<B> {
|
||||
|
|
@ -1925,7 +1927,7 @@ pub fn submit_codegened_module_to_llvm<B: ExtraBackendMethods>(
|
|||
pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(
|
||||
_backend: &B,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
module: CachedModuleCodegen
|
||||
module: CachedModuleCodegen,
|
||||
) {
|
||||
let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module);
|
||||
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone::<B> {
|
||||
|
|
@ -1937,7 +1939,7 @@ pub fn submit_post_lto_module_to_llvm<B: ExtraBackendMethods>(
|
|||
pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
|
||||
_backend: &B,
|
||||
tcx: TyCtxt<'_, '_>,
|
||||
module: CachedModuleCodegen
|
||||
module: CachedModuleCodegen,
|
||||
) {
|
||||
let filename = pre_lto_bitcode_filename(&module.name);
|
||||
let bc_path = in_incr_comp_dir_sess(tcx.sess, &filename);
|
||||
|
|
|
|||
|
|
@ -483,9 +483,8 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
|||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
need_metadata_module: bool,
|
||||
rx: mpsc::Receiver<Box<dyn Any + Send>>
|
||||
rx: mpsc::Receiver<Box<dyn Any + Send>>,
|
||||
) -> OngoingCodegen<B> {
|
||||
|
||||
check_for_rustc_errors_attr(tcx);
|
||||
|
||||
// Skip crate items and just output metadata in -Z no-codegen mode.
|
||||
|
|
@ -776,7 +775,7 @@ impl CrateInfo {
|
|||
info.missing_lang_items.insert(cnum, missing);
|
||||
}
|
||||
|
||||
return info
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -850,9 +849,7 @@ pub fn provide_both(providers: &mut Providers<'_>) {
|
|||
};
|
||||
}
|
||||
|
||||
fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cgu: &CodegenUnit<'tcx>)
|
||||
-> CguReuse {
|
||||
fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse {
|
||||
if !tcx.dep_graph.is_fully_enabled() {
|
||||
return CguReuse::No
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,11 +122,7 @@ mod temp_stable_hash_impls {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn langcall(tcx: TyCtxt<'_, '_>,
|
||||
span: Option<Span>,
|
||||
msg: &str,
|
||||
li: LangItem)
|
||||
-> DefId {
|
||||
pub fn langcall(tcx: TyCtxt<'_, '_>, span: Option<Span>, msg: &str, li: LangItem) -> DefId {
|
||||
tcx.lang_items().require(li).unwrap_or_else(|s| {
|
||||
let msg = format!("{} {}", msg, s);
|
||||
match span {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
// any caching, i.e., calling the function twice with the same type will also do
|
||||
// the work twice. The `qualified` parameter only affects the first level of the
|
||||
// type name, further levels (i.e., type parameters) are always fully qualified.
|
||||
pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
t: Ty<'tcx>,
|
||||
qualified: bool)
|
||||
-> String {
|
||||
pub fn compute_debuginfo_type_name<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
t: Ty<'tcx>,
|
||||
qualified: bool,
|
||||
) -> String {
|
||||
let mut result = String::with_capacity(64);
|
||||
let mut visited = FxHashSet::default();
|
||||
push_debuginfo_type_name(tcx, t, qualified, &mut result, &mut visited);
|
||||
|
|
@ -20,12 +21,13 @@ pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
|
||||
// Pushes the name of the type as it should be stored in debuginfo on the
|
||||
// `output` String. See also compute_debuginfo_type_name().
|
||||
pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
t: Ty<'tcx>,
|
||||
qualified: bool,
|
||||
output: &mut String,
|
||||
visited: &mut FxHashSet<Ty<'tcx>>) {
|
||||
|
||||
pub fn push_debuginfo_type_name<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
t: Ty<'tcx>,
|
||||
qualified: bool,
|
||||
output: &mut String,
|
||||
visited: &mut FxHashSet<Ty<'tcx>>,
|
||||
) {
|
||||
// When targeting MSVC, emit C++ style type names for compatibility with
|
||||
// .natvis visualizers (and perhaps other existing native debuggers?)
|
||||
let cpp_like_names = tcx.sess.target.target.options.is_like_msvc;
|
||||
|
|
@ -208,10 +210,12 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
fn push_item_name(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
qualified: bool,
|
||||
output: &mut String) {
|
||||
fn push_item_name(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
qualified: bool,
|
||||
output: &mut String,
|
||||
) {
|
||||
if qualified {
|
||||
output.push_str(&tcx.crate_name(def_id.krate).as_str());
|
||||
for path_element in tcx.def_path(def_id).data {
|
||||
|
|
@ -228,10 +232,12 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
|||
// reconstructed for items from non-local crates. For local crates, this
|
||||
// would be possible but with inlining and LTO we have to use the least
|
||||
// common denominator - otherwise we would run into conflicts.
|
||||
fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
output: &mut String,
|
||||
visited: &mut FxHashSet<Ty<'tcx>>) {
|
||||
fn push_type_params<'tcx>(
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
output: &mut String,
|
||||
visited: &mut FxHashSet<Ty<'tcx>>,
|
||||
) {
|
||||
if substs.types().next().is_none() {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,13 +42,9 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
|
|||
&self,
|
||||
tcx: TyCtxt<'gcx, 'gcx>,
|
||||
mods: &mut Self::Module,
|
||||
kind: AllocatorKind
|
||||
);
|
||||
fn compile_codegen_unit<'a, 'tcx: 'a>(
|
||||
&self,
|
||||
tcx: TyCtxt<'tcx, 'tcx>,
|
||||
cgu_name: InternedString,
|
||||
kind: AllocatorKind,
|
||||
);
|
||||
fn compile_codegen_unit<'a, 'tcx: 'a>(&self, tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString);
|
||||
// If find_features is true this won't access `sess.crate_types` by assuming
|
||||
// that `is_pie_binary` is false. When we discover LLVM target features
|
||||
// `sess.crate_types` is uninitialized so we cannot access it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue