diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-28 02:40:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-28 02:40:34 +0200 |
| commit | d956d014f28d4a57e62b22ef6993a7d6811a573d (patch) | |
| tree | 2c1a17b7ba902df2352229f468dc8e9d831e6f54 /compiler/rustc_codegen_ssa | |
| parent | 80045d65e111568f0fe2f5371a6d0f7d8c81b496 (diff) | |
| parent | 843e8d19ec9dc0f1c0ddd700210761aef2b180d5 (diff) | |
| download | rust-d956d014f28d4a57e62b22ef6993a7d6811a573d.tar.gz rust-d956d014f28d4a57e62b22ef6993a7d6811a573d.zip | |
Rollup merge of #96432 - SparrowLii:dbg_scope, r=davidtwco
not need `Option` for `dbg_scope` This PR fixes a few FIXME about not using `Option` in `dbg_scope` field of `DebugScope`, during `create_function_debug_context` func in codegen parts. Added a `BitSet<SourceScope>` parameter to `make_mir_scope` to indicate whether the `DebugScope` has been instantiated. cc ````@eddyb````
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/debuginfo.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index bb53c722a24..f2d1827c792 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -39,8 +39,7 @@ pub struct PerLocalVarDebugInfo<'tcx, D> { #[derive(Clone, Copy, Debug)] pub struct DebugScope<S, L> { - // FIXME(eddyb) this should never be `None`, after initialization. - pub dbg_scope: Option<S>, + pub dbg_scope: S, /// Call site location, if this scope was inlined from another function. pub inlined_at: Option<L>, @@ -61,17 +60,12 @@ impl<'tcx, S: Copy, L: Copy> DebugScope<S, L> { cx: &Cx, span: Span, ) -> S { - // FIXME(eddyb) this should never be `None`. - let dbg_scope = self - .dbg_scope - .unwrap_or_else(|| bug!("`dbg_scope` is only `None` during initialization")); - let pos = span.lo(); if pos < self.file_start_pos || pos >= self.file_end_pos { let sm = cx.sess().source_map(); - cx.extend_scope_to_file(dbg_scope, &sm.lookup_char_pos(pos).file) + cx.extend_scope_to_file(self.dbg_scope, &sm.lookup_char_pos(pos).file) } else { - dbg_scope + self.dbg_scope } } } |
