From 843e8d19ec9dc0f1c0ddd700210761aef2b180d5 Mon Sep 17 00:00:00 2001 From: SparrowLii Date: Tue, 26 Apr 2022 21:00:19 +0800 Subject: not need `Option` for `dbg_scope` --- compiler/rustc_codegen_ssa/src/mir/debuginfo.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'compiler/rustc_codegen_ssa/src') 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 { - // FIXME(eddyb) this should never be `None`, after initialization. - pub dbg_scope: Option, + pub dbg_scope: S, /// Call site location, if this scope was inlined from another function. pub inlined_at: Option, @@ -61,17 +60,12 @@ impl<'tcx, S: Copy, L: Copy> DebugScope { 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 } } } -- cgit 1.4.1-3-g733a5