Skip to content

Commit

Permalink
Auto merge of #124046 - matthiaskrgr:one_or_two_more_tests____some_on…
Browse files Browse the repository at this point in the history
…_top, r=jieyouxu

crashes: add even more tests?!?

adds more tests that were not already added with #124038 from the past 10 months or so.
Need a couple more passes through the tracker to filter out more missing ice /fixed tests but we're slowly getting there.
  • Loading branch information
bors committed Apr 18, 2024
2 parents 5260893 + 06335c6 commit b1248bc
Show file tree
Hide file tree
Showing 27 changed files with 723 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/crashes/112623.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//@ known-bug: #112623

#![feature(const_trait_impl, effects)]

#[const_trait]
trait Value {
fn value() -> u32;
}

const fn get_value<T: ~const Value>() -> u32 {
T::value()
}

struct FortyTwo;

impl const Value for FortyTwo {
fn value() -> i64 {
42
}
}

const FORTY_TWO: u32 = get_value::<FortyTwo>();

fn main() {
assert_eq!(FORTY_TWO, 42);
}
15 changes: 15 additions & 0 deletions tests/crashes/114198-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #114198
//@ compile-flags: -Zprint-mono-items=eager

impl Trait for <Ty as Owner>::Struct {}
trait Trait {
fn test(&self) {}
}

enum Ty {}
trait Owner { type Struct: ?Sized; }
impl Owner for Ty {
type Struct = dyn Trait + Send;
}

fn main() {}
13 changes: 13 additions & 0 deletions tests/crashes/114198.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #114198
//@ compile-flags: -Zprint-mono-items=eager

#![feature(lazy_type_alias)]

impl Trait for Struct {}
trait Trait {
fn test(&self) {}
}

type Struct = dyn Trait + Send;

fn main() {}
26 changes: 26 additions & 0 deletions tests/crashes/118185.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//@ known-bug: #118185

fn main() {
let target: Target = create_target();
target.get(0); // correct arguments work
target.get(10.0); // CRASH HERE
}

// must be generic
fn create_target<T>() -> T {
unimplemented!()
}

// unimplemented trait, but contains function with the same name
pub trait RandomTrait {
fn get(&mut self); // but less arguments
}

struct Target;

impl Target {
// correct function with arguments
pub fn get(&self, data: i32) {
unimplemented!()
}
}
12 changes: 12 additions & 0 deletions tests/crashes/120421.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #120421
//@ compile-flags: -Zlint-mir

#![feature(never_patterns)]

enum Void {}

fn main() {
let res_void: Result<bool, Void> = Ok(true);

for (Ok(mut _x) | Err(!)) in [res_void] {}
}
25 changes: 25 additions & 0 deletions tests/crashes/120792.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//@ known-bug: #120792
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes

impl Trait<()> for () {
fn foo<'a, K>(self, _: (), _: K) {
todo!();
}
}

trait Foo<T> {}

impl<F, T> Foo<T> for F {
fn main() {
().foo((), ());
}
}

trait Trait<T> {
fn foo<'a, K>(self, _: T, _: K)
where
T: 'a,
K: 'a;
}

pub fn main() {}
27 changes: 27 additions & 0 deletions tests/crashes/120811.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//@ known-bug: #120811

trait Container {
type Item<'a>;
}
impl Container for () {
type Item<'a> = ();
}
struct Exchange<C, F> {
_marker: std::marker::PhantomData<(C, F)>,
}
fn exchange<C, F>(_: F) -> Exchange<C, F>
where
C: Container,
for<'a> F: FnMut(&C::Item<'a>),
{
unimplemented!()
}
trait Parallelization<C> {}
impl<C, F> Parallelization<C> for Exchange<C, F> {}
fn unary_frontier<P: Parallelization<()>>(_: P) {}
fn main() {
let exchange = exchange(|_| ());
let _ = || {
unary_frontier(exchange);
};
}
20 changes: 20 additions & 0 deletions tests/crashes/121063.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//@ known-bug: #121063
//@ compile-flags: -Zpolymorphize=on --edition=2021 -Zinline-mir=yes

use std::{
fmt, ops,
path::{Component, Path, PathBuf},
};

pub struct AbsPathBuf(PathBuf);

impl TryFrom<PathBuf> for AbsPathBuf {
type Error = PathBuf;
fn try_from(path: impl AsRef<Path>) -> Result<AbsPathBuf, PathBuf> {}
}

impl TryFrom<&str> for AbsPathBuf {
fn try_from(path: &str) -> Result<AbsPathBuf, PathBuf> {
AbsPathBuf::try_from(PathBuf::from(path))
}
}
22 changes: 22 additions & 0 deletions tests/crashes/121127.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//@ known-bug: #121127
//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes

#![feature(specialization)]

pub trait Foo {
fn abc() -> u32;
}

pub trait Marker {}

impl<T> Foo for T {
default fn abc(f: fn(&T), t: &T) -> u32 {
16
}
}

impl<T: Marker> Foo for T {
fn def() -> u32 {
Self::abc()
}
}
16 changes: 16 additions & 0 deletions tests/crashes/123456.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ known-bug: #123456

trait Project {
const SELF: Self;
}

fn take1(
_: Project<
SELF = {
j2.join().unwrap();
},
>,
) {
}

pub fn main() {}
5 changes: 5 additions & 0 deletions tests/crashes/123461.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #123461

fn main() {
let _: [_; unsafe { std::mem::transmute(|o_b: Option<_>| {}) }];
}
Loading

0 comments on commit b1248bc

Please sign in to comment.