Skip to content

Commit 9a6b755

Browse files
committed
Fix merge conflicts
1 parent 081eb74 commit 9a6b755

File tree

5 files changed

+69
-26
lines changed

5 files changed

+69
-26
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ jobs:
5656
echo $(readlink -f gcc-build) > gcc_path
5757
# NOTE: the filename is still libgccjit.so even when the artifact name is different.
5858
ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0
59+
5960
- name: Set env
6061
run: |
6162
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
6263
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
6364
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
65+
6466
- name: Set RUST_COMPILER_RT_ROOT
6567
run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV
6668

@@ -108,11 +110,13 @@ jobs:
108110
./build.sh ${{ matrix.libgccjit_version.extra }}
109111
cargo test ${{ matrix.libgccjit_version.extra }}
110112
./clean_all.sh
113+
111114
- name: Prepare dependencies
112115
run: |
113116
git config --global user.email "user@example.com"
114117
git config --global user.name "User"
115118
./prepare.sh
119+
116120
# Compile is a separate step, as the actions-rs/cargo action supports error annotations
117121
- name: Compile
118122
uses: actions-rs/cargo@v1.0.3
@@ -127,6 +131,7 @@ jobs:
127131
- name: Run tests
128132
run: |
129133
./test.sh --release --clean --build-sysroot ${{ matrix.commands }} ${{ matrix.libgccjit_version.extra }}
134+
130135
duplicates:
131136
runs-on: ubuntu-latest
132137
steps:

example/mini_core.rs

Lines changed: 40 additions & 15 deletions
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-
untagged_unions, decl_macro, rustc_attrs, transparent_unions, auto_traits,
3+
decl_macro, rustc_attrs, transparent_unions, auto_traits,
44
thread_local
55
)]
66
#![no_core]
@@ -39,14 +39,14 @@ impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut
3939
impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
4040
// *mut T -> *mut U
4141
impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
42-
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}
42+
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U, ()>> for Box<T, ()> {}
4343

4444
#[lang = "receiver"]
4545
pub trait Receiver {}
4646

4747
impl<T: ?Sized> Receiver for &T {}
4848
impl<T: ?Sized> Receiver for &mut T {}
49-
impl<T: ?Sized> Receiver for Box<T> {}
49+
impl<T: ?Sized, A: Allocator> Receiver for Box<T, A> {}
5050

5151
#[lang = "copy"]
5252
pub unsafe trait Copy {}
@@ -411,7 +411,15 @@ pub trait FnMut<Args>: FnOnce<Args> {
411411

412412
#[lang = "panic"]
413413
#[track_caller]
414-
pub fn panic(_msg: &str) -> ! {
414+
pub fn panic(_msg: &'static str) -> ! {
415+
unsafe {
416+
libc::puts("Panicking\n\0" as *const str as *const u8);
417+
intrinsics::abort();
418+
}
419+
}
420+
421+
#[lang = "panic_no_unwind"]
422+
fn panic_no_unwind() -> ! {
415423
unsafe {
416424
libc::puts("Panicking\n\0" as *const str as *const u8);
417425
intrinsics::abort();
@@ -450,25 +458,40 @@ pub trait Deref {
450458
pub trait Allocator {
451459
}
452460

461+
impl Allocator for () {}
462+
453463
pub struct Global;
454464

455465
impl Allocator for Global {}
456466

467+
#[repr(transparent)]
468+
#[rustc_layout_scalar_valid_range_start(1)]
469+
#[rustc_nonnull_optimization_guaranteed]
470+
pub struct NonNull<T: ?Sized>(pub *const T);
471+
472+
impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
473+
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
474+
475+
pub struct Unique<T: ?Sized> {
476+
pub pointer: NonNull<T>,
477+
pub _marker: PhantomData<T>,
478+
}
479+
480+
impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsize<U> {}
481+
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
482+
457483
#[lang = "owned_box"]
458-
pub struct Box<
459-
T: ?Sized,
460-
A: Allocator = Global,
461-
>(*mut T, A);
484+
pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);
462485

463-
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
486+
impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
464487

465488
impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
466489
fn drop(&mut self) {
467490
// drop is currently performed by compiler.
468491
}
469492
}
470493

471-
impl<T> Deref for Box<T> {
494+
impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
472495
type Target = T;
473496

474497
fn deref(&self) -> &Self::Target {
@@ -482,8 +505,8 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
482505
}
483506

484507
#[lang = "box_free"]
485-
unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: *mut T, alloc: A) {
486-
libc::free(ptr as *mut u8);
508+
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
509+
libc::free(ptr.pointer.0 as *mut u8);
487510
}
488511

489512
#[lang = "drop"]
@@ -505,16 +528,18 @@ pub union MaybeUninit<T> {
505528
}
506529

507530
pub mod intrinsics {
531+
use crate::Sized;
532+
508533
extern "rust-intrinsic" {
509534
pub fn abort() -> !;
510535
pub fn size_of<T>() -> usize;
511-
pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
536+
pub fn size_of_val<T: ?Sized>(val: *const T) -> usize;
512537
pub fn min_align_of<T>() -> usize;
513-
pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
538+
pub fn min_align_of_val<T: ?Sized>(val: *const T) -> usize;
514539
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
515540
pub fn transmute<T, U>(e: T) -> U;
516541
pub fn ctlz_nonzero<T>(x: T) -> T;
517-
pub fn needs_drop<T: ?::Sized>() -> bool;
542+
pub fn needs_drop<T: ?Sized>() -> bool;
518543
pub fn bitreverse<T>(x: T) -> T;
519544
pub fn bswap<T>(x: T) -> T;
520545
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
From b1ae000f6da1abd3b8e9b80c40bc11c89b8ae93c Mon Sep 17 00:00:00 2001
2-
From: bjorn3 <bjorn3@users.noreply.github.com>
3-
Date: Thu, 30 Dec 2021 16:54:40 +0100
4-
Subject: [PATCH] [core] Disable portable-simd test
1+
From f845df4056f5ba16b9f5bd703460c4ac40ea03b9 Mon Sep 17 00:00:00 2001
2+
From: Antoni Boucher <bouanto@zoho.com>
3+
Date: Fri, 26 Aug 2022 20:38:58 -0400
4+
Subject: [PATCH] Edit
55

66
---
7-
library/core/tests/lib.rs | 1 -
8-
1 file changed, 1 deletion(-)
7+
library/core/tests/lib.rs | 2 --
8+
1 file changed, 2 deletions(-)
99

1010
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
11-
index 06c7be0..359e2e7 100644
11+
index 59510d3..179bf26 100644
1212
--- a/library/core/tests/lib.rs
1313
+++ b/library/core/tests/lib.rs
14-
@@ -75,7 +75,6 @@
15-
#![feature(never_type)]
14+
@@ -77,7 +77,6 @@
1615
#![feature(unwrap_infallible)]
16+
#![feature(result_into_ok_or_err)]
17+
#![feature(pointer_byte_offsets)]
1718
-#![feature(portable_simd)]
1819
#![feature(ptr_metadata)]
1920
#![feature(once_cell)]
2021
#![feature(option_result_contains)]
21-
@@ -127,7 +126,6 @@ mod pin;
22+
@@ -135,7 +134,6 @@ mod pin;
2223
mod pin_macro;
2324
mod ptr;
2425
mod result;
2526
-mod simd;
2627
mod slice;
2728
mod str;
2829
mod str_lossy;
30+
--
31+
2.26.2.7.g19db9cfb68.dirty
32+

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-2022-06-06"
2+
channel = "nightly-2022-08-26"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/builder.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,15 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11851185
fn atomic_cmpxchg(&mut self, dst: RValue<'gcc>, cmp: RValue<'gcc>, src: RValue<'gcc>, order: AtomicOrdering, failure_order: AtomicOrdering, weak: bool) -> RValue<'gcc> {
11861186
let expected = self.current_func().new_local(None, cmp.get_type(), "expected");
11871187
self.llbb().add_assignment(None, expected, cmp);
1188+
// NOTE: gcc doesn't support a failure memory model that is stronger than the success
1189+
// memory model.
1190+
let order =
1191+
if failure_order as i32 > order as i32 {
1192+
failure_order
1193+
}
1194+
else {
1195+
order
1196+
};
11881197
let success = self.compare_exchange(dst, expected, src, order, failure_order, weak);
11891198

11901199
let pair_type = self.cx.type_struct(&[src.get_type(), self.bool_type], false);

0 commit comments

Comments
 (0)