about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortempdragon <645703113@qq.com>2024-02-28 10:04:25 +0800
committertempdragon <645703113@qq.com>2024-02-28 10:04:25 +0800
commit6170f48e3f5800a75e2ded5e55669048acfcbb2f (patch)
treee54f75a7f0ee24aacac7678206a9ba54b9ab9c35 /src
parent5b053a3c3c62ea77f0b8865a4ac97a90bb606c78 (diff)
downloadrust-6170f48e3f5800a75e2ded5e55669048acfcbb2f.tar.gz
rust-6170f48e3f5800a75e2ded5e55669048acfcbb2f.zip
fix(builder.rs): Add `cfg(feature = "master")` to set_location
Diffstat (limited to 'src')
-rw-r--r--src/builder.rs14
-rw-r--r--src/debuginfo.rs10
2 files changed, 10 insertions, 14 deletions
diff --git a/src/builder.rs b/src/builder.rs
index c5d3ed8c8a1..663e42aaf85 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -26,7 +26,6 @@ use rustc_codegen_ssa::traits::{
 use rustc_data_structures::fx::FxHashSet;
 use rustc_middle::bug;
 use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
-use rustc_middle::mir::Rvalue;
 use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
 use rustc_middle::ty::layout::{FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers, TyAndLayout};
 use rustc_span::Span;
@@ -401,9 +400,8 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> {
 
 pub fn set_rval_location<'a, 'gcc, 'tcx>(bx: &mut Builder<'a,'gcc,'tcx>, r:RValue<'gcc>) -> RValue<'gcc> {
     if bx.loc.is_some(){
-        unsafe {
-            r.set_location(bx.loc.unwrap());
-        }
+        #[cfg(feature = "master")]
+        r.set_location(bx.loc.unwrap());
     }
     r
     
@@ -545,9 +543,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
     fn fmul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
         let i=a * b;
         if self.loc.is_some() {
-            unsafe{
-                i.set_location(self.loc.clone().unwrap());
-            }
+            #[cfg(feature = "master")]
+            i.set_location(self.loc.clone().unwrap());
         }
         i
     }
@@ -666,7 +663,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
         let ret = self.cx.gcc_or(a, b, self.loc);
         
         if self.loc.is_some() {
-            unsafe { ret.set_location(self.loc.unwrap()); }
+            #[cfg(feature = "master")]
+            ret.set_location(self.loc.unwrap());
         }
         ret
     }
diff --git a/src/debuginfo.rs b/src/debuginfo.rs
index e01624ce15e..0ac5841df63 100644
--- a/src/debuginfo.rs
+++ b/src/debuginfo.rs
@@ -32,10 +32,8 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
         _fragment: Option<Range<Size>>,
     ) {
         // Not sure if this is correct, probably wrong but still keep it here.
-        unsafe {
-            #[cfg(feature = "master")]
-            variable_alloca.set_location(dbg_loc);
-        }
+        #[cfg(feature = "master")]
+        variable_alloca.set_location(dbg_loc);
     }
 
     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> {
     /// Currently, this function is not yet implemented. It seems that the
     /// debug name and the mangled name should both be included in the LValues.
     /// Besides, a function to get the rvalue type(m_is_lvalue) should also be included.
-    fn set_var_name(&mut self, value: RValue<'gcc>, name: &str) {
+    fn set_var_name(&mut self, _value: RValue<'gcc>, _name: &str) {
         //unimplemented!();
     }
 
@@ -264,7 +262,7 @@ impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
                 }
                 rustc_span::RealFileName::Remapped {
                     local_path,
-                    virtual_name,
+                    virtual_name:_,
                 } => if let Some(name) = local_path.as_ref() {
                     if let Some(name) = name.to_str(){
                         self.context.new_location(