Skip to content

Commit

Permalink
Rollup merge of rust-lang#130491 - matthiaskrgr:sehsarc, r=compiler-e…
Browse files Browse the repository at this point in the history
…rrors

more crash tests

r? `@compiler-errors`
  • Loading branch information
matthiaskrgr authored Sep 18, 2024
2 parents 32c4d41 + 12814c8 commit 862f3e7
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/crashes/120016.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ known-bug: #120016
//@ compile-flags: -Zcrate-attr=feature(const_async_blocks) --edition=2021

#![feature(type_alias_impl_trait, const_async_blocks)]

struct Bug {
V1: [(); {
type F = impl std::future::Future<Output = impl Sized>;
fn concrete_use() -> F {
//~^ ERROR to be a future that resolves to `u8`, but it resolves to `()`
async {}
}
let f: F = async { 1 };
//~^ ERROR `async` blocks are not allowed in constants
1
}],
}

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

struct Thing;

pub trait Every {
type Assoc;
}
impl<T: ?Sized> Every for Thing {
type Assoc = T;
}

fn foo(_: <Thing as Every>::Assoc) {}
15 changes: 15 additions & 0 deletions tests/crashes/128119.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #128119

trait Trait {
reuse to_reuse::foo { self }
}

struct S;

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

impl Trait S {
reuse to_reuse::foo { self }
}
15 changes: 15 additions & 0 deletions tests/crashes/128232.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #128232

#![feature(generic_const_exprs, unsized_const_params)]

fn function() {}

struct Wrapper<const F: fn()>;

impl Wrapper<{ bar() }> {
fn call() {}
}

fn main() {
Wrapper::<function>::call;
}
6 changes: 6 additions & 0 deletions tests/crashes/130411.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #130411
trait Project {
const SELF: Self;
}

fn take1(_: Project<SELF = {}>) {}
17 changes: 17 additions & 0 deletions tests/crashes/130413.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//@ known-bug: #130413

#![feature(transmutability)]
trait Aaa {
type Y;
}

trait Bbb {
type B: std::mem::TransmuteFrom<()>;
}

impl<T> Bbb for T
where
T: Aaa,
{
type B = T::Y;
}
13 changes: 13 additions & 0 deletions tests/crashes/130425.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #130425
//@ compile-flags: -Zmir-opt-level=5 -Zpolymorphize=on

struct S<T>(T)
where
[T; (
|_: u8| {
static FOO: Sync = AtomicUsize::new(0);
unsafe { &*(&FOO as *const _ as *const usize) }
},
1,
)
.1]: Copy;

0 comments on commit 862f3e7

Please sign in to comment.