Skip to content

Commit

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

add more tests

r? `@jieyouxu`
  • Loading branch information
rust-timer authored Jul 22, 2024
2 parents 20f23ab + 5ab2e40 commit bdd37a7
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/crashes/127351.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ known-bug: #127351
#![feature(lazy_type_alias)]
#![allow(incomplete_features)]

struct Outer0<'a, T>(ExplicitTypeOutlives<'a, T>);
type ExplicitTypeOutlives<'a, T: 'a> = (&'a (), T);

pub struct Warns {
_significant_drop: ExplicitTypeOutlives,
field: String,
}

pub fn test(w: Warns) {
_ = || drop(w.field);
}

fn main() {}
18 changes: 18 additions & 0 deletions tests/crashes/127353.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ known-bug: #127353
#![feature(type_alias_impl_trait)]
trait Trait<T> {}
type Alias<'a, U> = impl Trait<U>;

fn f<'a>() -> Alias<'a, ()> {}

pub enum UninhabitedVariants {
Tuple(Alias),
}

struct A;

fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A {
match x {}
}

fn main() {}
14 changes: 14 additions & 0 deletions tests/crashes/127628.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #127628
//@ compile-flags: -Zpolonius=next

use std::io::{self, Read};

pub struct Container<'a> {
reader: &'a mut dyn Read,
}

impl<'a> Container {
pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> {
Container { reader: reader }
}
}
18 changes: 18 additions & 0 deletions tests/crashes/127643.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ known-bug: #127643

#![feature(associated_const_equality)]

fn user() -> impl Owner<dyn Sized, C = 0> {}

trait Owner<K> {
const C: K;
}
impl<K: ConstDefault> Owner<K> for () {
const C: K = K::DEFAULT;
}

trait ConstDefault {
const DEFAULT: Self;
}

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

#![feature(dyn_star,const_async_blocks)]

static S: dyn* Send + Sync = async { 42 };

pub fn main() {}
21 changes: 21 additions & 0 deletions tests/crashes/127737.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//@ known-bug: #127737
//@ compile-flags: -Zmir-opt-level=5 --crate-type lib

pub trait TestTrait {
type MyType;
fn func() -> Option<Self>
where
Self: Sized;
}

impl<T> dyn TestTrait<MyType = T>
where
Self: Sized,
{
pub fn other_func() -> Option<Self> {
match Self::func() {
Some(me) => Some(me),
None => None,
}
}
}
11 changes: 11 additions & 0 deletions tests/crashes/127742.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #127742
struct Vtable(dyn Cap); // missing lifetime

trait Cap<'a> {}

union Transmute {
t: u64, // ICEs with u64, u128, or usize. Correctly errors with u32.
u: &'static Vtable,
}

const G: &'static Vtable = unsafe { Transmute { t: 1 }.u };
5 changes: 5 additions & 0 deletions tests/crashes/127880.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #127880
//@ compile-flags: -Cinstrument-coverage

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

trait Trait {
fn foo(&self) -> u32 { 0 }
}

struct F;
struct S;

mod to_reuse {
pub fn foo(&self) -> u32 {}
}

impl Trait S {
reuse to_reuse::foo { self }
}
6 changes: 6 additions & 0 deletions tests/crashes/127972.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #127962
#![feature(generic_const_exprs)]

fn zero_init<const usize: usize>() -> Substs1<{ (N) }> {
Substs1([0; { (usize) }])
}
10 changes: 10 additions & 0 deletions tests/crashes/128016.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #128016
macro_rules! len {
() => {
target
};
}

fn main() {
let val: [str; len!()] = [];
}

0 comments on commit bdd37a7

Please sign in to comment.