Skip to content

Commit 9ca7658

Browse files
committed
Fix tests
1 parent e8e6663 commit 9ca7658

File tree

15 files changed

+133
-35
lines changed

15 files changed

+133
-35
lines changed
Lines changed: 7 additions & 7 deletions
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,25 +8,25 @@ 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)]
1717
#![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;
2626
-mod simd;
2727
mod slice;
2828
mod str;
2929
mod str_lossy;
30-
--
31-
2.42.1
30+
--
31+
2.45.2
3232

src/asm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,8 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
538538
}
539539
if dest.is_none() && options.contains(InlineAsmOptions::NORETURN) {
540540
let builtin_unreachable = self.context.get_builtin_function("__builtin_unreachable");
541-
let builtin_unreachable: RValue<'gcc> = unsafe {
542-
std::mem::transmute(builtin_unreachable)
543-
};
541+
let builtin_unreachable: RValue<'gcc> =
542+
unsafe { std::mem::transmute(builtin_unreachable) };
544543
self.call(self.type_void(), None, None, builtin_unreachable, &[], None, None);
545544
}
546545

src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10041004
}
10051005
}
10061006

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

src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
495495
"rust_eh_personality"
496496
};
497497
let func = self.declare_func(name, self.type_i32(), &[], true);
498-
unsafe { std::mem::transmute(func) }
498+
unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) }
499499
}
500500
};
501501
// TODO(antoyo): apply target cpu attributes.

src/int.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
8585
} else {
8686
let a_size = a_type.get_size();
8787
let b_size = b_type.get_size();
88-
if a_size > b_size {
89-
let b = self.context.new_cast(self.location, b, a_type);
90-
a >> b
91-
} else if a_size < b_size {
92-
let a = self.context.new_cast(self.location, a, b_type);
93-
a >> b
94-
} else {
95-
a >> b
88+
match a_size.cmp(&b_size) {
89+
std::cmp::Ordering::Less => {
90+
let a = self.context.new_cast(self.location, a, b_type);
91+
a >> b
92+
}
93+
std::cmp::Ordering::Equal => a >> b,
94+
std::cmp::Ordering::Greater => {
95+
let b = self.context.new_cast(self.location, b, a_type);
96+
a >> b
97+
}
9698
}
9799
}
98100
} else if a_type.is_vector() && a_type.is_vector() {
@@ -647,14 +649,16 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
647649
} else {
648650
let a_size = a_type.get_size();
649651
let b_size = b_type.get_size();
650-
if a_size > b_size {
651-
let b = self.context.new_cast(self.location, b, a_type);
652-
a << b
653-
} else if a_size < b_size {
654-
let a = self.context.new_cast(self.location, a, b_type);
655-
a << b
656-
} else {
657-
a << b
652+
match a_size.cmp(&b_size) {
653+
std::cmp::Ordering::Less => {
654+
let a = self.context.new_cast(self.location, a, b_type);
655+
a << b
656+
}
657+
std::cmp::Ordering::Equal => a << b,
658+
std::cmp::Ordering::Greater => {
659+
let b = self.context.new_cast(self.location, b, a_type);
660+
a << b
661+
}
658662
}
659663
}
660664
} else if a_type.is_vector() && a_type.is_vector() {

src/intrinsic/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
125125
let llval = match name {
126126
_ if simple.is_some() => {
127127
// FIXME(antoyo): remove this cast when the API supports function.
128-
let func = unsafe { std::mem::transmute(simple.expect("simple")) };
128+
let func = unsafe {
129+
std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(simple.expect("simple"))
130+
};
129131
self.call(
130132
self.type_void(),
131133
None,
@@ -670,7 +672,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
670672
let step3 = self.or(left, right);
671673

672674
// Fourth step.
673-
if width == 8 { step3 } else { self.gcc_bswap(step3, width) }
675+
if width == 8 {
676+
step3
677+
} else {
678+
self.gcc_bswap(step3, width)
679+
}
674680
}
675681
128 => {
676682
// TODO(antoyo): find a more efficient implementation?
@@ -1189,7 +1195,7 @@ fn codegen_gnu_try<'gcc>(
11891195
bx.invoke(try_func_ty, None, None, try_func, &[data], then, catch, None, None);
11901196
});
11911197

1192-
let func = unsafe { std::mem::transmute(func) };
1198+
let func = unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) };
11931199

11941200
// Note that no invoke is used here because by definition this function
11951201
// can't panic (that's what it's catching).
@@ -1263,7 +1269,7 @@ fn gen_fn<'a, 'gcc, 'tcx>(
12631269
// FIXME(eddyb) find a nicer way to do this.
12641270
cx.linkage.set(FunctionType::Internal);
12651271
let func = cx.declare_fn(name, fn_abi);
1266-
let func_val = unsafe { std::mem::transmute(func) };
1272+
let func_val = unsafe { std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(func) };
12671273
cx.set_frame_pointer_type(func_val);
12681274
cx.apply_target_cpu_attr(func_val);
12691275
let block = Builder::append_block(cx, func_val, "entry-block");

src/intrinsic/simd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use rustc_codegen_ssa::errors::InvalidMonomorphization;
1313
use rustc_codegen_ssa::mir::operand::OperandRef;
1414
use rustc_codegen_ssa::mir::place::PlaceRef;
1515
use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods};
16+
#[cfg(feature = "master")]
1617
use rustc_hir as hir;
1718
use rustc_middle::mir::BinOp;
1819
use rustc_middle::span_bug;

src/mono_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
8181
// TODO(antoyo): use inline attribute from there in linkage.set() above.
8282

8383
self.functions.borrow_mut().insert(symbol_name.to_string(), decl);
84-
self.function_instances.borrow_mut().insert(instance, unsafe { std::mem::transmute(decl) });
84+
self.function_instances.borrow_mut().insert(instance, decl);
8585
}
8686
}

tests/failing-run-make-tests.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
tests/run-make/a-b-a-linker-guard/
2+
tests/run-make/CURRENT_RUSTC_VERSION/
3+
tests/run-make/cross-lang-lto/
4+
tests/run-make/cross-lang-lto-upstream-rlibs/
5+
tests/run-make/doctests-keep-binaries/
6+
tests/run-make/doctests-runtool/
7+
tests/run-make/emit-shared-files/
8+
tests/run-make/exit-code/
9+
tests/run-make/issue-22131/
10+
tests/run-make/issue-64153/
11+
tests/run-make/llvm-ident/
12+
tests/run-make/native-link-modifier-bundle/
13+
tests/run-make/remap-path-prefix-dwarf/
14+
tests/run-make/repr128-dwarf/
15+
tests/run-make/rlib-format-packed-bundled-libs/
16+
tests/run-make/rlib-format-packed-bundled-libs-2/
17+
tests/run-make/rustdoc-determinism/
18+
tests/run-make/rustdoc-error-lines/
19+
tests/run-make/rustdoc-map-file/
20+
tests/run-make/rustdoc-output-path/
21+
tests/run-make/rustdoc-scrape-examples-invalid-expr/
22+
tests/run-make/rustdoc-scrape-examples-multiple/
23+
tests/run-make/rustdoc-scrape-examples-ordering/
24+
tests/run-make/rustdoc-scrape-examples-remap/
25+
tests/run-make/rustdoc-scrape-examples-test/
26+
tests/run-make/rustdoc-scrape-examples-whitespace/
27+
tests/run-make/rustdoc-scrape-examples-macros/
28+
tests/run-make/rustdoc-with-out-dir-option/
29+
tests/run-make/rustdoc-verify-output-files/
30+
tests/run-make/rustdoc-themes/
31+
tests/run-make/rustdoc-with-short-out-dir-option/
32+
tests/run-make/rustdoc-with-output-option/
33+
tests/run-make/arguments-non-c-like-enum/
34+
tests/run-make/c-link-to-rust-staticlib/
35+
tests/run-make/foreign-double-unwind/
36+
tests/run-make/foreign-exceptions/
37+
tests/run-make/glibc-staticlib-args/
38+
tests/run-make/issue-36710/
39+
tests/run-make/issue-68794-textrel-on-minimal-lib/
40+
tests/run-make/lto-smoke-c/
41+
tests/run-make/return-non-c-like-enum/
42+

tests/failing-ui-tests.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ tests/ui/sepcomp/sepcomp-fns-backwards.rs
1414
tests/ui/sepcomp/sepcomp-fns.rs
1515
tests/ui/sepcomp/sepcomp-statics.rs
1616
tests/ui/asm/x86_64/may_unwind.rs
17-
tests/ui/backtrace.rs
1817
tests/ui/catch-unwind-bang.rs
1918
tests/ui/cfg/cfg-panic-abort.rs
2019
tests/ui/drop/dynamic-drop-async.rs

tests/run/array.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ impl Sub for i16 {
205205
}
206206
}
207207

208+
#[track_caller]
209+
#[lang = "panic_const_add_overflow"]
210+
pub fn panic_const_add_overflow() -> ! {
211+
panic("attempt to add with overflow");
212+
}
213+
214+
#[track_caller]
215+
#[lang = "panic_const_sub_overflow"]
216+
pub fn panic_const_sub_overflow() -> ! {
217+
panic("attempt to subtract with overflow");
218+
}
208219

209220
/*
210221
* Code

tests/run/assign.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ impl Add for isize {
120120
}
121121
}
122122

123+
#[track_caller]
124+
#[lang = "panic_const_add_overflow"]
125+
pub fn panic_const_add_overflow() -> ! {
126+
panic("attempt to add with overflow");
127+
}
128+
123129
/*
124130
* Code
125131
*/

tests/run/closure.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ pub fn panic(_msg: &'static str) -> ! {
189189
}
190190
}
191191

192+
#[track_caller]
193+
#[lang = "panic_const_add_overflow"]
194+
pub fn panic_const_add_overflow() -> ! {
195+
panic("attempt to add with overflow");
196+
}
197+
192198
/*
193199
* Code
194200
*/

tests/run/mut_ref.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ impl Add for isize {
122122
}
123123
}
124124

125+
#[track_caller]
126+
#[lang = "panic_const_add_overflow"]
127+
pub fn panic_const_add_overflow() -> ! {
128+
panic("attempt to add with overflow");
129+
}
130+
125131
/*
126132
* Code
127133
*/

tests/run/operations.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ impl Mul for isize {
207207
}
208208
}
209209

210+
#[track_caller]
211+
#[lang = "panic_const_add_overflow"]
212+
pub fn panic_const_add_overflow() -> ! {
213+
panic("attempt to add with overflow");
214+
}
215+
216+
#[track_caller]
217+
#[lang = "panic_const_sub_overflow"]
218+
pub fn panic_const_sub_overflow() -> ! {
219+
panic("attempt to subtract with overflow");
220+
}
221+
222+
#[track_caller]
223+
#[lang = "panic_const_mul_overflow"]
224+
pub fn panic_const_mul_overflow() -> ! {
225+
panic("attempt to multiply with overflow");
226+
}
227+
210228
/*
211229
* Code
212230
*/

0 commit comments

Comments
 (0)