Fix tests

This commit is contained in:
Antoni Boucher 2024-06-18 12:58:01 -04:00
parent e8e6663167
commit 9ca7658817
15 changed files with 133 additions and 35 deletions

View File

@ -1,4 +1,4 @@
From a5663265f797a43c502915c356fe7899c16cee92 Mon Sep 17 00:00:00 2001
From 124a11ce086952a5794d5cfbaa45175809497b81 Mon Sep 17 00:00:00 2001
From: None <none@example.com>
Date: Sat, 18 Nov 2023 10:50:36 -0500
Subject: [PATCH] [core] Disable portable-simd test
@ -8,18 +8,18 @@ Subject: [PATCH] [core] Disable portable-simd test
1 file changed, 2 deletions(-)
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index d0a119c..76fdece 100644
index b71786c..cf484d5 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -89,7 +89,6 @@
@@ -95,7 +95,6 @@
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(pointer_is_aligned_to)]
-#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(lazy_cell)]
#![feature(unsized_tuple_coercion)]
@@ -155,7 +154,6 @@ mod pin;
#![feature(const_option)]
@@ -157,7 +156,6 @@ mod pin;
mod pin_macro;
mod ptr;
mod result;
@ -27,6 +27,6 @@ index d0a119c..76fdece 100644
mod slice;
mod str;
mod str_lossy;
--
2.42.1
--
2.45.2

View File

@ -538,9 +538,8 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
}
if dest.is_none() && options.contains(InlineAsmOptions::NORETURN) {
let builtin_unreachable = self.context.get_builtin_function("__builtin_unreachable");
let builtin_unreachable: RValue<'gcc> = unsafe {
std::mem::transmute(builtin_unreachable)
};
let builtin_unreachable: RValue<'gcc> =
unsafe { std::mem::transmute(builtin_unreachable) };
self.call(self.type_void(), None, None, builtin_unreachable, &[], None, None);
}

View File

@ -1004,7 +1004,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
}
}
let val = if let Some(_) = place.val.llextra {
let val = if place.val.llextra.is_some() {
// FIXME: Merge with the `else` below?
OperandValue::Ref(place.val)
} else if place.layout.is_gcc_immediate() {
@ -1672,7 +1672,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
_instance: Option<Instance<'tcx>>,
) -> RValue<'gcc> {
// FIXME(antoyo): remove when having a proper API.
let gcc_func = unsafe { std::mem::transmute(func) };
let gcc_func = unsafe { std::mem::transmute::<RValue<'gcc>, Function<'gcc>>(func) };
let call = if self.functions.borrow().values().any(|value| *value == gcc_func) {
self.function_call(func, args, funclet)
} else {

View File

@ -495,7 +495,7 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
"rust_eh_personality"
};
let func = self.declare_func(name, self.type_i32(), &[], true);
unsafe { std::mem::transmute(func) }
unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) }
}
};
// TODO(antoyo): apply target cpu attributes.

View File

@ -85,14 +85,16 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
} else {
let a_size = a_type.get_size();
let b_size = b_type.get_size();
if a_size > b_size {
let b = self.context.new_cast(self.location, b, a_type);
a >> b
} else if a_size < b_size {
let a = self.context.new_cast(self.location, a, b_type);
a >> b
} else {
a >> b
match a_size.cmp(&b_size) {
std::cmp::Ordering::Less => {
let a = self.context.new_cast(self.location, a, b_type);
a >> b
}
std::cmp::Ordering::Equal => a >> b,
std::cmp::Ordering::Greater => {
let b = self.context.new_cast(self.location, b, a_type);
a >> b
}
}
}
} else if a_type.is_vector() && a_type.is_vector() {
@ -647,14 +649,16 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
} else {
let a_size = a_type.get_size();
let b_size = b_type.get_size();
if a_size > b_size {
let b = self.context.new_cast(self.location, b, a_type);
a << b
} else if a_size < b_size {
let a = self.context.new_cast(self.location, a, b_type);
a << b
} else {
a << b
match a_size.cmp(&b_size) {
std::cmp::Ordering::Less => {
let a = self.context.new_cast(self.location, a, b_type);
a << b
}
std::cmp::Ordering::Equal => a << b,
std::cmp::Ordering::Greater => {
let b = self.context.new_cast(self.location, b, a_type);
a << b
}
}
}
} else if a_type.is_vector() && a_type.is_vector() {

View File

@ -125,7 +125,9 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
let llval = match name {
_ if simple.is_some() => {
// FIXME(antoyo): remove this cast when the API supports function.
let func = unsafe { std::mem::transmute(simple.expect("simple")) };
let func = unsafe {
std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(simple.expect("simple"))
};
self.call(
self.type_void(),
None,
@ -670,7 +672,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let step3 = self.or(left, right);
// Fourth step.
if width == 8 { step3 } else { self.gcc_bswap(step3, width) }
if width == 8 {
step3
} else {
self.gcc_bswap(step3, width)
}
}
128 => {
// TODO(antoyo): find a more efficient implementation?
@ -1189,7 +1195,7 @@ fn codegen_gnu_try<'gcc>(
bx.invoke(try_func_ty, None, None, try_func, &[data], then, catch, None, None);
});
let func = unsafe { std::mem::transmute(func) };
let func = unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) };
// Note that no invoke is used here because by definition this function
// can't panic (that's what it's catching).
@ -1263,7 +1269,7 @@ fn gen_fn<'a, 'gcc, 'tcx>(
// FIXME(eddyb) find a nicer way to do this.
cx.linkage.set(FunctionType::Internal);
let func = cx.declare_fn(name, fn_abi);
let func_val = unsafe { std::mem::transmute(func) };
let func_val = unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) };
cx.set_frame_pointer_type(func_val);
cx.apply_target_cpu_attr(func_val);
let block = Builder::append_block(cx, func_val, "entry-block");

View File

@ -13,6 +13,7 @@ use rustc_codegen_ssa::errors::InvalidMonomorphization;
use rustc_codegen_ssa::mir::operand::OperandRef;
use rustc_codegen_ssa::mir::place::PlaceRef;
use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods};
#[cfg(feature = "master")]
use rustc_hir as hir;
use rustc_middle::mir::BinOp;
use rustc_middle::span_bug;

View File

@ -81,6 +81,6 @@ impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
// TODO(antoyo): use inline attribute from there in linkage.set() above.
self.functions.borrow_mut().insert(symbol_name.to_string(), decl);
self.function_instances.borrow_mut().insert(instance, unsafe { std::mem::transmute(decl) });
self.function_instances.borrow_mut().insert(instance, decl);
}
}

View File

@ -0,0 +1,42 @@
tests/run-make/a-b-a-linker-guard/
tests/run-make/CURRENT_RUSTC_VERSION/
tests/run-make/cross-lang-lto/
tests/run-make/cross-lang-lto-upstream-rlibs/
tests/run-make/doctests-keep-binaries/
tests/run-make/doctests-runtool/
tests/run-make/emit-shared-files/
tests/run-make/exit-code/
tests/run-make/issue-22131/
tests/run-make/issue-64153/
tests/run-make/llvm-ident/
tests/run-make/native-link-modifier-bundle/
tests/run-make/remap-path-prefix-dwarf/
tests/run-make/repr128-dwarf/
tests/run-make/rlib-format-packed-bundled-libs/
tests/run-make/rlib-format-packed-bundled-libs-2/
tests/run-make/rustdoc-determinism/
tests/run-make/rustdoc-error-lines/
tests/run-make/rustdoc-map-file/
tests/run-make/rustdoc-output-path/
tests/run-make/rustdoc-scrape-examples-invalid-expr/
tests/run-make/rustdoc-scrape-examples-multiple/
tests/run-make/rustdoc-scrape-examples-ordering/
tests/run-make/rustdoc-scrape-examples-remap/
tests/run-make/rustdoc-scrape-examples-test/
tests/run-make/rustdoc-scrape-examples-whitespace/
tests/run-make/rustdoc-scrape-examples-macros/
tests/run-make/rustdoc-with-out-dir-option/
tests/run-make/rustdoc-verify-output-files/
tests/run-make/rustdoc-themes/
tests/run-make/rustdoc-with-short-out-dir-option/
tests/run-make/rustdoc-with-output-option/
tests/run-make/arguments-non-c-like-enum/
tests/run-make/c-link-to-rust-staticlib/
tests/run-make/foreign-double-unwind/
tests/run-make/foreign-exceptions/
tests/run-make/glibc-staticlib-args/
tests/run-make/issue-36710/
tests/run-make/issue-68794-textrel-on-minimal-lib/
tests/run-make/lto-smoke-c/
tests/run-make/return-non-c-like-enum/

View File

@ -14,7 +14,6 @@ tests/ui/sepcomp/sepcomp-fns-backwards.rs
tests/ui/sepcomp/sepcomp-fns.rs
tests/ui/sepcomp/sepcomp-statics.rs
tests/ui/asm/x86_64/may_unwind.rs
tests/ui/backtrace.rs
tests/ui/catch-unwind-bang.rs
tests/ui/cfg/cfg-panic-abort.rs
tests/ui/drop/dynamic-drop-async.rs

View File

@ -205,6 +205,17 @@ impl Sub for i16 {
}
}
#[track_caller]
#[lang = "panic_const_add_overflow"]
pub fn panic_const_add_overflow() -> ! {
panic("attempt to add with overflow");
}
#[track_caller]
#[lang = "panic_const_sub_overflow"]
pub fn panic_const_sub_overflow() -> ! {
panic("attempt to subtract with overflow");
}
/*
* Code

View File

@ -120,6 +120,12 @@ impl Add for isize {
}
}
#[track_caller]
#[lang = "panic_const_add_overflow"]
pub fn panic_const_add_overflow() -> ! {
panic("attempt to add with overflow");
}
/*
* Code
*/

View File

@ -189,6 +189,12 @@ pub fn panic(_msg: &'static str) -> ! {
}
}
#[track_caller]
#[lang = "panic_const_add_overflow"]
pub fn panic_const_add_overflow() -> ! {
panic("attempt to add with overflow");
}
/*
* Code
*/

View File

@ -122,6 +122,12 @@ impl Add for isize {
}
}
#[track_caller]
#[lang = "panic_const_add_overflow"]
pub fn panic_const_add_overflow() -> ! {
panic("attempt to add with overflow");
}
/*
* Code
*/

View File

@ -207,6 +207,24 @@ impl Mul for isize {
}
}
#[track_caller]
#[lang = "panic_const_add_overflow"]
pub fn panic_const_add_overflow() -> ! {
panic("attempt to add with overflow");
}
#[track_caller]
#[lang = "panic_const_sub_overflow"]
pub fn panic_const_sub_overflow() -> ! {
panic("attempt to subtract with overflow");
}
#[track_caller]
#[lang = "panic_const_mul_overflow"]
pub fn panic_const_mul_overflow() -> ! {
panic("attempt to multiply with overflow");
}
/*
* Code
*/