Skip to content

Commit b18a6b4

Browse files
committed
Merge from rustc
2 parents d9a91b1 + 5954a0d commit b18a6b4

21 files changed

+169
-53
lines changed

src/intrinsics/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
189189
let place = this.deref_pointer(place)?;
190190
let rhs = this.read_immediate(rhs)?;
191191

192-
if !place.layout.ty.is_integral() && !place.layout.ty.is_unsafe_ptr() {
192+
if !place.layout.ty.is_integral() && !place.layout.ty.is_raw_ptr() {
193193
span_bug!(
194194
this.cur_span(),
195195
"atomic arithmetic operations only work on integer and raw pointer types",

src/intrinsics/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,60 +145,60 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
145145
this.write_scalar(Scalar::from_bool(branch), dest)?;
146146
}
147147

148-
"floorf16" | "ceilf16" | "truncf16" | "roundf16" | "rintf16" => {
148+
"floorf16" | "ceilf16" | "truncf16" | "roundf16" | "round_ties_even_f16" => {
149149
let [f] = check_arg_count(args)?;
150150
let f = this.read_scalar(f)?.to_f16()?;
151151
let mode = match intrinsic_name {
152152
"floorf16" => Round::TowardNegative,
153153
"ceilf16" => Round::TowardPositive,
154154
"truncf16" => Round::TowardZero,
155155
"roundf16" => Round::NearestTiesToAway,
156-
"rintf16" => Round::NearestTiesToEven,
156+
"round_ties_even_f16" => Round::NearestTiesToEven,
157157
_ => bug!(),
158158
};
159159
let res = f.round_to_integral(mode).value;
160160
let res = this.adjust_nan(res, &[f]);
161161
this.write_scalar(res, dest)?;
162162
}
163-
"floorf32" | "ceilf32" | "truncf32" | "roundf32" | "rintf32" => {
163+
"floorf32" | "ceilf32" | "truncf32" | "roundf32" | "round_ties_even_f32" => {
164164
let [f] = check_arg_count(args)?;
165165
let f = this.read_scalar(f)?.to_f32()?;
166166
let mode = match intrinsic_name {
167167
"floorf32" => Round::TowardNegative,
168168
"ceilf32" => Round::TowardPositive,
169169
"truncf32" => Round::TowardZero,
170170
"roundf32" => Round::NearestTiesToAway,
171-
"rintf32" => Round::NearestTiesToEven,
171+
"round_ties_even_f32" => Round::NearestTiesToEven,
172172
_ => bug!(),
173173
};
174174
let res = f.round_to_integral(mode).value;
175175
let res = this.adjust_nan(res, &[f]);
176176
this.write_scalar(res, dest)?;
177177
}
178-
"floorf64" | "ceilf64" | "truncf64" | "roundf64" | "rintf64" => {
178+
"floorf64" | "ceilf64" | "truncf64" | "roundf64" | "round_ties_even_f64" => {
179179
let [f] = check_arg_count(args)?;
180180
let f = this.read_scalar(f)?.to_f64()?;
181181
let mode = match intrinsic_name {
182182
"floorf64" => Round::TowardNegative,
183183
"ceilf64" => Round::TowardPositive,
184184
"truncf64" => Round::TowardZero,
185185
"roundf64" => Round::NearestTiesToAway,
186-
"rintf64" => Round::NearestTiesToEven,
186+
"round_ties_even_f64" => Round::NearestTiesToEven,
187187
_ => bug!(),
188188
};
189189
let res = f.round_to_integral(mode).value;
190190
let res = this.adjust_nan(res, &[f]);
191191
this.write_scalar(res, dest)?;
192192
}
193-
"floorf128" | "ceilf128" | "truncf128" | "roundf128" | "rintf128" => {
193+
"floorf128" | "ceilf128" | "truncf128" | "roundf128" | "round_ties_even_f128" => {
194194
let [f] = check_arg_count(args)?;
195195
let f = this.read_scalar(f)?.to_f128()?;
196196
let mode = match intrinsic_name {
197197
"floorf128" => Round::TowardNegative,
198198
"ceilf128" => Round::TowardPositive,
199199
"truncf128" => Round::TowardZero,
200200
"roundf128" => Round::NearestTiesToAway,
201-
"rintf128" => Round::NearestTiesToEven,
201+
"round_ties_even_f128" => Round::NearestTiesToEven,
202202
_ => bug!(),
203203
};
204204
let res = f.round_to_integral(mode).value;

src/intrinsics/simd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
633633
this.write_immediate(*val, &dest)?;
634634
}
635635
}
636-
"shuffle_generic" => {
636+
"shuffle_const_generic" => {
637637
let [left, right] = check_arg_count(args)?;
638638
let (left, left_len) = this.project_to_simd(left)?;
639639
let (right, right_len) = this.project_to_simd(right)?;
@@ -657,7 +657,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
657657
this.read_immediate(&this.project_index(&right, right_idx)?)?
658658
} else {
659659
throw_ub_format!(
660-
"`simd_shuffle_generic` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}"
660+
"`simd_shuffle_const_generic` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}"
661661
);
662662
};
663663
this.write_immediate(*val, &dest)?;

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#![cfg_attr(bootstrap, feature(trait_upcasting))]
21
#![feature(rustc_private)]
32
#![feature(cell_update)]
43
#![feature(float_gamma)]
4+
#![feature(float_erf)]
55
#![feature(map_try_insert)]
66
#![feature(never_type)]
77
#![feature(try_blocks)]
@@ -15,8 +15,6 @@
1515
#![feature(unqualified_local_imports)]
1616
#![feature(derive_coerce_pointee)]
1717
#![feature(arbitrary_self_types)]
18-
#![feature(unsigned_is_multiple_of)]
19-
#![feature(extract_if)]
2018
// Configure clippy and other lints
2119
#![allow(
2220
clippy::collapsible_else_if,

src/operator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5252
// Some more operations are possible with atomics.
5353
// The return value always has the provenance of the *left* operand.
5454
Add | Sub | BitOr | BitAnd | BitXor => {
55-
assert!(left.layout.ty.is_unsafe_ptr());
56-
assert!(right.layout.ty.is_unsafe_ptr());
55+
assert!(left.layout.ty.is_raw_ptr());
56+
assert!(right.layout.ty.is_raw_ptr());
5757
let ptr = left.to_scalar().to_pointer(this)?;
5858
// We do the actual operation with usize-typed scalars.
5959
let left = ImmTy::from_uint(ptr.addr().bytes(), this.machine.layouts.usize);

src/shims/foreign_items.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
742742
| "log1pf"
743743
| "expm1f"
744744
| "tgammaf"
745+
| "erff"
746+
| "erfcf"
745747
=> {
746748
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
747749
let f = this.read_scalar(f)?.to_f32()?;
@@ -759,6 +761,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
759761
"log1pf" => f_host.ln_1p(),
760762
"expm1f" => f_host.exp_m1(),
761763
"tgammaf" => f_host.gamma(),
764+
"erff" => f_host.erf(),
765+
"erfcf" => f_host.erfc(),
762766
_ => bug!(),
763767
};
764768
let res = res.to_soft();
@@ -799,6 +803,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
799803
| "log1p"
800804
| "expm1"
801805
| "tgamma"
806+
| "erf"
807+
| "erfc"
802808
=> {
803809
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
804810
let f = this.read_scalar(f)?.to_f64()?;
@@ -816,6 +822,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
816822
"log1p" => f_host.ln_1p(),
817823
"expm1" => f_host.exp_m1(),
818824
"tgamma" => f_host.gamma(),
825+
"erf" => f_host.erf(),
826+
"erfc" => f_host.erfc(),
819827
_ => bug!(),
820828
};
821829
let res = res.to_soft();
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//@normalize-stderr-test: "\d+ < \d+" -> "$$ADDR < $$ADDR"
2-
#![feature(ptr_sub_ptr)]
3-
42
fn main() {
53
let arr = [0u8; 8];
64
let ptr1 = arr.as_ptr();
75
let ptr2 = ptr1.wrapping_add(4);
8-
let _val = unsafe { ptr1.sub_ptr(ptr2) }; //~ERROR: first pointer has smaller address than second
6+
let _val = unsafe { ptr1.offset_from_unsigned(ptr2) }; //~ERROR: first pointer has smaller address than second
97
}

tests/fail/intrinsics/ptr_offset_from_unsigned_neg.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: `ptr_offset_from_unsigned` called when first pointer has smaller address than second: $ADDR < $ADDR
22
--> tests/fail/intrinsics/ptr_offset_from_unsigned_neg.rs:LL:CC
33
|
4-
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
5-
| ^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller address than second: $ADDR < $ADDR
4+
LL | let _val = unsafe { ptr1.offset_from_unsigned(ptr2) };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller address than second: $ADDR < $ADDR
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/panic/panic_abort1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
3-
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
3+
//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort
55

66
fn main() {

tests/fail/panic/panic_abort2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
3-
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
3+
//@normalize-stderr-test: "unsafe \{ libc::abort\(\); \}|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort
55

66
fn main() {

0 commit comments

Comments
 (0)