crashes: add more tests
This commit is contained in:
parent
d38cd229b7
commit
c59e7fd95b
9 changed files with 142 additions and 0 deletions
18
tests/crashes/126646.rs
Normal file
18
tests/crashes/126646.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126646
|
||||||
|
mod foo {
|
||||||
|
pub trait Callable {
|
||||||
|
type Output;
|
||||||
|
fn call() -> Self::Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, V: ?Sized> Callable for &'a () {
|
||||||
|
type Output = ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
use foo::*;
|
||||||
|
|
||||||
|
fn test<'a>() -> impl Sized {
|
||||||
|
<&'a () as Callable>::call()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
8
tests/crashes/126648.rs
Normal file
8
tests/crashes/126648.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126648
|
||||||
|
struct Outest(*const &'a ());
|
||||||
|
|
||||||
|
fn make() -> Outest {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
if let Outest("foo") = make() {}
|
||||||
|
}
|
18
tests/crashes/126666.rs
Normal file
18
tests/crashes/126666.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126666
|
||||||
|
#![feature(const_mut_refs)]
|
||||||
|
#![feature(const_refs_to_static)]
|
||||||
|
#![feature(object_safe_for_dispatch)]
|
||||||
|
|
||||||
|
struct Meh {
|
||||||
|
x: &'static dyn UnsafeCell,
|
||||||
|
}
|
||||||
|
|
||||||
|
const MUH: Meh = Meh {
|
||||||
|
x: &mut *(&READONLY as *const _ as *mut _),
|
||||||
|
};
|
||||||
|
|
||||||
|
static READONLY: i32 = 0;
|
||||||
|
|
||||||
|
trait UnsafeCell<'a> {}
|
||||||
|
|
||||||
|
pub fn main() {}
|
14
tests/crashes/126667.rs
Normal file
14
tests/crashes/126667.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126667
|
||||||
|
#![warn(rust_2021_compatibility)]
|
||||||
|
|
||||||
|
trait Static<'a> {}
|
||||||
|
|
||||||
|
struct Foo((u32, u32));
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
type T = impl Static;
|
||||||
|
let foo: T = Foo((1u32, 2u32));
|
||||||
|
let x = move || {
|
||||||
|
let Foo((a, b)) = foo;
|
||||||
|
};
|
||||||
|
}
|
21
tests/crashes/126680.rs
Normal file
21
tests/crashes/126680.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126680
|
||||||
|
//@ compile-flags: -Zvalidate-mir
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
type Bar = impl std::fmt::Display;
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
pub func: fn(check: Bar, b: Option<&Path>),
|
||||||
|
}
|
||||||
|
const MY_A: A = A {
|
||||||
|
func: |check, b| {
|
||||||
|
if check {
|
||||||
|
()
|
||||||
|
} else if let Some(_) = b.and_then(|p| p.parent()) {
|
||||||
|
()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
fn main() {}
|
24
tests/crashes/126696.rs
Normal file
24
tests/crashes/126696.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126696
|
||||||
|
#![feature(generic_const_exprs)]
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
|
fn can_double<const N: usize>(x: [(); N])
|
||||||
|
where
|
||||||
|
[(); N * 2]:,
|
||||||
|
{
|
||||||
|
x[0];
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn foo<const N: usize>()
|
||||||
|
where
|
||||||
|
[(); (N + 1) * 2]:,
|
||||||
|
{
|
||||||
|
can_double([(); { N + 1 }]);
|
||||||
|
// Adding an explicit constant generic causes the ICE to go away
|
||||||
|
// can_double::<{N + 1}>([(); { N + 1 }]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo::<1>();
|
||||||
|
}
|
20
tests/crashes/126725.rs
Normal file
20
tests/crashes/126725.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126725
|
||||||
|
trait Foo {
|
||||||
|
fn foo<'a>(&'a self) -> <&'a impl Sized as Bar>::Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Bar {
|
||||||
|
type Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct X(i32);
|
||||||
|
|
||||||
|
impl<'a> Bar for &'a X {
|
||||||
|
type Output = &'a i32;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Foo for X {
|
||||||
|
fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
8
tests/crashes/126744.rs
Normal file
8
tests/crashes/126744.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126744
|
||||||
|
struct X {,}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
|| {
|
||||||
|
if let X { x: 1,} = (X {}) {}
|
||||||
|
};
|
||||||
|
}
|
11
tests/crashes/126850.rs
Normal file
11
tests/crashes/126850.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//@ known-bug: rust-lang/rust#126850
|
||||||
|
fn bug<T>() -> impl Iterator<
|
||||||
|
Item = [(); {
|
||||||
|
|found: &String| Some(false);
|
||||||
|
4
|
||||||
|
}],
|
||||||
|
> {
|
||||||
|
std::iter::empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue