Skip to content

Commit

Permalink
Auto merge of #129228 - matthiaskrgr:oopsie, r=jieyouxu
Browse files Browse the repository at this point in the history
crashes: more tests

r? `@jieyouxu`
  • Loading branch information
bors committed Aug 19, 2024
2 parents d0293c6 + 5fe70af commit 804be74
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/crashes/129150.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: rust-lang/rust#129150
//@ only-x86_64
use std::arch::x86_64::_mm_blend_ps;

pub fn main() {
_mm_blend_ps(1, 2, &const {} );
}
7 changes: 7 additions & 0 deletions tests/crashes/129166.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: rust-lang/rust#129166

fn main() {
#[cfg_eval]
#[cfg]
0
}
5 changes: 5 additions & 0 deletions tests/crashes/129205.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: rust-lang/rust#129205

fn x<T: Copy>() {
T::try_from();
}
11 changes: 11 additions & 0 deletions tests/crashes/129209.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: rust-lang/rust#129209

impl<
const N: usize = {
static || {
Foo([0; X]);
}
},
> PartialEq for True
{
}
30 changes: 30 additions & 0 deletions tests/crashes/129214.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ known-bug: rust-lang/rust#129214
//@ compile-flags: -Zvalidate-mir -Copt-level=3 --crate-type=lib

trait to_str {}

trait map<T> {
fn map<U, F>(&self, f: F) -> Vec<U>
where
F: FnMut(&Box<usize>) -> U;
}
impl<T> map<T> for Vec<T> {
fn map<U, F>(&self, mut f: F) -> Vec<U>
where
F: FnMut(&T) -> U,
{
let mut r = Vec::new();
for i in self {
r.push(f(i));
}
r
}
}

fn foo<U, T: map<U>>(x: T) -> Vec<String> {
x.map(|_e| "hi".to_string())
}

pub fn main() {
assert_eq!(foo(vec![1]), ["hi".to_string()]);
}
12 changes: 12 additions & 0 deletions tests/crashes/129216.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: rust-lang/rust#129216
//@ only-linux

trait Mirror {
type Assoc;
}

struct Foo;

fn main() {
<Foo as Mirror>::Assoc::new();
}
26 changes: 26 additions & 0 deletions tests/crashes/129219.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//@ known-bug: rust-lang/rust#129219
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir --edition=2018

use core::marker::Unsize;

pub trait CastTo<T: ?Sized>: Unsize<T> {}

impl<T: ?Sized, U: ?Sized> CastTo<T> for U {}

impl<T: ?Sized> Cast for T {}
pub trait Cast {
fn cast<T: ?Sized>(&self) -> &T
where
Self: CastTo<T>,
{
self
}
}

pub trait Foo {}
impl Foo for [i32; 0] {}

fn main() {
let x: &dyn Foo = &[];
let x = x.cast::<[i32]>();
}

0 comments on commit 804be74

Please sign in to comment.