Skip to content

Commit 6170f48

Browse files
committed
fix(builder.rs): Add cfg(feature = "master") to set_location
1 parent 5b053a3 commit 6170f48

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/builder.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc_codegen_ssa::traits::{
2626
use rustc_data_structures::fx::FxHashSet;
2727
use rustc_middle::bug;
2828
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
29-
use rustc_middle::mir::Rvalue;
3029
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
3130
use rustc_middle::ty::layout::{FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers, TyAndLayout};
3231
use rustc_span::Span;
@@ -401,9 +400,8 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> {
401400

402401
pub fn set_rval_location<'a, 'gcc, 'tcx>(bx: &mut Builder<'a,'gcc,'tcx>, r:RValue<'gcc>) -> RValue<'gcc> {
403402
if bx.loc.is_some(){
404-
unsafe {
405-
r.set_location(bx.loc.unwrap());
406-
}
403+
#[cfg(feature = "master")]
404+
r.set_location(bx.loc.unwrap());
407405
}
408406
r
409407

@@ -545,9 +543,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
545543
fn fmul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
546544
let i=a * b;
547545
if self.loc.is_some() {
548-
unsafe{
549-
i.set_location(self.loc.clone().unwrap());
550-
}
546+
#[cfg(feature = "master")]
547+
i.set_location(self.loc.clone().unwrap());
551548
}
552549
i
553550
}
@@ -666,7 +663,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
666663
let ret = self.cx.gcc_or(a, b, self.loc);
667664

668665
if self.loc.is_some() {
669-
unsafe { ret.set_location(self.loc.unwrap()); }
666+
#[cfg(feature = "master")]
667+
ret.set_location(self.loc.unwrap());
670668
}
671669
ret
672670
}

src/debuginfo.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
3232
_fragment: Option<Range<Size>>,
3333
) {
3434
// Not sure if this is correct, probably wrong but still keep it here.
35-
unsafe {
36-
#[cfg(feature = "master")]
37-
variable_alloca.set_location(dbg_loc);
38-
}
35+
#[cfg(feature = "master")]
36+
variable_alloca.set_location(dbg_loc);
3937
}
4038

4139
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
@@ -45,7 +43,7 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
4543
/// Currently, this function is not yet implemented. It seems that the
4644
/// debug name and the mangled name should both be included in the LValues.
4745
/// Besides, a function to get the rvalue type(m_is_lvalue) should also be included.
48-
fn set_var_name(&mut self, value: RValue<'gcc>, name: &str) {
46+
fn set_var_name(&mut self, _value: RValue<'gcc>, _name: &str) {
4947
//unimplemented!();
5048
}
5149

@@ -264,7 +262,7 @@ impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
264262
}
265263
rustc_span::RealFileName::Remapped {
266264
local_path,
267-
virtual_name,
265+
virtual_name:_,
268266
} => if let Some(name) = local_path.as_ref() {
269267
if let Some(name) = name.to_str(){
270268
self.context.new_location(

0 commit comments

Comments
 (0)