Skip to content

Commit cfe88fa

Browse files
authored
Merge pull request #663 from GuillaumeGomez/edition-2024
Switch to 2024 edition and remove `let_chains` feature
2 parents 633ecc8 + 390fc73 commit cfe88fa

File tree

11 files changed

+20
-19
lines changed

11 files changed

+20
-19
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rustc_codegen_gcc"
33
version = "0.1.0"
44
authors = ["Antoni Boucher <[email protected]>"]
5-
edition = "2018"
5+
edition = "2024"
66
license = "MIT OR Apache-2.0"
77

88
[lib]

build_system/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "y"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
boml = "0.3.1"

build_system/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ pub enum Command {
6060

6161
fn main() {
6262
if env::var("RUST_BACKTRACE").is_err() {
63-
env::set_var("RUST_BACKTRACE", "1");
63+
unsafe {
64+
env::set_var("RUST_BACKTRACE", "1");
65+
}
6466
}
6567

6668
let command = match env::args().nth(1).as_deref() {

build_system/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
1010
use std::process::{Command, ExitStatus, Output};
1111

1212
#[cfg(unix)]
13-
extern "C" {
13+
unsafe extern "C" {
1414
fn raise(signal: c_int) -> c_int;
1515
}
1616

src/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ fn thin_lto(
589589
Ok((opt_jobs, copy_jobs))
590590
}
591591

592-
pub unsafe fn optimize_thin_module(
592+
pub fn optimize_thin_module(
593593
thin_module: ThinModule<GccCodegenBackend>,
594594
_cgcx: &CodegenContext<GccCodegenBackend>,
595595
) -> Result<ModuleCodegen<GccContext>, FatalError> {

src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::base::add_pic_option;
1414
use crate::errors::CopyBitcode;
1515
use crate::{GccCodegenBackend, GccContext};
1616

17-
pub(crate) unsafe fn codegen(
17+
pub(crate) fn codegen(
1818
cgcx: &CodegenContext<GccCodegenBackend>,
1919
dcx: DiagCtxtHandle<'_>,
2020
module: ModuleCodegen<GccContext>,

src/consts.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
191191
// TODO(antoyo): check if it's okay that no link_section is set.
192192

193193
let typ = self.val_ty(cv).get_aligned(align.bytes());
194-
let global = self.declare_private_global(&name[..], typ);
195-
global
194+
self.declare_private_global(&name[..], typ)
196195
}
197196
_ => {
198197
let typ = self.val_ty(cv).get_aligned(align.bytes());
199-
let global = self.declare_unnamed_global(typ);
200-
global
198+
self.declare_unnamed_global(typ)
201199
}
202200
};
203201
global.global_set_initializer_rvalue(cv);

src/debuginfo.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
289289
) -> Self::DILocation {
290290
let pos = span.lo();
291291
let DebugLoc { file, line, col } = self.lookup_debug_loc(pos);
292-
let loc = match file.name {
292+
match file.name {
293293
rustc_span::FileName::Real(ref name) => match *name {
294294
rustc_span::RealFileName::LocalPath(ref name) => {
295295
if let Some(name) = name.to_str() {
@@ -314,7 +314,6 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
314314
}
315315
},
316316
_ => Location::null(),
317-
};
318-
loc
317+
}
319318
}
320319
}

src/declare.rs

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
157157
///
158158
/// If there’s a value with the same name already declared, the function will
159159
/// update the declaration and return existing Value instead.
160+
#[allow(clippy::let_and_return)]
160161
fn declare_raw_fn<'gcc>(
161162
cx: &CodegenCx<'gcc, '_>,
162163
name: &str,

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#![allow(internal_features)]
1717
#![doc(rust_logo)]
1818
#![feature(rustdoc_internals)]
19-
#![feature(rustc_private, decl_macro, never_type, trusted_len, let_chains)]
19+
#![feature(rustc_private, decl_macro, never_type, trusted_len)]
2020
#![allow(broken_intra_doc_links)]
2121
#![recursion_limit = "256"]
2222
#![warn(rust_2018_idioms)]
@@ -454,7 +454,7 @@ impl WriteBackendMethods for GccCodegenBackend {
454454
}
455455

456456
/// This is the entrypoint for a hot plugged rustc_codegen_gccjit
457-
#[no_mangle]
457+
#[unsafe(no_mangle)]
458458
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
459459
#[cfg(feature = "master")]
460460
let info = {

tests/lang_tests_common.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ pub fn main_inner(profile: Profile) {
4242
.expect("failed to get absolute path of `gcc-path`")
4343
.display()
4444
.to_string();
45-
env::set_var("LD_LIBRARY_PATH", gcc_path);
45+
unsafe {
46+
env::set_var("LD_LIBRARY_PATH", gcc_path);
47+
}
4648

4749
fn rust_filter(path: &Path) -> bool {
4850
path.is_file() && path.extension().expect("extension").to_str().expect("to_str") == "rs"
@@ -67,15 +69,14 @@ pub fn main_inner(profile: Profile) {
6769
.test_dir("tests/run")
6870
.test_path_filter(filter)
6971
.test_extract(|path| {
70-
let lines = std::fs::read_to_string(path)
72+
std::fs::read_to_string(path)
7173
.expect("read file")
7274
.lines()
7375
.skip_while(|l| !l.starts_with("//"))
7476
.take_while(|l| l.starts_with("//"))
7577
.map(|l| &l[2..])
7678
.collect::<Vec<_>>()
77-
.join("\n");
78-
lines
79+
.join("\n")
7980
})
8081
.test_cmds(move |path| {
8182
// Test command 1: Compile `x.rs` into `tempdir/x`.

0 commit comments

Comments
 (0)