Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d696a27

Browse files
committed
Auto merge of rust-lang#130415 - matthiaskrgr:rollup-xhsu9oq, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - rust-lang#130151 (Use a small runner for msvc-ext2 job) - rust-lang#130394 (const: don't ICE when encountering a mutable ref to immutable memory) - rust-lang#130409 (tests: more ice tests) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 04a3187 + 0406f12 commit d696a27

File tree

16 files changed

+135
-38
lines changed

16 files changed

+135
-38
lines changed

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ use hir::def::DefKind;
1414
use rustc_ast::Mutability;
1515
use rustc_data_structures::fx::FxHashSet;
1616
use rustc_hir as hir;
17+
use rustc_middle::bug;
1718
use rustc_middle::mir::interpret::ValidationErrorKind::{self, *};
1819
use rustc_middle::mir::interpret::{
1920
alloc_range, ExpectedKind, InterpError, InvalidMetaKind, Misalignment, PointerKind, Provenance,
2021
UnsupportedOpInfo, ValidationErrorInfo,
2122
};
2223
use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout};
2324
use rustc_middle::ty::{self, Ty, TyCtxt};
24-
use rustc_middle::{bug, span_bug};
2525
use rustc_span::symbol::{sym, Symbol};
2626
use rustc_target::abi::{
2727
Abi, FieldIdx, FieldsShape, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange,
@@ -617,13 +617,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
617617
if ptr_expected_mutbl == Mutability::Mut
618618
&& alloc_actual_mutbl == Mutability::Not
619619
{
620-
if !self.ecx.tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you
621-
{
622-
span_bug!(
623-
self.ecx.tcx.span,
624-
"the static const safety checks accepted mutable references they should not have accepted"
625-
);
626-
}
620+
// This can actually occur with transmutes.
627621
throw_validation_failure!(self.path, MutableRefToImmutable);
628622
}
629623
// In a const, everything must be completely immutable.

src/ci/github-actions/jobs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ runners:
2424
os: macos-14
2525
<<: *base-job
2626

27+
- &job-windows
28+
os: windows-2022
29+
<<: *base-job
30+
2731
- &job-windows-8c
2832
os: windows-2022-8core-32gb
2933
<<: *base-job
@@ -388,7 +392,7 @@ auto:
388392
python x.py miri --stage 2 library/alloc --test-args notest &&
389393
python x.py miri --stage 2 library/std --test-args notest
390394
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
391-
<<: *job-windows-8c
395+
<<: *job-windows
392396

393397
# 32/64-bit MinGW builds.
394398
#

tests/crashes/129262.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ known-bug: rust-lang/rust#129262
2+
//@ compile-flags: -Zvalidate-mir --edition=2018 --crate-type=lib -Copt-level=3
3+
4+
#![feature(async_closure)]
5+
6+
fn main() {}
7+
8+
fn needs_fn_mut<T>(mut x: impl FnMut() -> T) {
9+
x();
10+
}
11+
12+
fn hello(x: Ty) {
13+
needs_fn_mut(async || {
14+
x.hello();
15+
});
16+
}
17+
18+
struct Ty;
19+
impl Ty {
20+
fn hello(self) {}
21+
}

tests/crashes/129850.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: rust-lang/rust#129850
2+
3+
pub trait Foo2 {
4+
fn bar<'a: 'a>(&'a mut self) -> impl Sized + use<'static>;
5+
}
6+
7+
impl Foo2 for () {
8+
fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a {}
9+
}

tests/crashes/130104.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ known-bug: rust-lang/rust#130104
2+
3+
fn main() {
4+
let non_secure_function =
5+
core::mem::transmute::<fn() -> _, extern "C-cmse-nonsecure-call" fn() -> _>;
6+
}

tests/crashes/130310.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ known-bug: rust-lang/rust#130310
2+
3+
use std::marker::PhantomData;
4+
5+
#[repr(C)]
6+
struct A<T> {
7+
a: *const A<A<T>>,
8+
p: PhantomData<T>,
9+
}
10+
11+
extern "C" {
12+
fn f(a: *const A<()>);
13+
}
14+
15+
fn main() {}

tests/crashes/130346.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ known-bug: rust-lang/rust#130346
2+
3+
#![feature(non_lifetime_binders)]
4+
#![allow(unused)]
5+
6+
trait A<T>: Iterator<Item = T> {}
7+
8+
fn demo(x: &mut impl for<U> A<U>) {
9+
let _: Option<u32> = x.next(); // Removing this line stops the ICE
10+
}

tests/crashes/130372-1.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ known-bug: rust-lang/rust#130372
2+
3+
pub fn variadic_fn(n: usize, mut args: ...) {}
4+
5+
reuse variadic_fn;
6+
7+
fn main() {
8+
variadic_fn();
9+
}

tests/crashes/130372-2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ known-bug: rust-lang/rust#130372
2+
3+
pub fn test_va_copy(_: u64, mut ap: ...) {}
4+
5+
pub fn main() {
6+
unsafe {
7+
test_va_copy();
8+
9+
call(x);
10+
}
11+
}

tests/crashes/130372-3.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ known-bug: rust-lang/rust#130372
2+
3+
fn bar() -> impl Fn() {
4+
wrap()
5+
}
6+
7+
fn wrap(...: impl ...) -> impl Fn() {}

0 commit comments

Comments
 (0)