forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#126869 - matthiaskrgr:kaboom, r=jieyouxu
crashes: add more tests
- Loading branch information
Showing
9 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@ known-bug: rust-lang/rust#126648 | ||
struct Outest(*const &'a ()); | ||
|
||
fn make() -> Outest {} | ||
|
||
fn main() { | ||
if let Outest("foo") = make() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@ known-bug: rust-lang/rust#126744 | ||
struct X {,} | ||
|
||
fn main() { | ||
|| { | ||
if let X { x: 1,} = (X {}) {} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |