Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/crashes/147719.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ known-bug: #147719
//@ edition: 2024
trait NodeImpl {}
struct Wrap<F, P>(F, P);
impl<F, P> Wrap<F, P> {
fn new(_: F) -> Self {
loop {}
}
}
trait Arg {}
impl<F, A> NodeImpl for Wrap<F, A> where A: Arg {}
impl<F, Fut, A> NodeImpl for Wrap<F, (A,)> where F: Fn(&(), A) -> Fut {}
fn trigger_ice() {
let _: &dyn NodeImpl = &Wrap::<_, (i128,)>::new(async |_: &(), i128| 0);
}
fn main() {}
42 changes: 42 additions & 0 deletions tests/crashes/148511.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//@ known-bug: #148511
//@ edition: 2021
use std::any::Any;

fn main() {
use_service(make_service());
let _future = async {};
}

fn make_service() -> impl FooService<Box<dyn Any>, Response: Body> {}

fn use_service<S, R>(_service: S)
where
S: FooService<R>,
<S::Response as Body>::Data: Any,
{
}

trait Service<Request> {
type Response: Body;
}

impl<T, Request> Service<Request> for T {
type Response = ();
}

trait FooService<Request>: Service<Request> {}

impl<T, Request, Resp> FooService<Request> for T
where
T: Service<Request, Response = Resp>,
Resp: Body,
{
}

trait Body {
type Data;
}

impl<T> Body for T {
type Data = ();
}
13 changes: 13 additions & 0 deletions tests/crashes/148629.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #148629
#![feature(with_negative_coherence)]
trait Foo {
type AssociatedType;
}

impl<const N: usize> Foo for [(); N] {}

pub struct Happy;

impl Foo for Happy {}

impl<const N: usize> Foo for Happy where <[(); N] as Foo>::AssociatedType: Clone {}
13 changes: 13 additions & 0 deletions tests/crashes/148630.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #148630
#![feature(unboxed_closures)]

trait Tr {}
trait Foo {
fn foo() -> impl Sized
where
for<'a> <() as FnOnce<&'a i32>>::Output: Tr,
{
}
}

fn main() {}
10 changes: 10 additions & 0 deletions tests/crashes/148632.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #148632
trait D<C> {}

trait Project {
const SELF: dyn D<Self>;
}

fn main() {
let _: &dyn Project<SELF = { 0 }>;
}
6 changes: 6 additions & 0 deletions tests/crashes/148890.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@ known-bug: #148890
impl std::ops::Neg for u128 {}

fn foo(-128..=127: u128) {}

fn main() {}
14 changes: 14 additions & 0 deletions tests/crashes/148891.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #148891
macro_rules! values {
($inner:ty) => {
#[derive(Debug)]
pub enum TokenKind {
#[cfg(test)]
STRING ([u8; $inner]),
}
};
}

values!(String);

pub fn main() {}
30 changes: 30 additions & 0 deletions tests/crashes/149162.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ known-bug: #149162
use std::marker::PhantomData;
pub trait ViewArgument {
type Params<'a>;
}

impl ViewArgument for () {
type Params<'a> = ();
}

pub trait View {}

pub fn buttons() -> Option<impl View> {
Some(()).map(|()| text_button(|()| {}))
}
pub fn text_button<State: ViewArgument>(
_: impl Fn(<State as ViewArgument>::Params<'_>),
) -> Button<State, impl Fn()> {
Button {
callback: || (),
phantom: PhantomData,
}
}
pub struct Button<State, F> {
pub callback: F,
pub phantom: PhantomData<State>,
}

impl<F> View for Button<(), F> {}
fn main() {}
12 changes: 12 additions & 0 deletions tests/crashes/149703.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #149703
#![feature(const_trait_impl)]
trait Z {
type Assoc;
}
struct A;
impl<T: const FnOnce()> Z for T {
type Assoc = ();
}
impl<T> From<<A as Z>::Assoc> for T {}

fn main() {}
20 changes: 20 additions & 0 deletions tests/crashes/152205.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//@ known-bug: #152205
#![deny(rust_2021_incompatible_closure_captures)]
struct Foo;
struct S;
impl Drop for S {
fn drop(&mut self) {}
}
struct U(<Foo as NewTrait>::Assoc);
fn test_precise_analysis_long_path(u: U) {
let _ = || {
let _x = u.0.0;
};
}
trait NewTrait {
type Assoc;
}
impl NewTrait for Foo {
type Assoc = (S,);
}
fn main(){}
11 changes: 11 additions & 0 deletions tests/crashes/152295.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ known-bug: #152295
#![feature(type_alias_impl_trait)]
type Tait = impl Sized;
trait Foo: Bar<Tait> {}
trait Bar<T> {
fn bar(&self);
}
fn test_correct2(x: &dyn Foo) {
x.bar();
}
fn main() {}
25 changes: 25 additions & 0 deletions tests/crashes/154556.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//@ known-bug: #154556
#![feature(generic_const_exprs)]

pub trait Foo {
// Has to take self or a reference to self to ICE.
fn eq(self);
}

pub trait Bar {
const NUMBER: usize;
}

impl<T: Bar> Foo for T
where
[(); T::NUMBER]: Sized, // Bound required for ICE
{
fn eq(self) {}
}

// As long as the method called below has the same name as the one defined in Foo, the ICE happens.
fn baz() {
().eq(&());
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/crashes/154964.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ known-bug: #154964
//@ edition: 2021
//@ compile-flags: -Zprint-type-sizes
fn main() {
|foo: Foo<_>| async { foo.bar };
}
struct Foo<F> {
bar: (),
}
10 changes: 10 additions & 0 deletions tests/crashes/157568.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@ known-bug: #157568
//@ compile-flags: -Zpolonius
#![warn(rust_2024_compatibility)]
pub struct F;
impl std::fmt::Debug for F {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("F").finish_non_exhaustive()
}
}
fn main() {}
Loading