Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fb5615a

Browse files
committedApr 28, 2020
Auto merge of rust-lang#71292 - marmeladema:queries-local-def-id, r=eddyb
Convert more queries to use `LocalDefId` This PR is based on commits in rust-lang#71215 and should partially solve rust-lang#70853
2 parents 6db2094 + 1349272 commit fb5615a

File tree

43 files changed

+288
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+288
-239
lines changed
 

‎src/librustc_codegen_llvm/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
290290
spflags |= DISPFlags::SPFlagOptimized;
291291
}
292292
if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) {
293-
if id == def_id {
293+
if id.to_def_id() == def_id {
294294
spflags |= DISPFlags::SPFlagMainSubprogram;
295295
}
296296
}

‎src/librustc_codegen_ssa/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_data_structures::fx::FxHashMap;
3030
use rustc_data_structures::profiling::print_time_passes_entry;
3131
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
3232
use rustc_hir as hir;
33-
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
33+
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
3434
use rustc_hir::lang_items::StartFnLangItem;
3535
use rustc_index::vec::Idx;
3636
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
@@ -397,7 +397,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
397397
None => return None,
398398
};
399399

400-
let instance = Instance::mono(cx.tcx(), main_def_id);
400+
let instance = Instance::mono(cx.tcx(), main_def_id.to_def_id());
401401

402402
if !cx.codegen_unit().contains_item(&MonoItem::Fn(instance)) {
403403
// We want to create the wrapper in the same codegen unit as Rust's main
@@ -416,7 +416,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
416416
cx: &'a Bx::CodegenCx,
417417
sp: Span,
418418
rust_main: Bx::Value,
419-
rust_main_def_id: DefId,
419+
rust_main_def_id: LocalDefId,
420420
use_start_lang_item: bool,
421421
) -> Bx::Function {
422422
// The entry function is either `int main(void)` or `int main(int argc, char **argv)`,

0 commit comments

Comments
 (0)
Please sign in to comment.