Skip to content

Commit

Permalink
Unrolled build for rust-lang#126560
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#126560 - matthiaskrgr:morecrashes, r=jieyouxu

more ice tests

r? `@jieyouxu`
  • Loading branch information
rust-timer authored Jun 16, 2024
2 parents 55cac26 + ff096f8 commit 55afab0
Show file tree
Hide file tree
Showing 13 changed files with 222 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/crashes/126062.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: rust-lang/rust#126062
struct Fail<T>(Fail);
impl<T> Fail<i32> {
const C: () = panic!();
}

fn f<T>() {
if false {
let _val = &Fail::<T>::C;
}
}
23 changes: 23 additions & 0 deletions tests/crashes/126148.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//@ known-bug: rust-lang/rust#126148

#![feature(effects)]
use std::ops::{FromResidual, Try};

struct TryMe;
struct Error;

impl const FromResidual<Error> for TryMe {}

impl const Try for TryMe {
type Output = ();
type Residual = Error;
}

const fn t() -> TryMe {
TryMe?;
TryMe
}

const _: () = {
t();
};
10 changes: 10 additions & 0 deletions tests/crashes/126182.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: rust-lang/rust#126182

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

struct Cond<const B: bool>;

struct Thing<T = Cond<0>>(T);

impl Thing {}
30 changes: 30 additions & 0 deletions tests/crashes/126267.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ known-bug: rust-lang/rust#126267

#![feature(transmutability)]
#![crate_type = "lib"]

pub enum ApiError {}
pub struct TokioError {
b: bool,
}
pub enum Error {
Api { source: ApiError },
Ethereum,
Tokio { source: TokioError },
}

mod assert {
use std::mem::BikeshedIntrinsicFrom;

pub fn is_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src>, // safety is NOT assumed
{
}
}

fn test() {
struct Src;
type Dst = Error;
assert::is_transmutable::<Src, Dst>();
}
12 changes: 12 additions & 0 deletions tests/crashes/126269.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: rust-lang/rust#126269
#![feature(coerce_unsized)]

pub enum Foo<T> {
Bar([T; usize::MAX]),
}

use std::ops::CoerceUnsized;

impl<T, U> CoerceUnsized<U> for T {}

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

#![feature(adt_const_params)]
#![allow(incomplete_features)]

use std::marker::ConstParamTy;

#[derive(Debug, PartialEq, Eq, ConstParamTy)]
struct Foo {
value: i32,
nested: &'static Bar<std::fmt::Debug>,
}

#[derive(Debug, PartialEq, Eq, ConstParamTy)]
struct Bar<T>(T);

struct Test<const F: Foo>;

fn main() {
let x: Test<
{
Foo {
value: 3,
nested: &Bar(4),
}
},
> = Test;
}
9 changes: 9 additions & 0 deletions tests/crashes/126359.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: rust-lang/rust#126359

struct OppOrder<const N: u8 = 3, T = u32> {
arr: [T; N],
}

fn main() {
let _ = OppOrder::<3, u32> { arr: [0, 0, 0] };
}
14 changes: 14 additions & 0 deletions tests/crashes/126376.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: rust-lang/rust#126376
mod a {
pub mod b {
pub mod c {
pub trait D {}
}
}
}

use a::*;
use e as b;
use b::c::D as e;

fn e() {}
29 changes: 29 additions & 0 deletions tests/crashes/126377.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//@ known-bug: rust-lang/rust#126377

#![feature(effects)]
#![feature(generic_const_exprs)]

mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};

pub fn is_transmutable<
Src,
Dst,
const ASSUME_ALIGNMENT: bool,
const ASSUME_LIFETIMES: bool,
const ASSUME_SAFETY: bool,
const ASSUME_VALIDITY: bool,
>()
where
Dst: BikeshedIntrinsicFrom<
Src,
{ }
>,
{}
}

const fn from_options() -> Assume {
#[repr(C)] struct Src;
#[repr(C)] struct Dst;
assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
}
10 changes: 10 additions & 0 deletions tests/crashes/126385.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: rust-lang/rust#126385
pub struct MyStruct<'field> {
field: &'_ [u32],
}

impl MyStruct<'_> {
pub fn _<'a>(field: &'a[u32]) -> Self<new> {
Self{field}
}
}
15 changes: 15 additions & 0 deletions tests/crashes/126389.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: rust-lang/rust#126389

mod a {
pub mod b {
pub mod c {}
}
}

use a::*;

use b::c;

use c as b;

fn c() {}
20 changes: 20 additions & 0 deletions tests/crashes/126416.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//@ known-bug: rust-lang/rust#126416

trait Output<'a, T: 'a> {
type Type;
}

struct Wrapper;

impl Wrapper {
fn do_something_wrapper<O, F>(&mut self, _: F)
where
F: for<'a> FnOnce(<F as Output<i32>>::Type),
{
}
}

fn main() {
let mut wrapper = Wrapper;
wrapper.do_something_wrapper(|value| ());
}
11 changes: 11 additions & 0 deletions tests/crashes/126521.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: rust-lang/rust#126521
macro_rules! foo {
($val:ident) => {
true;
};
}

fn main() {
#[expect(semicolon_in_expressions_from_macros)]
let _ = foo!(x);
}

0 comments on commit 55afab0

Please sign in to comment.