diff --git a/rustc_codegen_spirv/src/builder/builder_methods.rs b/rustc_codegen_spirv/src/builder/builder_methods.rs index ac96ddd4f3..3694bd4392 100644 --- a/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -390,8 +390,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { self.basic_block } - fn set_span(&self, span: Span) { - *self.current_span.borrow_mut() = Some(span); + fn set_span(&mut self, span: Span) { + self.current_span = Some(span); } fn position_at_end(&mut self, llbb: Self::BasicBlock) { diff --git a/rustc_codegen_spirv/src/builder/mod.rs b/rustc_codegen_spirv/src/builder/mod.rs index edde70fe30..37febf0c8d 100644 --- a/rustc_codegen_spirv/src/builder/mod.rs +++ b/rustc_codegen_spirv/src/builder/mod.rs @@ -28,7 +28,6 @@ use rustc_span::source_map::Span; use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode}; use rustc_target::abi::{HasDataLayout, LayoutOf, Size, TargetDataLayout}; use rustc_target::spec::{HasTargetSpec, Target}; -use std::cell::RefCell; use std::ops::Deref; pub struct Builder<'a, 'tcx> { @@ -36,7 +35,7 @@ pub struct Builder<'a, 'tcx> { cursor: BuilderCursor, current_fn: ::Function, basic_block: ::BasicBlock, - current_span: RefCell>, + current_span: Option, } impl<'a, 'tcx> Builder<'a, 'tcx> { @@ -46,7 +45,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } pub fn zombie(&self, word: Word, reason: &'static str) { - if let Some(current_span) = *self.current_span.borrow() { + if let Some(current_span) = self.current_span { self.zombie_with_span(word, current_span, reason); } else { self.zombie_no_span(word, reason); @@ -66,7 +65,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /* pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> { - if let Some(current_span) = *self.current_span.borrow() { + if let Some(current_span) = self.current_span { self.tcx.sess.struct_span_err(current_span, msg) } else { self.tcx.sess.struct_err(msg) @@ -74,7 +73,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } pub fn err(&self, msg: &str) { - if let Some(current_span) = *self.current_span.borrow() { + if let Some(current_span) = self.current_span { self.tcx.sess.span_err(current_span, msg) } else { self.tcx.sess.err(msg) @@ -83,7 +82,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { */ pub fn fatal(&self, msg: &str) -> ! { - if let Some(current_span) = *self.current_span.borrow() { + if let Some(current_span) = self.current_span { self.tcx.sess.span_fatal(current_span, msg) } else { self.tcx.sess.fatal(msg)