diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-04-25 22:08:45 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-05-02 01:56:50 +0300 |
| commit | 5b5964f569ca07ba54710cb440aacaa1cf1e5c1a (patch) | |
| tree | 2bfa7457d9fde6a513c41e9e7a7d10282e92bf39 /compiler/rustc_monomorphize/src | |
| parent | a933de83989471ac444a13d62996d30621542654 (diff) | |
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_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/partitioning/default.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning/default.rs b/compiler/rustc_monomorphize/src/partitioning/default.rs index bf99cd6e424..320765e7af3 100644 --- a/compiler/rustc_monomorphize/src/partitioning/default.rs +++ b/compiler/rustc_monomorphize/src/partitioning/default.rs @@ -352,7 +352,7 @@ fn compute_codegen_unit_name( cgu_def_id = None; } - current_def_id = tcx.parent(current_def_id).unwrap(); + current_def_id = tcx.parent(current_def_id); } let cgu_def_id = cgu_def_id.unwrap(); |
