Skip to content

Commit 41c1461

Browse files
author
The rustc-dev-guide Cronjob Bot
committed
Merge from rustc
2 parents a770388 + 6c9fabc commit 41c1461

15 files changed

+89
-30
lines changed

src/bin/miri.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::num::NonZero;
2929
use std::ops::Range;
3030
use std::path::PathBuf;
3131
use std::str::FromStr;
32-
use std::sync::Once;
32+
use std::sync::{Arc, Once};
3333
use std::sync::atomic::{AtomicI32, AtomicU32, Ordering};
3434

3535
use miri::{
@@ -38,7 +38,6 @@ use miri::{
3838
};
3939
use rustc_abi::ExternAbi;
4040
use rustc_data_structures::sync;
41-
use rustc_data_structures::sync::Lrc;
4241
use rustc_driver::Compilation;
4342
use rustc_hir::def_id::LOCAL_CRATE;
4443
use rustc_hir::{self as hir, Node};
@@ -134,7 +133,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
134133
// HACK: rustc will emit "crate ... required to be available in rlib format, but
135134
// was not found in this form" errors once we use `tcx.dependency_formats()` if
136135
// there's no rlib provided, so setting a dummy path here to workaround those errors.
137-
Lrc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All));
136+
Arc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All));
138137
crate_source
139138
};
140139
});

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(bootstrap, feature(trait_upcasting))]
12
#![feature(rustc_private)]
23
#![feature(cell_update)]
34
#![feature(float_gamma)]
@@ -9,7 +10,6 @@
910
#![feature(yeet_expr)]
1011
#![feature(nonzero_ops)]
1112
#![feature(let_chains)]
12-
#![feature(trait_upcasting)]
1313
#![feature(strict_overflow_ops)]
1414
#![feature(pointer_is_aligned_to)]
1515
#![feature(unqualified_local_imports)]

src/machine.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,11 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11501150
interp_ok(ecx.tcx.sess.ub_checks())
11511151
}
11521152

1153+
#[inline(always)]
1154+
fn contract_checks(ecx: &InterpCx<'tcx, Self>) -> InterpResult<'tcx, bool> {
1155+
interp_ok(ecx.tcx.sess.contract_checks())
1156+
}
1157+
11531158
#[inline(always)]
11541159
fn thread_local_static_pointer(
11551160
ecx: &mut MiriInterpCx<'tcx>,

tests/fail/dyn-upcast-trait-mismatch.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Validation stops this too early.
22
//@compile-flags: -Zmiri-disable-validation
33

4-
#![feature(trait_upcasting)]
5-
#![allow(incomplete_features)]
6-
74
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
85
#[allow(dead_code)]
96
fn a(&self) -> i32 {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(core_intrinsics)]
2+
fn main() {
3+
// one bit in common
4+
unsafe { std::intrinsics::disjoint_bitor(0b01101001_u8, 0b10001110) }; //~ ERROR: Undefined Behavior
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: `assume` called with `false`
2+
--> tests/fail/intrinsics/disjoint_bitor.rs:LL:CC
3+
|
4+
LL | unsafe { std::intrinsics::disjoint_bitor(0b01101001_u8, 0b10001110) };
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `assume` called with `false`
6+
|
7+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+
= note: BACKTRACE:
10+
= note: inside `main` at tests/fail/intrinsics/disjoint_bitor.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to 1 previous error
15+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
unsafe {
3+
(&1_u8 as *const u8).offset_from(&2_u8); //~ERROR: not both derived from the same allocation
4+
}
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
2+
--> tests/fail/intrinsics/ptr_offset_from_different_allocs.rs:LL:CC
3+
|
4+
LL | (&1_u8 as *const u8).offset_from(&2_u8);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
6+
|
7+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+
= note: BACKTRACE:
10+
= note: inside `main` at tests/fail/intrinsics/ptr_offset_from_different_allocs.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to 1 previous error
15+

tests/fail/intrinsics/ptr_offset_from_different_ints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn main() {
1515
let _ = p1.byte_offset_from(p1);
1616

1717
// UB because different pointers.
18-
let _ = p1.byte_offset_from(p2); //~ERROR: no provenance
18+
let _ = p1.byte_offset_from(p2); //~ERROR: not both derived from the same allocation
1919
}
2020
}

tests/fail/intrinsics/ptr_offset_from_different_ints.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds `offset_from` origin: expected a pointer to the end of 1 byte of memory, but got 0xb[noalloc] which is a dangling pointer (it has no provenance)
1+
error: Undefined Behavior: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
22
--> tests/fail/intrinsics/ptr_offset_from_different_ints.rs:LL:CC
33
|
44
LL | let _ = p1.byte_offset_from(p2);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to the end of 1 byte of memory, but got 0xb[noalloc] which is a dangling pointer (it has no provenance)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
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

0 commit comments

Comments
 (0)