Skip to content

Commit 2f11b37

Browse files
authored
Merge pull request #313 from rust-lang/sync_from_rust_2023_08_12
Sync from rust 2023/08/12
2 parents 52716d2 + 53d89e8 commit 2f11b37

Some content is hidden

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

49 files changed

+499
-683
lines changed

.github/workflows/stdarch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ jobs:
133133
if: ${{ !matrix.cargo_runner }}
134134
run: |
135135
cd build_sysroot/sysroot_src/library/stdarch/
136-
CHANNEL=release TARGET=x86_64-unknown-linux-gnu ../../../../cargo.sh test
136+
CHANNEL=release TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ../../../../cargo.sh test
137137
138138
- name: Run stdarch tests
139139
if: ${{ matrix.cargo_runner }}
140140
run: |
141141
cd build_sysroot/sysroot_src/library/stdarch/
142-
STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu ../../../../cargo.sh test -- --skip rtm --skip tbm --skip sse4a
142+
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" ../../../../cargo.sh test -- --skip rtm --skip tbm --skip sse4a

Cargo.lock

Lines changed: 17 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ gccjit = { git = "https://github.com/antoyo/gccjit.rs" }
2828
#gccjit = { path = "../gccjit.rs" }
2929

3030
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
31+
# TODO(antoyo): make tempfile optional.
32+
tempfile = "3.7.1"
3133

3234
[dev-dependencies]
3335
lang_tester = "0.3.9"

build_sysroot/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["bjorn3 <[email protected]>"]
33
name = "sysroot"
44
version = "0.0.0"
5+
resolver = "2"
56

67
[dependencies]
78
core = { path = "./sysroot_src/library/core" }

example/alloc_example.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(start, core_intrinsics, alloc_error_handler, lang_items)]
22
#![no_std]
3+
#![allow(internal_features)]
34

45
extern crate alloc;
56
extern crate alloc_system;

example/alloc_system.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#[cfg(any(target_arch = "x86",
1111
target_arch = "arm",
1212
target_arch = "mips",
13+
target_arch = "mips32r6",
1314
target_arch = "powerpc",
1415
target_arch = "powerpc64"))]
1516
const MIN_ALIGN: usize = 8;
1617
#[cfg(any(target_arch = "x86_64",
1718
target_arch = "aarch64",
1819
target_arch = "loongarch64",
1920
target_arch = "mips64",
21+
target_arch = "mips64r6",
2022
target_arch = "s390x",
2123
target_arch = "sparc64"))]
2224
const MIN_ALIGN: usize = 16;

example/arbitrary_self_types_pointers_and_wrappers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)]
44
#![feature(rustc_attrs)]
5+
#![allow(internal_features)]
56

67
use std::{
78
ops::{Deref, CoerceUnsized, DispatchFromDyn},

example/mini_core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
thread_local
55
)]
66
#![no_core]
7-
#![allow(dead_code)]
7+
#![allow(dead_code, internal_features)]
88

99
#[no_mangle]
1010
unsafe extern "C" fn _Unwind_Resume() {

example/mini_core_hello_world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern_types, thread_local
66
)]
77
#![no_core]
8-
#![allow(dead_code, non_camel_case_types)]
8+
#![allow(dead_code, internal_features, non_camel_case_types)]
99

1010
extern crate mini_core;
1111

example/mod_bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(start, core_intrinsics, lang_items)]
22
#![no_std]
3+
#![allow(internal_features)]
34

45
#[link(name = "c")]
56
extern {}

failing-ui-tests.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ tests/ui/issues/issue-29948.rs
6767
tests/ui/panic-while-printing.rs
6868
tests/ui/enum-discriminant/get_discr.rs
6969
tests/ui/panics/nested_panic_caught.rs
70+
tests/ui/simd/intrinsic/generic-bswap-byte.rs
71+
tests/ui/const_prop/ice-issue-111353.rs
72+
tests/ui/process/println-with-broken-pipe.rs

messages.ftl

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,6 @@
11
codegen_gcc_invalid_minimum_alignment =
22
invalid minimum global alignment: {$err}
33
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-
614
codegen_gcc_lto_not_supported =
625
LTO is not supported. You may get a linker error.
636

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

src/allocator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut GccContext, _module_nam
2626
if kind == AllocatorKind::Default {
2727
for method in ALLOCATOR_METHODS {
2828
let mut types = Vec::with_capacity(method.inputs.len());
29-
for ty in method.inputs.iter() {
30-
match *ty {
29+
for input in method.inputs.iter() {
30+
match input.ty {
3131
AllocatorTy::Layout => {
3232
types.push(usize);
3333
types.push(usize);

src/base.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use std::time::Instant;
66
use gccjit::{
77
Context,
88
FunctionType,
9-
GlobalKind, TargetInfo,
9+
GlobalKind,
1010
};
11+
#[cfg(feature="master")]
12+
use gccjit::TargetInfo;
1113
use rustc_middle::dep_graph;
1214
use rustc_middle::ty::TyCtxt;
1315
#[cfg(feature="master")]
@@ -20,6 +22,8 @@ use rustc_codegen_ssa::traits::DebugInfoMethods;
2022
use rustc_session::config::DebugInfo;
2123
use rustc_span::Symbol;
2224

25+
#[cfg(not(feature="master"))]
26+
use crate::TargetInfo;
2327
use crate::GccContext;
2428
use crate::builder::Builder;
2529
use crate::context::CodegenCx;
@@ -144,6 +148,9 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Arc<
144148
if env::var("CG_GCCJIT_DUMP_RTL").as_deref() == Ok("1") {
145149
context.add_command_line_option("-fdump-rtl-vregs");
146150
}
151+
if env::var("CG_GCCJIT_DUMP_RTL_ALL").as_deref() == Ok("1") {
152+
context.add_command_line_option("-fdump-rtl-all");
153+
}
147154
if env::var("CG_GCCJIT_DUMP_TREE_ALL").as_deref() == Ok("1") {
148155
context.add_command_line_option("-fdump-tree-all");
149156
}
@@ -168,8 +175,8 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Arc<
168175
let cx = CodegenCx::new(&context, cgu, tcx, target_info.supports_128bit_int());
169176

170177
let mono_items = cgu.items_in_deterministic_order(tcx);
171-
for &(mono_item, (linkage, visibility)) in &mono_items {
172-
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, linkage, visibility);
178+
for &(mono_item, data) in &mono_items {
179+
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, data.linkage, data.visibility);
173180
}
174181

175182
// ... and now that we have everything pre-defined, fill out those definitions.

src/builder.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use rustc_codegen_ssa::traits::{
2727
BaseTypeMethods,
2828
BuilderMethods,
2929
ConstMethods,
30-
DerivedTypeMethods,
3130
LayoutTypeMethods,
3231
HasCodegen,
3332
OverflowOp,
@@ -248,16 +247,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
248247
}
249248

250249
fn check_store(&mut self, val: RValue<'gcc>, ptr: RValue<'gcc>) -> RValue<'gcc> {
251-
let dest_ptr_ty = self.cx.val_ty(ptr).make_pointer(); // TODO(antoyo): make sure make_pointer() is okay here.
252250
let stored_ty = self.cx.val_ty(val);
253251
let stored_ptr_ty = self.cx.type_ptr_to(stored_ty);
254-
255-
if dest_ptr_ty == stored_ptr_ty {
256-
ptr
257-
}
258-
else {
259-
self.bitcast(ptr, stored_ptr_ty)
260-
}
252+
self.bitcast(ptr, stored_ptr_ty)
261253
}
262254

263255
pub fn current_func(&self) -> Function<'gcc> {
@@ -501,7 +493,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
501493
}
502494

503495
#[cfg(not(feature="master"))]
504-
fn invoke(&mut self, typ: Type<'gcc>, fn_attrs: &CodegenFnAttrs, fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, func: RValue<'gcc>, args: &[RValue<'gcc>], then: Block<'gcc>, catch: Block<'gcc>, _funclet: Option<&Funclet>) -> RValue<'gcc> {
496+
fn invoke(&mut self, typ: Type<'gcc>, fn_attrs: Option<&CodegenFnAttrs>, fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, func: RValue<'gcc>, args: &[RValue<'gcc>], then: Block<'gcc>, catch: Block<'gcc>, _funclet: Option<&Funclet>) -> RValue<'gcc> {
505497
let call_site = self.call(typ, fn_attrs, None, func, args, None);
506498
let condition = self.context.new_rvalue_from_int(self.bool_type, 1);
507499
self.llbb().end_with_conditional(None, condition, then, catch);
@@ -917,7 +909,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
917909
.add_eval(None, self.context.new_call(None, atomic_store, &[ptr, value, ordering]));
918910
}
919911

920-
fn gep(&mut self, _typ: Type<'gcc>, ptr: RValue<'gcc>, indices: &[RValue<'gcc>]) -> RValue<'gcc> {
912+
fn gep(&mut self, typ: Type<'gcc>, ptr: RValue<'gcc>, indices: &[RValue<'gcc>]) -> RValue<'gcc> {
913+
// NOTE: due to opaque pointers now being used, we need to cast here.
914+
let ptr = self.context.new_cast(None, ptr, typ.make_pointer());
921915
let ptr_type = ptr.get_type();
922916
let mut pointee_type = ptr.get_type();
923917
// NOTE: we cannot use array indexing here like in inbounds_gep because array indexing is

0 commit comments

Comments
 (0)