Skip to content

Commit 5c50a42

Browse files
authored
Merge pull request #760 from rust-lang/sync_from_rust_2025_09_16
Sync from rust 2025/09/16
2 parents 35cd7f5 + 7c12d9d commit 5c50a42

File tree

10 files changed

+57
-51
lines changed

10 files changed

+57
-51
lines changed

.github/workflows/stdarch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# TODO: remove when we have binutils version 2.43 in the repo.
4242
- name: Install more recent binutils
4343
run: |
44-
echo "deb http://archive.ubuntu.com/ubuntu oracular main universe" | sudo tee /etc/apt/sources.list.d/oracular-copies.list
44+
echo "deb http://archive.ubuntu.com/ubuntu plucky main universe" | sudo tee /etc/apt/sources.list.d/plucky-copies.list
4545
sudo apt-get update
4646
sudo apt-get install binutils
4747

build_system/src/test.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,8 @@ fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
714714
let path = get_sysroot_dir().join("sysroot_src/library/coretests");
715715
let _ = remove_dir_all(path.join("target"));
716716
// TODO(antoyo): run in release mode when we fix the failures.
717-
run_cargo_command(&[&"test"], Some(&path), env, args)?;
717+
// TODO(antoyo): Stop skipping funnel shift tests when those operations are fixed.
718+
run_cargo_command(&[&"test", &"--", &"--skip", &"test_funnel_shift"], Some(&path), env, args)?;
718719
Ok(())
719720
}
720721

@@ -1083,27 +1084,36 @@ where
10831084

10841085
fn test_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
10851086
test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
1087+
test_rustc_inner(env, args, |_| Ok(false), false, "run-make-cargo")?;
10861088
test_rustc_inner(env, args, |_| Ok(false), false, "ui")
10871089
}
10881090

10891091
fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1090-
let result1 = test_rustc_inner(
1092+
let run_make_result = test_rustc_inner(
10911093
env,
10921094
args,
10931095
retain_files_callback("tests/failing-run-make-tests.txt", "run-make"),
10941096
false,
10951097
"run-make",
10961098
);
10971099

1098-
let result2 = test_rustc_inner(
1100+
let run_make_cargo_result = test_rustc_inner(
1101+
env,
1102+
args,
1103+
retain_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"),
1104+
false,
1105+
"run-make",
1106+
);
1107+
1108+
let ui_result = test_rustc_inner(
10991109
env,
11001110
args,
11011111
retain_files_callback("tests/failing-ui-tests.txt", "ui"),
11021112
false,
11031113
"ui",
11041114
);
11051115

1106-
result1.and(result2)
1116+
run_make_result.and(run_make_cargo_result).and(ui_result)
11071117
}
11081118

11091119
fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
@@ -1120,6 +1130,13 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
11201130
remove_files_callback("tests/failing-run-make-tests.txt", "run-make"),
11211131
false,
11221132
"run-make",
1133+
)?;
1134+
test_rustc_inner(
1135+
env,
1136+
args,
1137+
remove_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"),
1138+
false,
1139+
"run-make-cargo",
11231140
)
11241141
}
11251142

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-08-25"
2+
channel = "nightly-2025-09-16"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/back/lto.rs

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput};
2929
use rustc_codegen_ssa::traits::*;
3030
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file};
3131
use rustc_data_structures::memmap::Mmap;
32-
use rustc_errors::{DiagCtxtHandle, FatalError};
32+
use rustc_errors::DiagCtxtHandle;
3333
use rustc_middle::bug;
3434
use rustc_middle::dep_graph::WorkProduct;
3535
use rustc_session::config::Lto;
@@ -51,12 +51,11 @@ fn prepare_lto(
5151
cgcx: &CodegenContext<GccCodegenBackend>,
5252
each_linked_rlib_for_lto: &[PathBuf],
5353
dcx: DiagCtxtHandle<'_>,
54-
) -> Result<LtoData, FatalError> {
54+
) -> LtoData {
5555
let tmp_path = match tempdir() {
5656
Ok(tmp_path) => tmp_path,
5757
Err(error) => {
58-
eprintln!("Cannot create temporary directory: {}", error);
59-
return Err(FatalError);
58+
dcx.fatal(format!("Cannot create temporary directory: {}", error));
6059
}
6160
};
6261

@@ -91,15 +90,14 @@ fn prepare_lto(
9190
upstream_modules.push((module, CString::new(name).unwrap()));
9291
}
9392
Err(e) => {
94-
dcx.emit_err(e);
95-
return Err(FatalError);
93+
dcx.emit_fatal(e);
9694
}
9795
}
9896
}
9997
}
10098
}
10199

102-
Ok(LtoData { upstream_modules, tmp_path })
100+
LtoData { upstream_modules, tmp_path }
103101
}
104102

105103
fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
@@ -114,10 +112,10 @@ pub(crate) fn run_fat(
114112
cgcx: &CodegenContext<GccCodegenBackend>,
115113
each_linked_rlib_for_lto: &[PathBuf],
116114
modules: Vec<FatLtoInput<GccCodegenBackend>>,
117-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
115+
) -> ModuleCodegen<GccContext> {
118116
let dcx = cgcx.create_dcx();
119117
let dcx = dcx.handle();
120-
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?;
118+
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx);
121119
/*let symbols_below_threshold =
122120
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
123121
fat_lto(
@@ -137,7 +135,7 @@ fn fat_lto(
137135
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
138136
tmp_path: TempDir,
139137
//symbols_below_threshold: &[String],
140-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
138+
) -> ModuleCodegen<GccContext> {
141139
let _timer = cgcx.prof.generic_activity("GCC_fat_lto_build_monolithic_module");
142140
info!("going for a fat lto");
143141

@@ -206,7 +204,7 @@ fn fat_lto(
206204
let path = tmp_path.path().to_path_buf().join(&module.name);
207205
let path = path.to_str().expect("path");
208206
let context = &module.module_llvm.context;
209-
let config = cgcx.config(module.kind);
207+
let config = &cgcx.module_config;
210208
// NOTE: we need to set the optimization level here in order for LTO to do its job.
211209
context.set_optimization_level(to_gcc_opt_level(config.opt_level));
212210
context.add_command_line_option("-flto=auto");
@@ -261,7 +259,7 @@ fn fat_lto(
261259
// of now.
262260
module.module_llvm.temp_dir = Some(tmp_path);
263261

264-
Ok(module)
262+
module
265263
}
266264

267265
pub struct ModuleBuffer(PathBuf);
@@ -286,10 +284,10 @@ pub(crate) fn run_thin(
286284
each_linked_rlib_for_lto: &[PathBuf],
287285
modules: Vec<(String, ThinBuffer)>,
288286
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
289-
) -> Result<(Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>), FatalError> {
287+
) -> (Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>) {
290288
let dcx = cgcx.create_dcx();
291289
let dcx = dcx.handle();
292-
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?;
290+
let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx);
293291
if cgcx.opts.cg.linker_plugin_lto.enabled() {
294292
unreachable!(
295293
"We should never reach this case if the LTO step \
@@ -307,12 +305,9 @@ pub(crate) fn run_thin(
307305
)
308306
}
309307

310-
pub(crate) fn prepare_thin(
311-
module: ModuleCodegen<GccContext>,
312-
_emit_summary: bool,
313-
) -> (String, ThinBuffer) {
308+
pub(crate) fn prepare_thin(module: ModuleCodegen<GccContext>) -> (String, ThinBuffer) {
314309
let name = module.name;
315-
//let buffer = ThinBuffer::new(module.module_llvm.context, true, emit_summary);
310+
//let buffer = ThinBuffer::new(module.module_llvm.context, true);
316311
let buffer = ThinBuffer::new(&module.module_llvm.context);
317312
(name, buffer)
318313
}
@@ -355,7 +350,7 @@ fn thin_lto(
355350
tmp_path: TempDir,
356351
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
357352
//_symbols_below_threshold: &[String],
358-
) -> Result<(Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>), FatalError> {
353+
) -> (Vec<ThinModule<GccCodegenBackend>>, Vec<WorkProduct>) {
359354
let _timer = cgcx.prof.generic_activity("LLVM_thin_lto_global_analysis");
360355
info!("going for that thin, thin LTO");
361356

@@ -518,13 +513,13 @@ fn thin_lto(
518513
// TODO: save the directory so that it gets deleted later.
519514
std::mem::forget(tmp_path);
520515

521-
Ok((opt_jobs, copy_jobs))
516+
(opt_jobs, copy_jobs)
522517
}
523518

524519
pub fn optimize_thin_module(
525520
thin_module: ThinModule<GccCodegenBackend>,
526521
_cgcx: &CodegenContext<GccCodegenBackend>,
527-
) -> Result<ModuleCodegen<GccContext>, FatalError> {
522+
) -> ModuleCodegen<GccContext> {
528523
//let dcx = cgcx.create_dcx();
529524

530525
//let module_name = &thin_module.shared.module_names[thin_module.idx];
@@ -634,7 +629,8 @@ pub fn optimize_thin_module(
634629
save_temp_bitcode(cgcx, &module, "thin-lto-after-pm");
635630
}
636631
}*/
637-
Ok(module)
632+
#[allow(clippy::let_and_return)]
633+
module
638634
}
639635

640636
pub struct ThinBuffer {
@@ -651,10 +647,6 @@ impl ThinBufferMethods for ThinBuffer {
651647
fn data(&self) -> &[u8] {
652648
&[]
653649
}
654-
655-
fn thin_link_data(&self) -> &[u8] {
656-
unimplemented!();
657-
}
658650
}
659651

660652
pub struct ThinData; //(Arc<TempDir>);

src/back/write.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, Mo
66
use rustc_codegen_ssa::{CompiledModule, ModuleCodegen};
77
use rustc_fs_util::link_or_copy;
88
use rustc_session::config::OutputType;
9-
use rustc_span::fatal_error::FatalError;
109
use rustc_target::spec::SplitDebuginfo;
1110

1211
use crate::base::add_pic_option;
@@ -17,7 +16,7 @@ pub(crate) fn codegen(
1716
cgcx: &CodegenContext<GccCodegenBackend>,
1817
module: ModuleCodegen<GccContext>,
1918
config: &ModuleConfig,
20-
) -> Result<CompiledModule, FatalError> {
19+
) -> CompiledModule {
2120
let dcx = cgcx.create_dcx();
2221
let dcx = dcx.handle();
2322

@@ -246,15 +245,15 @@ pub(crate) fn codegen(
246245
}
247246
}
248247

249-
Ok(module.into_compiled_module(
248+
module.into_compiled_module(
250249
config.emit_obj != EmitObj::None,
251250
cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo == SplitDebuginfo::Unpacked,
252251
config.emit_bc,
253252
config.emit_asm,
254253
config.emit_ir,
255254
&cgcx.output_filenames,
256255
cgcx.invocation_temp.as_deref(),
257-
))
256+
)
258257
}
259258

260259
pub(crate) fn save_temp_bitcode(

src/consts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
8181
if global.to_rvalue().get_type() != val_llty {
8282
global.to_rvalue().set_type(val_llty);
8383
}
84+
85+
// NOTE: Alignment from attributes has already been applied to the allocation.
8486
set_global_alignment(self, global, alloc.align);
8587

8688
global.global_set_initializer_rvalue(value);

src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ use rustc_middle::util::Providers;
110110
use rustc_session::Session;
111111
use rustc_session::config::{OptLevel, OutputFilenames};
112112
use rustc_span::Symbol;
113-
use rustc_span::fatal_error::FatalError;
114113
use rustc_target::spec::RelocModel;
115114
use tempfile::TempDir;
116115

@@ -362,7 +361,7 @@ impl WriteBackendMethods for GccCodegenBackend {
362361
_exported_symbols_for_lto: &[String],
363362
each_linked_rlib_for_lto: &[PathBuf],
364363
modules: Vec<FatLtoInput<Self>>,
365-
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
364+
) -> ModuleCodegen<Self::Module> {
366365
back::lto::run_fat(cgcx, each_linked_rlib_for_lto, modules)
367366
}
368367

@@ -373,7 +372,7 @@ impl WriteBackendMethods for GccCodegenBackend {
373372
each_linked_rlib_for_lto: &[PathBuf],
374373
modules: Vec<(String, Self::ThinBuffer)>,
375374
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
376-
) -> Result<(Vec<ThinModule<Self>>, Vec<WorkProduct>), FatalError> {
375+
) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>) {
377376
back::lto::run_thin(cgcx, each_linked_rlib_for_lto, modules, cached_modules)
378377
}
379378

@@ -390,31 +389,27 @@ impl WriteBackendMethods for GccCodegenBackend {
390389
_dcx: DiagCtxtHandle<'_>,
391390
module: &mut ModuleCodegen<Self::Module>,
392391
config: &ModuleConfig,
393-
) -> Result<(), FatalError> {
392+
) {
394393
module.module_llvm.context.set_optimization_level(to_gcc_opt_level(config.opt_level));
395-
Ok(())
396394
}
397395

398396
fn optimize_thin(
399397
cgcx: &CodegenContext<Self>,
400398
thin: ThinModule<Self>,
401-
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
399+
) -> ModuleCodegen<Self::Module> {
402400
back::lto::optimize_thin_module(thin, cgcx)
403401
}
404402

405403
fn codegen(
406404
cgcx: &CodegenContext<Self>,
407405
module: ModuleCodegen<Self::Module>,
408406
config: &ModuleConfig,
409-
) -> Result<CompiledModule, FatalError> {
407+
) -> CompiledModule {
410408
back::write::codegen(cgcx, module, config)
411409
}
412410

413-
fn prepare_thin(
414-
module: ModuleCodegen<Self::Module>,
415-
emit_summary: bool,
416-
) -> (String, Self::ThinBuffer) {
417-
back::lto::prepare_thin(module, emit_summary)
411+
fn prepare_thin(module: ModuleCodegen<Self::Module>) -> (String, Self::ThinBuffer) {
412+
back::lto::prepare_thin(module)
418413
}
419414

420415
fn serialize_module(_module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer) {

src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
240240

241241
// Make sure lifetimes are erased, to avoid generating distinct LLVM
242242
// types for Rust types that only differ in the choice of lifetimes.
243-
let normal_ty = cx.tcx.erase_regions(self.ty);
243+
let normal_ty = cx.tcx.erase_and_anonymize_regions(self.ty);
244244

245245
let mut defer = None;
246246
let ty = if self.ty != normal_ty {

target_specs/m68k-unknown-linux-gnu.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
"unix"
2323
],
2424
"target-mcount": "_mcount",
25-
"target-pointer-width": "32"
25+
"target-pointer-width": 32
2626
}

tests/failing-ui-tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs
8888
tests/ui/explicit-tail-calls/recursion-etc.rs
8989
tests/ui/explicit-tail-calls/indexer.rs
9090
tests/ui/explicit-tail-calls/drop-order.rs
91+
tests/ui/c-variadic/valid.rs

0 commit comments

Comments
 (0)