Skip to content

Commit 98ed962

Browse files
authored
Merge pull request #535 from rust-lang/sync_from_rust_2024_07_02
Sync from rust 2024/07/02
2 parents 173773e + 5681c3c commit 98ed962

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+953
-356
lines changed

Diff for: .github/workflows/failures.yml

+4
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,16 @@ jobs:
9494
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
9595

9696
- name: Run tests
97+
# TODO: re-enable those tests for libgccjit 12.
98+
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
9799
id: tests
98100
run: |
99101
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} | tee output_log
100102
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
101103
102104
- name: Run failing ui pattern tests for ICE
105+
# TODO: re-enable those tests for libgccjit 12.
106+
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
103107
id: ui-tests
104108
run: |
105109
${{ matrix.libgccjit_version.env_extra }} ./y.sh test --release --test-failing-ui-pattern-tests ${{ matrix.libgccjit_version.extra }} | tee output_log_ui

Diff for: .github/workflows/gcc12.yml

+21-19
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,24 @@ jobs:
6767
- name: Build
6868
run: |
6969
./y.sh prepare --only-libcore --libgccjit12-patches
70-
./y.sh build --sysroot --no-default-features --sysroot-panic-abort
71-
cargo test --no-default-features
72-
./y.sh clean all
73-
74-
- name: Prepare dependencies
75-
run: |
76-
git config --global user.email "[email protected]"
77-
git config --global user.name "User"
78-
./y.sh prepare --libgccjit12-patches
79-
80-
- name: Add more failing tests for GCC 12
81-
run: cat tests/failing-ui-tests12.txt >> tests/failing-ui-tests.txt
82-
83-
- name: Add more failing tests because the sysroot is not compiled with LTO
84-
run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
85-
86-
- name: Run tests
87-
run: |
88-
./y.sh test --release --clean --build-sysroot ${{ matrix.commands }} --no-default-features
70+
./y.sh build --no-default-features --sysroot-panic-abort
71+
# Uncomment when we no longer need to remove global variables.
72+
#./y.sh build --sysroot --no-default-features --sysroot-panic-abort
73+
#cargo test --no-default-features
74+
#./y.sh clean all
75+
76+
#- name: Prepare dependencies
77+
#run: |
78+
#git config --global user.email "[email protected]"
79+
#git config --global user.name "User"
80+
#./y.sh prepare --libgccjit12-patches
81+
82+
#- name: Add more failing tests for GCC 12
83+
#run: cat tests/failing-ui-tests12.txt >> tests/failing-ui-tests.txt
84+
85+
#- name: Add more failing tests because the sysroot is not compiled with LTO
86+
#run: cat tests/failing-non-lto-tests.txt >> tests/failing-ui-tests.txt
87+
88+
#- name: Run tests
89+
#run: |
90+
#./y.sh test --release --clean --build-sysroot ${{ matrix.commands }} --no-default-features

Diff for: .github/workflows/stdarch.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ jobs:
9595
if: ${{ matrix.cargo_runner }}
9696
run: |
9797
# FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro.
98-
STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a
98+
# TODO: remove --skip test_mm512_stream_ps when stdarch is updated in rustc.
99+
STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_mm512_stream_ps

Diff for: Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ master = ["gccjit/master"]
2222
default = ["master"]
2323

2424
[dependencies]
25-
gccjit = { git = "https://github.com/antoyo/gccjit.rs" }
25+
gccjit = "2.1"
2626

2727
# Local copy.
2828
#gccjit = { path = "../gccjit.rs" }

Diff for: Readme.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ If you compiled cg_gccjit in debug mode (aka you didn't pass `--release` to `./y
121121

122122
### LTO
123123

124-
To use LTO, you need to set the variable `FAT_LTO=1` and `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
125-
Don't set `FAT_LTO` when compiling the sysroot, though: only set `EMBED_LTO_BITCODE=1`.
124+
To use LTO, you need to set the variable `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
126125

127126
Failing to set `EMBED_LTO_BITCODE` will give you the following error:
128127

Diff for: build_system/src/config.rs

-5
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,6 @@ impl ConfigInfo {
387387
rustflags.push("-Csymbol-mangling-version=v0".to_string());
388388
}
389389

390-
// Since we don't support ThinLTO, disable LTO completely when not trying to do LTO.
391-
// TODO(antoyo): remove when we can handle ThinLTO.
392-
if !env.contains_key(&"FAT_LTO".to_string()) {
393-
rustflags.push("-Clto=off".to_string());
394-
}
395390
// FIXME(antoyo): remove once the atomic shim is gone
396391
if os_name == "Darwin" {
397392
rustflags.extend_from_slice(&[

Diff for: build_system/src/test.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,16 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
645645
//"https://github.com/rust-lang/cargo", // TODO: very slow, only run on master?
646646
];
647647

648+
let mut env = env.clone();
649+
let rustflags =
650+
format!("{} --cap-lints allow", env.get("RUSTFLAGS").cloned().unwrap_or_default());
651+
env.insert("RUSTFLAGS".to_string(), rustflags);
648652
let run_tests = |projects_path, iter: &mut dyn Iterator<Item = &&str>| -> Result<(), String> {
649653
for project in iter {
650654
let clone_result = git_clone_root_dir(project, projects_path, true)?;
651655
let repo_path = Path::new(&clone_result.repo_dir);
652-
run_cargo_command(&[&"build", &"--release"], Some(repo_path), env, args)?;
653-
run_cargo_command(&[&"test"], Some(repo_path), env, args)?;
656+
run_cargo_command(&[&"build", &"--release"], Some(repo_path), &env, args)?;
657+
run_cargo_command(&[&"test"], Some(repo_path), &env, args)?;
654658
}
655659

656660
Ok(())
@@ -1034,18 +1038,19 @@ where
10341038
}
10351039

10361040
fn test_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1037-
test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
1041+
//test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
10381042
test_rustc_inner(env, args, |_| Ok(false), false, "ui")
10391043
}
10401044

10411045
fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1042-
let result1 = test_rustc_inner(
1046+
let result1 = Ok(());
1047+
/*test_rustc_inner(
10431048
env,
10441049
args,
10451050
retain_files_callback("tests/failing-run-make-tests.txt", "run-make"),
10461051
false,
10471052
"run-make",
1048-
);
1053+
)*/
10491054

10501055
let result2 = test_rustc_inner(
10511056
env,
@@ -1066,13 +1071,14 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
10661071
false,
10671072
"ui",
10681073
)?;
1069-
test_rustc_inner(
1074+
Ok(())
1075+
/*test_rustc_inner(
10701076
env,
10711077
args,
10721078
remove_files_callback("tests/failing-run-make-tests.txt", "run-make"),
10731079
false,
10741080
"run-make",
1075-
)
1081+
)*/
10761082
}
10771083

10781084
fn test_failing_ui_pattern_tests(env: &Env, args: &TestArg) -> Result<(), String> {

Diff for: example/example.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn array_as_slice(arr: &[u8; 3]) -> &[u8] {
153153
arr
154154
}
155155

156-
unsafe fn use_ctlz_nonzero(a: u16) -> u16 {
156+
unsafe fn use_ctlz_nonzero(a: u16) -> u32 {
157157
intrinsics::ctlz_nonzero(a)
158158
}
159159

Diff for: example/mini_core.rs

+31-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(
22
no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3-
decl_macro, rustc_attrs, transparent_unions, auto_traits,
3+
decl_macro, rustc_attrs, transparent_unions, auto_traits, freeze_impls,
44
thread_local
55
)]
66
#![no_core]
@@ -418,6 +418,35 @@ pub fn panic(_msg: &'static str) -> ! {
418418
}
419419
}
420420

421+
macro_rules! panic_const {
422+
($($lang:ident = $message:expr,)+) => {
423+
pub mod panic_const {
424+
use super::*;
425+
426+
$(
427+
#[track_caller]
428+
#[lang = stringify!($lang)]
429+
pub fn $lang() -> ! {
430+
panic($message);
431+
}
432+
)+
433+
}
434+
}
435+
}
436+
437+
panic_const! {
438+
panic_const_add_overflow = "attempt to add with overflow",
439+
panic_const_sub_overflow = "attempt to subtract with overflow",
440+
panic_const_mul_overflow = "attempt to multiply with overflow",
441+
panic_const_div_overflow = "attempt to divide with overflow",
442+
panic_const_rem_overflow = "attempt to calculate the remainder with overflow",
443+
panic_const_neg_overflow = "attempt to negate with overflow",
444+
panic_const_shr_overflow = "attempt to shift right with overflow",
445+
panic_const_shl_overflow = "attempt to shift left with overflow",
446+
panic_const_div_by_zero = "attempt to divide by zero",
447+
panic_const_rem_by_zero = "attempt to calculate the remainder with a divisor of zero",
448+
}
449+
421450
#[lang = "panic_cannot_unwind"]
422451
fn panic_cannot_unwind() -> ! {
423452
unsafe {
@@ -563,7 +592,7 @@ pub mod intrinsics {
563592
pub fn min_align_of_val<T: ?Sized>(val: *const T) -> usize;
564593
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
565594
pub fn transmute<T, U>(e: T) -> U;
566-
pub fn ctlz_nonzero<T>(x: T) -> T;
595+
pub fn ctlz_nonzero<T>(x: T) -> u32;
567596
#[rustc_safe_intrinsic]
568597
pub fn needs_drop<T: ?Sized>() -> bool;
569598
#[rustc_safe_intrinsic]

Diff for: example/mini_core_hello_world.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![feature(
44
no_core, unboxed_closures, start, lang_items, never_type, linkage,
5-
extern_types, thread_local
5+
extern_types, thread_local, raw_ref_op
66
)]
77
#![no_core]
88
#![allow(dead_code, internal_features, non_camel_case_types)]
@@ -99,9 +99,7 @@ fn start<T: Termination + 'static>(
9999

100100
static mut NUM: u8 = 6 * 7;
101101

102-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
103-
#[allow(static_mut_refs)]
104-
static NUM_REF: &'static u8 = unsafe { &NUM };
102+
static NUM_REF: &'static u8 = unsafe { &* &raw const NUM };
105103

106104
macro_rules! assert {
107105
($e:expr) => {

Diff for: example/std_example.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(internal_features)]
2-
#![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted)]
2+
#![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted, stmt_expr_attributes)]
33

44
#[cfg(feature="master")]
55
#[cfg(target_arch="x86_64")]
@@ -103,7 +103,7 @@ fn main() {
103103
test_simd();
104104
}
105105

106-
Box::pin(move |mut _task_context| {
106+
Box::pin(#[coroutine] move |mut _task_context| {
107107
yield ();
108108
}).as_mut().resume(0);
109109

Diff for: libgccjit.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d61ce945badf4c9d8237a13ca135e3c46ad13be3
1+
341be3b7d7ac6976cfed8ed59da3573c040d0776

Diff for: patches/0001-Add-stdarch-Cargo.toml-for-testing.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ index 0000000..4c63700
1919
+members = [
2020
+ "crates/core_arch",
2121
+ "crates/std_detect",
22-
+ "crates/stdarch-gen",
22+
+ "crates/stdarch-gen-arm",
2323
+ #"examples/"
2424
+]
2525
+exclude = [

Diff for: patches/0022-core-Disable-not-compiling-tests.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ index 42a26ae..5ac1042 100644
3939
+#![cfg(test)]
4040
#![feature(alloc_layout_extra)]
4141
#![feature(array_chunks)]
42-
#![feature(array_windows)]
42+
#![feature(array_ptr_get)]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From a5663265f797a43c502915c356fe7899c16cee92 Mon Sep 17 00:00:00 2001
1+
From 124a11ce086952a5794d5cfbaa45175809497b81 Mon Sep 17 00:00:00 2001
22
From: None <[email protected]>
33
Date: Sat, 18 Nov 2023 10:50:36 -0500
44
Subject: [PATCH] [core] Disable portable-simd test
@@ -8,18 +8,18 @@ Subject: [PATCH] [core] Disable portable-simd test
88
1 file changed, 2 deletions(-)
99

1010
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
11-
index d0a119c..76fdece 100644
11+
index b71786c..cf484d5 100644
1212
--- a/library/core/tests/lib.rs
1313
+++ b/library/core/tests/lib.rs
14-
@@ -89,7 +89,6 @@
14+
@@ -95,7 +95,6 @@
1515
#![feature(never_type)]
1616
#![feature(unwrap_infallible)]
17-
#![feature(pointer_is_aligned)]
17+
#![feature(pointer_is_aligned_to)]
1818
-#![feature(portable_simd)]
1919
#![feature(ptr_metadata)]
20-
#![feature(lazy_cell)]
2120
#![feature(unsized_tuple_coercion)]
22-
@@ -155,7 +154,6 @@ mod pin;
21+
#![feature(const_option)]
22+
@@ -157,7 +156,6 @@ mod pin;
2323
mod pin_macro;
2424
mod ptr;
2525
mod result;
@@ -28,5 +28,5 @@ index d0a119c..76fdece 100644
2828
mod str;
2929
mod str_lossy;
3030
--
31-
2.42.1
31+
2.45.2
3232

Diff for: rust-toolchain

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

Diff for: src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
539539
let builtin_unreachable = self.context.get_builtin_function("__builtin_unreachable");
540540
let builtin_unreachable: RValue<'gcc> =
541541
unsafe { std::mem::transmute(builtin_unreachable) };
542-
self.call(self.type_void(), None, None, builtin_unreachable, &[], None);
542+
self.call(self.type_void(), None, None, builtin_unreachable, &[], None, None);
543543
}
544544

545545
// Write results to outputs.

0 commit comments

Comments
 (0)