diff options
| author | bors <bors@rust-lang.org> | 2022-05-02 14:03:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-02 14:03:20 +0000 |
| commit | 879fb425960798a79042b3b2a850d1262b7a91e8 (patch) | |
| tree | 1d1454aa105200842e6beb2b918b5d5c5c0d07c4 /compiler/rustc_codegen_llvm/src/debuginfo | |
| parent | 542898328637b31412d91b882ce0dc4b85ad54e6 (diff) | |
| parent | 5b5964f569ca07ba54710cb440aacaa1cf1e5c1a (diff) | |
| download | rust-879fb425960798a79042b3b2a850d1262b7a91e8.tar.gz rust-879fb425960798a79042b3b2a850d1262b7a91e8.zip | |
Auto merge of #96431 - petrochenkov:parent, r=cjgillot
rustc: Panic by default in `DefIdTree::parent` Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/utils.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/utils.rs b/compiler/rustc_codegen_llvm/src/debuginfo/utils.rs index fe9851cfa56..8f243673907 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/utils.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/utils.rs @@ -46,7 +46,7 @@ pub fn DIB<'a, 'll>(cx: &'a CodegenCx<'ll, '_>) -> &'a DIBuilder<'ll> { } pub fn get_namespace_for_item<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope { - item_namespace(cx, cx.tcx.parent(def_id).expect("get_namespace_for_item: missing parent?")) + item_namespace(cx, cx.tcx.parent(def_id)) } #[derive(Debug, PartialEq, Eq)] |
