Skip to content

Commit

Permalink
Auto merge of rust-lang#136068 - matthiaskrgr:crashesjan25, r=<try>
Browse files Browse the repository at this point in the history
crashes: more tests

try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
  • Loading branch information
bors committed Feb 9, 2025
2 parents 43ca9d1 + fb52da3 commit 3aa8711
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/crashes/135470.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//@ known-bug: #135470
//@ compile-flags: --edition=2021 -Copt-level=0

use std::future::Future;
trait Access {
type Lister;

fn list() -> impl Future<Output = Self::Lister> {
async { todo!() }
}
}

trait Foo {}
impl Access for dyn Foo {
type Lister = ();
}

fn main() {
let svc = async {
async { <dyn Foo>::list() }.await;
};
&svc as &dyn Service;
}

trait UnaryService {
fn call2() {}
}
trait Unimplemented {}
impl<T: Unimplemented> UnaryService for T {}
struct Wrap<T>(T);
impl<T: Send> UnaryService for Wrap<T> {}

trait Service {
fn call(&self);
}
impl<T: Send> Service for T {
fn call(&self) {
Wrap::<T>::call2();
}
}
18 changes: 18 additions & 0 deletions tests/crashes/135528.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ known-bug: #135528
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
#![feature(type_alias_impl_trait)]
type Tait = impl Copy;

fn set(x: &isize) -> isize {
*x
}

fn d(x: Tait) {
set(x);
}

fn other_define() -> Tait {
()
}

fn main() {}
12 changes: 12 additions & 0 deletions tests/crashes/135570.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #135570
//@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN
//@ only-x86_64

fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>(
) -> &'static [u8] {
BYTES
}

fn main() {
function_with_bytes::<b"aa">() == &[];
}
13 changes: 13 additions & 0 deletions tests/crashes/135617.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #135617
trait Project {
const ASSOC: usize;
}

fn foo()
where
for<'a> (): Project,
{
[(); <() as Project>::ASSOC];
}

pub fn main() {}
5 changes: 5 additions & 0 deletions tests/crashes/135646.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ known-bug: #135646
//@ compile-flags: --edition=2024 -Zpolonius=next
fn main() {
&{ [1, 2, 3][4] };
}
38 changes: 38 additions & 0 deletions tests/crashes/135668.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//@ known-bug: #135668
//@ compile-flags: --edition=2021
use std::future::Future;

pub async fn foo() {
let _ = create_task().await;
}

async fn create_task() -> impl Sized {
bind(documentation)
}

async fn documentation() {
include_str!("nonexistent");
}

fn bind<F>(_filter: F) -> impl Sized
where
F: FilterBase,
{
|| -> <F as FilterBase>::Assoc { panic!() }
}

trait FilterBase {
type Assoc;
}

impl<F, R> FilterBase for F
where
F: Fn() -> R,
// Removing the below line makes it correctly error on both stable and beta
R: Future,
// Removing the below line makes it ICE on both stable and beta
R: Send,
// Removing the above two bounds makes it ICE on stable but correctly error on beta
{
type Assoc = F;
}
50 changes: 50 additions & 0 deletions tests/crashes/135718.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//@ known-bug: #135718

struct Equal;

struct Bar;

trait TwiceNested {}
impl<M> TwiceNested for Bar where Bar: NestMakeEqual<NestEq = M> {}

struct Sum;

trait Not {
fn not();
}

impl<P> Not for Sum
where
Bar: NestMakeEqual<NestEq = P>,
Self: Problem<P>,
{
fn not() {}
}

trait NestMakeEqual {
type NestEq;
}

trait MakeEqual {
type Eq;
}

struct Foo;
impl MakeEqual for Foo {
type Eq = Equal;
}

impl<O> NestMakeEqual for Bar
where
Foo: MakeEqual<Eq = O>,
{
type NestEq = O;
}

trait Problem<M> {}
impl Problem<()> for Sum where Bar: TwiceNested {}
impl Problem<Equal> for Sum where Bar: TwiceNested {}

fn main() {
Sum::not();
}
4 changes: 4 additions & 0 deletions tests/crashes/135720.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//@ known-bug: #135720
#![feature(generic_const_exprs)]
type S<'l> = [i32; A];
fn lint_me(x: S<()>) {}
6 changes: 6 additions & 0 deletions tests/crashes/135845.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #135845
struct S<'a, T: ?Sized>(&'a T);

fn b<'a>() -> S<'static, _> {
S::<'a>(&0)
}
10 changes: 10 additions & 0 deletions tests/crashes/135863.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #135863
struct A;

impl A {
fn len(self: &&B) {}
}

fn main() {
A.len()
}
6 changes: 6 additions & 0 deletions tests/crashes/136063.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #136063
#![feature(generic_const_exprs)]
trait A<const B: u8 = X> {}
impl A<1> for bool {}
fn bar(arg : &dyn A<x>) { bar(true) }
pub fn main() {}

0 comments on commit 3aa8711

Please sign in to comment.