Skip to content

Commit 59a81c2

Browse files
authored
Merge pull request #594 from rust-lang/sync_from_rust_2025_01_12
Sync from rust 2025/01/12
2 parents f03d3c4 + 17f5a4f commit 59a81c2

25 files changed

+234
-1288
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- { gcc: "gcc-13.deb" }
2323
- { gcc: "gcc-13-without-int128.deb" }
2424
commands: [
25-
"--mini-tests",
2625
"--std-tests",
2726
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
2827
# "--asm-tests",
@@ -79,6 +78,7 @@ jobs:
7978
run: |
8079
./y.sh prepare --only-libcore
8180
./y.sh build --sysroot
81+
./y.sh test --mini-tests
8282
cargo test
8383
8484
- name: Run y.sh cargo build

.github/workflows/m68k.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
commands: [
26-
"--mini-tests",
2726
"--std-tests",
2827
# TODO(antoyo): fix those on m68k.
2928
#"--test-libcore",
@@ -93,6 +92,7 @@ jobs:
9392
run: |
9493
./y.sh prepare --only-libcore --cross
9594
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
95+
./y.sh test --mini-tests
9696
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
9797
./y.sh clean all
9898

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
run: |
5555
./y.sh prepare --only-libcore
5656
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
57+
./y.sh test --mini-tests
5758
cargo test
5859
./y.sh clean all
5960

.github/workflows/stdarch.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ jobs:
7373
echo "LD_LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7474
echo "LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7575
76-
- name: Build (part 2)
77-
run: |
78-
cargo test
79-
8076
- name: Clean
8177
if: ${{ !matrix.cargo_runner }}
8278
run: |
@@ -92,6 +88,7 @@ jobs:
9288
if: ${{ !matrix.cargo_runner }}
9389
run: |
9490
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
91+
cargo test
9592
9693
- name: Run stdarch tests
9794
if: ${{ !matrix.cargo_runner }}

build_system/src/test.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,17 @@ fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result<
848848
if line.is_empty() {
849849
continue;
850850
}
851-
if ["//@ error-pattern:", "//@ build-fail", "//@ run-fail", "-Cllvm-args", "//~", "thread"]
852-
.iter()
853-
.any(|check| line.contains(check))
851+
if [
852+
"//@ error-pattern:",
853+
"//@ build-fail",
854+
"//@ run-fail",
855+
"//@ known-bug",
856+
"-Cllvm-args",
857+
"//~",
858+
"thread",
859+
]
860+
.iter()
861+
.any(|check| line.contains(check))
854862
{
855863
return Ok(true);
856864
}
@@ -868,9 +876,14 @@ fn contains_ui_error_patterns(file_path: &Path, keep_lto_tests: bool) -> Result<
868876
return Ok(true);
869877
}
870878
}
871-
if file_path.display().to_string().contains("ambiguous-4-extern.rs") {
879+
let file_path = file_path.display().to_string();
880+
if file_path.contains("ambiguous-4-extern.rs") {
872881
eprintln!("nothing found for {file_path:?}");
873882
}
883+
// The files in this directory contain errors.
884+
if file_path.contains("/error-emitter/") {
885+
return Ok(true);
886+
}
874887
Ok(false)
875888
}
876889

example/mini_core.rs

+8
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ impl Add for usize {
170170
}
171171
}
172172

173+
impl Add for isize {
174+
type Output = Self;
175+
176+
fn add(self, rhs: Self) -> Self {
177+
self + rhs
178+
}
179+
}
180+
173181
#[lang = "sub"]
174182
pub trait Sub<RHS = Self> {
175183
type Output;

messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ codegen_gcc_lto_not_supported =
99
LTO is not supported. You may get a linker error.
1010
1111
codegen_gcc_forbidden_ctarget_feature =
12-
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`
12+
target feature `{$feature}` cannot be toggled with `-Ctarget-feature`: {$reason}
1313
1414
codegen_gcc_unwinding_inline_asm =
1515
GCC backend does not support unwinding from inline asm

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-12-11"
2+
channel = "nightly-2025-01-12"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/asm.rs

+7
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,13 @@ impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
867867
template_str.push_str("\n.popsection");
868868
self.context.add_top_level_asm(None, &template_str);
869869
}
870+
871+
fn mangled_name(&self, instance: Instance<'tcx>) -> String {
872+
// TODO(@Amanieu): Additional mangling is needed on
873+
// some targets to add a leading underscore (Mach-O)
874+
// or byte count suffixes (x86 Windows).
875+
self.tcx.symbol_name(instance).name.to_string()
876+
}
870877
}
871878

872879
fn modifier_to_gcc(

src/attributes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
use gccjit::FnAttribute;
33
use gccjit::Function;
44
#[cfg(feature = "master")]
5-
use rustc_attr::InlineAttr;
6-
use rustc_attr::InstructionSetAttr;
5+
use rustc_attr_parsing::InlineAttr;
6+
use rustc_attr_parsing::InstructionSetAttr;
77
#[cfg(feature = "master")]
88
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
99
use rustc_middle::ty;
@@ -20,7 +20,7 @@ fn inline_attr<'gcc, 'tcx>(
2020
) -> Option<FnAttribute<'gcc>> {
2121
match inline {
2222
InlineAttr::Hint => Some(FnAttribute::Inline),
23-
InlineAttr::Always => Some(FnAttribute::AlwaysInline),
23+
InlineAttr::Always | InlineAttr::Force { .. } => Some(FnAttribute::AlwaysInline),
2424
InlineAttr::Never => {
2525
if cx.sess().target.arch != "amdgpu" {
2626
Some(FnAttribute::NoInline)

src/back/lto.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,7 @@ pub unsafe fn optimize_thin_module(
659659
{
660660
let _timer =
661661
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
662-
if !llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) {
663-
return Err(write::llvm_err(&dcx, LlvmError::PrepareThinLtoModule));
664-
}
662+
unsafe { llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) };
665663
save_temp_bitcode(cgcx, &module, "thin-lto-after-rename");
666664
}
667665

src/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
106106
// This is a monomorphization of a generic function.
107107
if !(cx.tcx.sess.opts.share_generics()
108108
|| tcx.codegen_fn_attrs(instance_def_id).inline
109-
== rustc_attr::InlineAttr::Never)
109+
== rustc_attr_parsing::InlineAttr::Never)
110110
{
111111
// When not sharing generics, all instances are in the same
112112
// crate and have hidden visibility.

src/debuginfo.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use gccjit::{Location, RValue};
44
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
55
use rustc_codegen_ssa::traits::{DebugInfoBuilderMethods, DebugInfoCodegenMethods};
66
use rustc_data_structures::sync::Lrc;
7-
use rustc_index::bit_set::BitSet;
7+
use rustc_index::bit_set::DenseBitSet;
88
use rustc_index::{Idx, IndexVec};
99
use rustc_middle::mir::{self, Body, SourceScope};
1010
use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
@@ -69,7 +69,7 @@ fn compute_mir_scopes<'gcc, 'tcx>(
6969
) {
7070
// Find all scopes with variables defined in them.
7171
let variables = if cx.sess().opts.debuginfo == DebugInfo::Full {
72-
let mut vars = BitSet::new_empty(mir.source_scopes.len());
72+
let mut vars = DenseBitSet::new_empty(mir.source_scopes.len());
7373
// FIXME(eddyb) take into account that arguments always have debuginfo,
7474
// irrespective of their name (assuming full debuginfo is enabled).
7575
// NOTE(eddyb) actually, on second thought, those are always in the
@@ -82,7 +82,7 @@ fn compute_mir_scopes<'gcc, 'tcx>(
8282
// Nothing to emit, of course.
8383
None
8484
};
85-
let mut instantiated = BitSet::new_empty(mir.source_scopes.len());
85+
let mut instantiated = DenseBitSet::new_empty(mir.source_scopes.len());
8686
// Instantiate all scopes.
8787
for idx in 0..mir.source_scopes.len() {
8888
let scope = SourceScope::new(idx);
@@ -101,9 +101,9 @@ fn make_mir_scope<'gcc, 'tcx>(
101101
cx: &CodegenCx<'gcc, 'tcx>,
102102
_instance: Instance<'tcx>,
103103
mir: &Body<'tcx>,
104-
variables: &Option<BitSet<SourceScope>>,
104+
variables: &Option<DenseBitSet<SourceScope>>,
105105
debug_context: &mut FunctionDebugContext<'tcx, (), Location<'gcc>>,
106-
instantiated: &mut BitSet<SourceScope>,
106+
instantiated: &mut DenseBitSet<SourceScope>,
107107
scope: SourceScope,
108108
) {
109109
if instantiated.contains(scope) {

src/errors.rs

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub(crate) struct UnstableCTargetFeature<'a> {
2828
#[diag(codegen_gcc_forbidden_ctarget_feature)]
2929
pub(crate) struct ForbiddenCTargetFeature<'a> {
3030
pub feature: &'a str,
31+
pub enabled: &'a str,
32+
pub reason: &'a str,
3133
}
3234

3335
#[derive(Subdiagnostic)]

0 commit comments

Comments
 (0)