Skip to content

Commit 1bbee3e

Browse files
authored
Merge pull request #282 from rust-lang/sync_from_rust_2023_06_11
Sync from rust 2023 06 11
2 parents ffb092d + 37413a2 commit 1bbee3e

31 files changed

+363
-261
lines changed

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ master = ["gccjit/master"]
2525
gccjit = { git = "https://github.com/antoyo/gccjit.rs" }
2626

2727
# Local copy.
28-
# gccjit = { path = "../gccjit.rs" }
28+
#gccjit = { path = "../gccjit.rs" }
2929

3030
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
3131

Diff for: Readme.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Using git-subtree with `rustc` requires a patched git to make it work.
193193
The PR that is needed is [here](https://github.com/gitgitgadget/git/pull/493).
194194
Use the following instructions to install it:
195195
196-
```
196+
```bash
197197
git clone [email protected]:tqc/git.git
198198
cd git
199199
git checkout tqc/subtree
@@ -204,6 +204,21 @@ make
204204
cp git-subtree ~/bin
205205
```
206206

207+
Then, do a sync with this command:
208+
209+
```bash
210+
PATH="$HOME/bin:$PATH" ~/bin/git-subtree push -P compiler/rustc_codegen_gcc/ ../rustc_codegen_gcc/ sync_branch_name
211+
cd ../rustc_codegen_gcc
212+
git checkout master
213+
git pull
214+
git checkout sync_branch_name
215+
git merge master
216+
```
217+
218+
TODO: write a script that does the above.
219+
220+
https://rust-lang.zulipchat.com/#narrow/stream/301329-t-devtools/topic/subtree.20madness/near/258877725
221+
207222
### How to use [mem-trace](https://github.com/antoyo/mem-trace)
208223

209224
`rustc` needs to be built without `jemalloc` so that `mem-trace` can overload `malloc` since `jemalloc` is linked statically, so a `LD_PRELOAD`-ed library won't a chance to intercept the calls to `malloc`.

Diff for: build_sysroot/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ compiler_builtins = "0.1"
99
alloc = { path = "./sysroot_src/library/alloc" }
1010
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1111
test = { path = "./sysroot_src/library/test" }
12+
proc_macro = { path = "./sysroot_src/library/proc_macro" }
1213

1314
[patch.crates-io]
1415
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }

Diff for: build_sysroot/prepare_sysroot_src.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ git config user.name || git config user.name "None"
2929

3030
git commit -m "Initial commit" -q
3131
for file in $(ls ../../patches/ | grep -v patcha); do
32-
echo "[GIT] apply" $file
33-
git apply ../../patches/$file
34-
git add -A
35-
git commit --no-gpg-sign -m "Patch $file"
32+
echo "[GIT] apply" $file
33+
git apply ../../patches/$file
34+
git add -A
35+
git commit --no-gpg-sign -m "Patch $file"
3636
done
3737
popd
3838

Diff for: example/alloc_example.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(start, box_syntax, core_intrinsics, alloc_error_handler, lang_items)]
1+
#![feature(start, core_intrinsics, alloc_error_handler, lang_items)]
22
#![no_std]
33

44
extern crate alloc;
@@ -38,7 +38,7 @@ unsafe extern "C" fn _Unwind_Resume() {
3838

3939
#[start]
4040
fn main(_argc: isize, _argv: *const *const u8) -> isize {
41-
let world: Box<&str> = box "Hello World!\0";
41+
let world: Box<&str> = Box::new("Hello World!\0");
4242
unsafe {
4343
puts(*world as *const str as *const u8);
4444
}

Diff for: example/alloc_system.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution and at
3-
// http://rust-lang.org/COPYRIGHT.
4-
//
5-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
// option. This file may not be copied, modified, or distributed
9-
// except according to those terms.
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
// SPDX-FileCopyrightText: The Rust Project Developers (see https://thanks.rust-lang.org)
3+
104
#![no_std]
115
#![feature(allocator_api, rustc_private)]
126
#![cfg_attr(any(unix, target_os = "redox"), feature(libc))]
@@ -21,6 +15,7 @@
2115
const MIN_ALIGN: usize = 8;
2216
#[cfg(any(target_arch = "x86_64",
2317
target_arch = "aarch64",
18+
target_arch = "loongarch64",
2419
target_arch = "mips64",
2520
target_arch = "s390x",
2621
target_arch = "sparc64"))]

Diff for: example/mini_core.rs

+18-6
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
451451
drop_in_place(to_drop);
452452
}
453453

454+
#[lang = "unpin"]
455+
pub auto trait Unpin {}
456+
454457
#[lang = "deref"]
455458
pub trait Deref {
456459
type Target: ?Sized;
@@ -488,9 +491,23 @@ pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);
488491

489492
impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
490493

494+
impl<T> Box<T> {
495+
pub fn new(val: T) -> Box<T> {
496+
unsafe {
497+
let size = intrinsics::size_of::<T>();
498+
let ptr = libc::malloc(size);
499+
intrinsics::copy(&val as *const T as *const u8, ptr, size);
500+
Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global)
501+
}
502+
}
503+
}
504+
491505
impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
492506
fn drop(&mut self) {
493-
// drop is currently performed by compiler.
507+
// inner value is dropped by compiler.
508+
unsafe {
509+
libc::free(self.0.pointer.0 as *mut u8);
510+
}
494511
}
495512
}
496513

@@ -507,11 +524,6 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
507524
libc::malloc(size)
508525
}
509526

510-
#[lang = "box_free"]
511-
unsafe fn box_free<T: ?Sized>(ptr: Unique<T>, _alloc: ()) {
512-
libc::free(ptr.pointer.0 as *mut u8);
513-
}
514-
515527
#[lang = "drop"]
516528
pub trait Drop {
517529
fn drop(&mut self);

Diff for: example/mini_core_hello_world.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Adapted from https://github.com/sunfishcode/mir2cranelift/blob/master/rust-examples/nocore-hello-world.rs
22

33
#![feature(
4-
no_core, unboxed_closures, start, lang_items, box_syntax, never_type, linkage,
4+
no_core, unboxed_closures, start, lang_items, never_type, linkage,
55
extern_types, thread_local
66
)]
77
#![no_core]
@@ -163,7 +163,7 @@ fn main() {
163163
let ptr: *const u8 = hello as *const [u8] as *const u8;
164164
puts(ptr);
165165

166-
let world: Box<&str> = box "World!\0";
166+
let world: Box<&str> = Box::new("World!\0");
167167
puts(*world as *const str as *const u8);
168168
world as Box<dyn SomeTrait>;
169169

@@ -226,10 +226,10 @@ fn main() {
226226
}
227227
}
228228

229-
let _ = box NoisyDrop {
229+
let _ = Box::new(NoisyDrop {
230230
text: "Boxed outer got dropped!\0",
231231
inner: NoisyDropInner,
232-
} as Box<dyn SomeTrait>;
232+
}) as Box<dyn SomeTrait>;
233233

234234
const FUNC_REF: Option<fn()> = Some(main);
235235
#[allow(unreachable_code)]

Diff for: example/mod_bench.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(start, box_syntax, core_intrinsics, lang_items)]
1+
#![feature(start, core_intrinsics, lang_items)]
22
#![no_std]
33

44
#[link(name = "c")]

Diff for: failing-ui-tests.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ tests/ui/issues/issue-40883.rs
5454
tests/ui/issues/issue-43853.rs
5555
tests/ui/issues/issue-47364.rs
5656
tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs
57-
tests/ui/rfc-2091-track-caller/std-panic-locations.rs
58-
tests/ui/rfcs/rfc1857-drop-order.rs
57+
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
58+
tests/ui/rfcs/rfc-1857-stabilize-drop-order/drop-order.rs
5959
tests/ui/simd/issue-17170.rs
6060
tests/ui/simd/issue-39720.rs
6161
tests/ui/simd/issue-89193.rs
@@ -66,3 +66,5 @@ tests/ui/generator/panic-safe.rs
6666
tests/ui/issues/issue-14875.rs
6767
tests/ui/issues/issue-29948.rs
6868
tests/ui/panic-while-printing.rs
69+
tests/ui/enum-discriminant/get_discr.rs
70+
tests/ui/panics/nested_panic_caught.rs

Diff for: messages.ftl

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
codegen_gcc_invalid_minimum_alignment =
2+
invalid minimum global alignment: {$err}
3+
4+
codegen_gcc_invalid_monomorphization_basic_integer =
5+
invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`
6+
7+
codegen_gcc_invalid_monomorphization_expected_signed_unsigned =
8+
invalid monomorphization of `{$name}` intrinsic: expected element type `{$elem_ty}` of vector type `{$vec_ty}` to be a signed or unsigned integer type
9+
10+
codegen_gcc_invalid_monomorphization_expected_simd =
11+
invalid monomorphization of `{$name}` intrinsic: expected SIMD {$expected_ty} type, found non-SIMD `{$found_ty}`
12+
13+
codegen_gcc_invalid_monomorphization_inserted_type =
14+
invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`
15+
16+
codegen_gcc_invalid_monomorphization_invalid_bitmask =
17+
invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`
18+
19+
codegen_gcc_invalid_monomorphization_invalid_float_vector =
20+
invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$elem_ty}` of floating-point vector `{$vec_ty}`
21+
22+
codegen_gcc_invalid_monomorphization_mask_type =
23+
invalid monomorphization of `{$name}` intrinsic: mask element type is `{$ty}`, expected `i_`
24+
25+
codegen_gcc_invalid_monomorphization_mismatched_lengths =
26+
invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`
27+
28+
codegen_gcc_invalid_monomorphization_not_float =
29+
invalid monomorphization of `{$name}` intrinsic: `{$ty}` is not a floating-point type
30+
31+
codegen_gcc_invalid_monomorphization_return_element =
32+
invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`
33+
34+
codegen_gcc_invalid_monomorphization_return_integer_type =
35+
invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`
36+
37+
codegen_gcc_invalid_monomorphization_return_length =
38+
invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}
39+
40+
codegen_gcc_invalid_monomorphization_return_length_input_type =
41+
invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}
42+
43+
codegen_gcc_invalid_monomorphization_return_type =
44+
invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`
45+
46+
codegen_gcc_invalid_monomorphization_simd_shuffle =
47+
invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be an array of `u32`, got `{$ty}`
48+
49+
codegen_gcc_invalid_monomorphization_unrecognized =
50+
invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`
51+
52+
codegen_gcc_invalid_monomorphization_unsupported_cast =
53+
invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`
54+
55+
codegen_gcc_invalid_monomorphization_unsupported_element =
56+
invalid monomorphization of `{$name}` intrinsic: unsupported {$name} from `{$in_ty}` with element `{$elem_ty}` to `{$ret_ty}`
57+
58+
codegen_gcc_invalid_monomorphization_unsupported_operation =
59+
invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`
60+
61+
codegen_gcc_lto_not_supported =
62+
LTO is not supported. You may get a linker error.
63+
64+
codegen_gcc_tied_target_features = the target features {$features} must all be either enabled or disabled together
65+
.help = add the missing features in a `target_feature` attribute
66+
67+
codegen_gcc_unwinding_inline_asm =
68+
GCC backend does not support unwinding from inline asm

Diff for: patches/0023-core-Ignore-failing-tests.patch

-49
This file was deleted.

Diff for: rust-toolchain

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

0 commit comments

Comments
 (0)