about summary refs log tree commit diff
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2025-05-09 07:57:24 -0400
committerGitHub <noreply@github.com>2025-05-09 07:57:24 -0400
commitcfe88fa8318ecf6aa2947a6314c0dcdc830e7de0 (patch)
treedcfda890a817f4405d112aa133f48a073e9929f9
parent633ecc82d604270f875efa4fd98d7279d3db870c (diff)
parent390fc73ae737ef99fa109add85bbf60e53f1a983 (diff)
downloadrust-cfe88fa8318ecf6aa2947a6314c0dcdc830e7de0.tar.gz
rust-cfe88fa8318ecf6aa2947a6314c0dcdc830e7de0.zip
Merge pull request #663 from GuillaumeGomez/edition-2024
Switch to 2024 edition and remove `let_chains` feature
-rw-r--r--Cargo.toml2
-rw-r--r--build_system/Cargo.toml2
-rw-r--r--build_system/src/main.rs4
-rw-r--r--build_system/src/utils.rs2
-rw-r--r--src/back/lto.rs2
-rw-r--r--src/back/write.rs2
-rw-r--r--src/consts.rs6
-rw-r--r--src/debuginfo.rs5
-rw-r--r--src/declare.rs1
-rw-r--r--src/lib.rs4
-rw-r--r--tests/lang_tests_common.rs9
11 files changed, 20 insertions, 19 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 717eaf9e058..c692a90f0a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
 name = "rustc_codegen_gcc"
 version = "0.1.0"
 authors = ["Antoni Boucher <bouanto@zoho.com>"]
-edition = "2018"
+edition = "2024"
 license = "MIT OR Apache-2.0"
 
 [lib]
diff --git a/build_system/Cargo.toml b/build_system/Cargo.toml
index d2600ed5a03..540d82369fd 100644
--- a/build_system/Cargo.toml
+++ b/build_system/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "y"
 version = "0.1.0"
-edition = "2021"
+edition = "2024"
 
 [dependencies]
 boml = "0.3.1"
diff --git a/build_system/src/main.rs b/build_system/src/main.rs
index 39361718306..c70b00e09ae 100644
--- a/build_system/src/main.rs
+++ b/build_system/src/main.rs
@@ -60,7 +60,9 @@ pub enum Command {
 
 fn main() {
     if env::var("RUST_BACKTRACE").is_err() {
-        env::set_var("RUST_BACKTRACE", "1");
+        unsafe {
+            env::set_var("RUST_BACKTRACE", "1");
+        }
     }
 
     let command = match env::args().nth(1).as_deref() {
diff --git a/build_system/src/utils.rs b/build_system/src/utils.rs
index 401c23948e5..ca177a5feb8 100644
--- a/build_system/src/utils.rs
+++ b/build_system/src/utils.rs
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
 use std::process::{Command, ExitStatus, Output};
 
 #[cfg(unix)]
-extern "C" {
+unsafe extern "C" {
     fn raise(signal: c_int) -> c_int;
 }
 
diff --git a/src/back/lto.rs b/src/back/lto.rs
index e5221c7da31..62bb58d44fe 100644
--- a/src/back/lto.rs
+++ b/src/back/lto.rs
@@ -589,7 +589,7 @@ fn thin_lto(
     Ok((opt_jobs, copy_jobs))
 }
 
-pub unsafe fn optimize_thin_module(
+pub fn optimize_thin_module(
     thin_module: ThinModule<GccCodegenBackend>,
     _cgcx: &CodegenContext<GccCodegenBackend>,
 ) -> Result<ModuleCodegen<GccContext>, FatalError> {
diff --git a/src/back/write.rs b/src/back/write.rs
index 16c895322e8..09e955acf39 100644
--- a/src/back/write.rs
+++ b/src/back/write.rs
@@ -14,7 +14,7 @@ use crate::base::add_pic_option;
 use crate::errors::CopyBitcode;
 use crate::{GccCodegenBackend, GccContext};
 
-pub(crate) unsafe fn codegen(
+pub(crate) fn codegen(
     cgcx: &CodegenContext<GccCodegenBackend>,
     dcx: DiagCtxtHandle<'_>,
     module: ModuleCodegen<GccContext>,
diff --git a/src/consts.rs b/src/consts.rs
index 0a67bd7bc71..033afc0f8fb 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -191,13 +191,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
                 // TODO(antoyo): check if it's okay that no link_section is set.
 
                 let typ = self.val_ty(cv).get_aligned(align.bytes());
-                let global = self.declare_private_global(&name[..], typ);
-                global
+                self.declare_private_global(&name[..], typ)
             }
             _ => {
                 let typ = self.val_ty(cv).get_aligned(align.bytes());
-                let global = self.declare_unnamed_global(typ);
-                global
+                self.declare_unnamed_global(typ)
             }
         };
         global.global_set_initializer_rvalue(cv);
diff --git a/src/debuginfo.rs b/src/debuginfo.rs
index f3ced864395..e0597d0030d 100644
--- a/src/debuginfo.rs
+++ b/src/debuginfo.rs
@@ -289,7 +289,7 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
     ) -> Self::DILocation {
         let pos = span.lo();
         let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
-        let loc = match file.name {
+        match file.name {
             rustc_span::FileName::Real(ref name) => match *name {
                 rustc_span::RealFileName::LocalPath(ref name) => {
                     if let Some(name) = name.to_str() {
@@ -314,7 +314,6 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
                 }
             },
             _ => Location::null(),
-        };
-        loc
+        }
     }
 }
diff --git a/src/declare.rs b/src/declare.rs
index c1ca3eb849e..bed82073e2c 100644
--- a/src/declare.rs
+++ b/src/declare.rs
@@ -157,6 +157,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
 ///
 /// If there’s a value with the same name already declared, the function will
 /// update the declaration and return existing Value instead.
+#[allow(clippy::let_and_return)]
 fn declare_raw_fn<'gcc>(
     cx: &CodegenCx<'gcc, '_>,
     name: &str,
diff --git a/src/lib.rs b/src/lib.rs
index 555f164e53f..68848730461 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,7 +16,7 @@
 #![allow(internal_features)]
 #![doc(rust_logo)]
 #![feature(rustdoc_internals)]
-#![feature(rustc_private, decl_macro, never_type, trusted_len, let_chains)]
+#![feature(rustc_private, decl_macro, never_type, trusted_len)]
 #![allow(broken_intra_doc_links)]
 #![recursion_limit = "256"]
 #![warn(rust_2018_idioms)]
@@ -454,7 +454,7 @@ impl WriteBackendMethods for GccCodegenBackend {
 }
 
 /// This is the entrypoint for a hot plugged rustc_codegen_gccjit
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
     #[cfg(feature = "master")]
     let info = {
diff --git a/tests/lang_tests_common.rs b/tests/lang_tests_common.rs
index d5a0d71c4b2..bdcf14b4b26 100644
--- a/tests/lang_tests_common.rs
+++ b/tests/lang_tests_common.rs
@@ -42,7 +42,9 @@ pub fn main_inner(profile: Profile) {
         .expect("failed to get absolute path of `gcc-path`")
         .display()
         .to_string();
-    env::set_var("LD_LIBRARY_PATH", gcc_path);
+    unsafe {
+        env::set_var("LD_LIBRARY_PATH", gcc_path);
+    }
 
     fn rust_filter(path: &Path) -> bool {
         path.is_file() && path.extension().expect("extension").to_str().expect("to_str") == "rs"
@@ -67,15 +69,14 @@ pub fn main_inner(profile: Profile) {
         .test_dir("tests/run")
         .test_path_filter(filter)
         .test_extract(|path| {
-            let lines = std::fs::read_to_string(path)
+            std::fs::read_to_string(path)
                 .expect("read file")
                 .lines()
                 .skip_while(|l| !l.starts_with("//"))
                 .take_while(|l| l.starts_with("//"))
                 .map(|l| &l[2..])
                 .collect::<Vec<_>>()
-                .join("\n");
-            lines
+                .join("\n")
         })
         .test_cmds(move |path| {
             // Test command 1: Compile `x.rs` into `tempdir/x`.