Rollup merge of #128173 - compiler-errors:misused-intrinsics, r=oli-obk
Remove crashes for misuses of intrinsics All of these do not crash if the feature gate is removed. An ICE due *opting into* the intrinsics feature gate is not a bug that needs to be fixed, but instead a misuse of an internal-only API. See https://github.com/rust-lang/compiler-team/issues/620 The last two issues are already closed anyways, but: Fixes #97501 Fixes #111699 Fixes #101962
This commit is contained in:
commit
c98d704c46
@ -1,11 +0,0 @@
|
||||
//@ known-bug: #101962
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
pub fn wrapping<T: Copy>(a: T, b: T) {
|
||||
let _z = core::intrinsics::wrapping_mul(a, b);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
wrapping(1,2);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
//@ known-bug: #111699
|
||||
//@ edition:2021
|
||||
//@ compile-flags: -Copt-level=0
|
||||
#![feature(core_intrinsics)]
|
||||
use std::intrinsics::offset;
|
||||
|
||||
fn main() {
|
||||
let a = [1u8, 2, 3];
|
||||
let ptr: *const u8 = a.as_ptr();
|
||||
|
||||
unsafe {
|
||||
assert_eq!(*offset(ptr, 0), 1);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
//@ known-bug: #97501
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
use std::intrinsics::wrapping_add;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct WrapInt8 {
|
||||
value: u8
|
||||
}
|
||||
|
||||
impl std::ops::Add for WrapInt8 {
|
||||
type Output = WrapInt8;
|
||||
fn add(self, other: WrapInt8) -> WrapInt8 {
|
||||
wrapping_add(self, other)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let p = WrapInt8 { value: 123 };
|
||||
let q = WrapInt8 { value: 234 };
|
||||
println!("{}", (p + q).value);
|
||||
}
|
Loading…
Reference in New Issue
Block a user