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.
Rollup merge of rust-lang#131447 - matthiaskrgr:morecrashtests, r=com…
…piler-errors add more crash tests r? `@jieyouxu`
- Loading branch information
Showing
21 changed files
with
343 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,37 @@ | ||
//@ known-bug: #130956 | ||
|
||
mod impl_trait_mod { | ||
use super::*; | ||
pub type OpaqueBlock = impl Trait; | ||
pub type OpaqueIf = impl Trait; | ||
|
||
pub struct BlockWrapper(OpaqueBlock); | ||
pub struct IfWrapper(pub OpaqueIf); | ||
|
||
pub fn if_impl() -> Parser<OpaqueIf> { | ||
bind(option(block()), |_| block()) | ||
} | ||
} | ||
use impl_trait_mod::*; | ||
|
||
pub trait Trait { | ||
type Assoc; | ||
} | ||
pub struct Parser<P>(P); | ||
pub struct Bind<P, F>(P, F); | ||
impl<P, F> Trait for Bind<P, F> { type Assoc = (); } | ||
impl Trait for BlockWrapper { type Assoc = (); } | ||
impl Trait for IfWrapper { type Assoc = (); } | ||
|
||
pub fn block() -> Parser<BlockWrapper> { | ||
loop {} | ||
} | ||
pub fn option<P: Trait>(arg: Parser<P>) -> Parser<impl Trait> { | ||
bind(arg, |_| block()) | ||
} | ||
fn bind<P: Trait, P2, F: Fn(P::Assoc) -> Parser<P2>>(_: Parser<P>, _: F) -> Parser<Bind<P, F>> | ||
{ loop {} } | ||
|
||
fn main() { | ||
if_impl().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,13 @@ | ||
//@ known-bug: #130967 | ||
|
||
trait Producer { | ||
type Produced; | ||
fn make_one() -> Self::Produced; | ||
} | ||
|
||
impl<E: ?Sized> Producer for () { | ||
type Produced = Option<E>; | ||
fn make_one() -> Self::Produced { | ||
loop {} | ||
} | ||
} |
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,15 @@ | ||
//@ known-bug: #131046 | ||
|
||
trait Owner { | ||
const C<const N: u32>: u32; | ||
} | ||
|
||
impl Owner for () { | ||
const C<const N: u32>: u32 = N; | ||
} | ||
|
||
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {} | ||
|
||
fn main() { | ||
take0::<128>(()); | ||
} |
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,7 @@ | ||
//@ known-bug: #131048 | ||
|
||
impl<A> std::ops::CoerceUnsized<A> for A {} | ||
|
||
fn main() { | ||
format_args!("Hello, world!"); | ||
} |
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,27 @@ | ||
//@ known-bug: #131050 | ||
//@ compile-flags: --edition=2021 | ||
|
||
fn query_as<D>() {} | ||
|
||
async fn create_user() { | ||
query_as(); | ||
} | ||
|
||
async fn post_user_filter() -> impl Filter { | ||
AndThen(&(), || async { create_user().await }) | ||
} | ||
|
||
async fn get_app() -> impl Send { | ||
post_user_filter().await | ||
} | ||
|
||
trait Filter {} | ||
|
||
struct AndThen<T, F>(T, F); | ||
|
||
impl<T, F, R> Filter for AndThen<T, F> | ||
where | ||
F: Fn() -> R, | ||
R: Send, | ||
{ | ||
} |
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: #131052 | ||
#![feature(adt_const_params)] | ||
|
||
struct ConstBytes<const T: &'static [*mut u8; 3]>; | ||
|
||
pub fn main() { | ||
let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; | ||
} |
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,12 @@ | ||
//@ known-bug: #131101 | ||
trait Foo<const N: u8> { | ||
fn do_x(&self) -> [u8; N]; | ||
} | ||
|
||
struct Bar; | ||
|
||
impl Foo<const 3> for Bar { | ||
fn do_x(&self) -> [u8; 3] { | ||
[0u8; 3] | ||
} | ||
} |
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,4 @@ | ||
//@ known-bug: #131102 | ||
pub struct Blorb<const N: u16>([String; N]); | ||
pub struct Wrap(Blorb<0>); | ||
pub const fn i(_: Wrap) {} |
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,6 @@ | ||
//@ known-bug: #131103 | ||
struct Struct<const N: i128>(pub [u8; N]); | ||
|
||
pub fn function(value: Struct<3>) -> u8 { | ||
value.0[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,19 @@ | ||
//@ known-bug: #131190 | ||
//@ compile-flags: -Cinstrument-coverage --edition=2018 | ||
|
||
use std::future::Future; | ||
|
||
pub fn block_on<T>(fut: impl Future<Output = T>) -> T {} | ||
|
||
async fn call_once(f: impl async FnOnce(DropMe)) { | ||
f(DropMe("world")).await; | ||
} | ||
|
||
struct DropMe(&'static str); | ||
|
||
pub fn main() { | ||
block_on(async { | ||
let async_closure = async move |a: DropMe| {}; | ||
call_once(async_closure).await; | ||
}); | ||
} |
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,16 @@ | ||
//@ known-bug: #131227 | ||
//@ compile-flags: -Zmir-opt-level=3 | ||
|
||
static mut G: () = (); | ||
|
||
fn myfunc() -> i32 { | ||
let var = &raw mut G; | ||
if var.is_null() { | ||
return 0; | ||
} | ||
0 | ||
} | ||
|
||
fn main() { | ||
myfunc(); | ||
} |
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,7 @@ | ||
//@ known-bug: #131292 | ||
//@ only-x86_64 | ||
use std::arch::asm; | ||
|
||
unsafe fn f6() { | ||
asm!(concat!(r#"lJ�.�"#, "{}/day{:02}.txt")); | ||
} |
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,25 @@ | ||
//@ known-bug: #131294 | ||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always | ||
|
||
// https://github.com/rust-lang/rust/issues/131294#issuecomment-2395088049 second comment | ||
struct Rows; | ||
|
||
impl Iterator for Rows { | ||
type Item = String; | ||
|
||
fn next() -> Option<String> { | ||
let args = format_args!("Hello world"); | ||
|
||
{ | ||
match args.as_str() { | ||
Some(t) => t.to_owned(), | ||
None => String::new(), | ||
} | ||
} | ||
.into() | ||
} | ||
} | ||
|
||
fn main() { | ||
Rows.next(); | ||
} |
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,16 @@ | ||
//@ known-bug: #131294 | ||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always | ||
|
||
struct Rows; | ||
|
||
impl Iterator for Rows { | ||
type Item = String; | ||
|
||
fn next() -> Option<Self::Item> { | ||
std::fmt::format(format_args!("Hello world")).into() | ||
} | ||
} | ||
|
||
fn main() { | ||
Rows.next(); | ||
} |
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,9 @@ | ||
//@ known-bug: #131295 | ||
|
||
#![feature(generic_const_exprs)] | ||
|
||
async fn foo<'a>() -> [(); { | ||
let _y: &'a (); | ||
4 | ||
}] { | ||
} |
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,12 @@ | ||
//@ known-bug: #131298 | ||
|
||
fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> { | ||
loop {} | ||
} | ||
|
||
mod typeck { | ||
type Opaque = impl Sized; | ||
fn define() -> Opaque { | ||
let _: Opaque = super::dyn_hoops::<u8>(); | ||
} | ||
} |
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,40 @@ | ||
//@ known-bug: #131342 | ||
// see also: 131342.rs | ||
|
||
fn main() { | ||
problem_thingy(Once); | ||
} | ||
|
||
struct Once; | ||
|
||
impl Iterator for Once { | ||
type Item = (); | ||
} | ||
|
||
fn problem_thingy(items: impl Iterator) { | ||
let peeker = items.peekable(); | ||
problem_thingy(&peeker); | ||
} | ||
|
||
trait Iterator { | ||
type Item; | ||
|
||
fn peekable(self) -> Peekable<Self> | ||
where | ||
Self: Sized, | ||
{ | ||
loop {} | ||
} | ||
} | ||
|
||
struct Peekable<I: Iterator> { | ||
_peeked: I::Item, | ||
} | ||
|
||
impl<I: Iterator> Iterator for Peekable<I> { | ||
type Item = I::Item; | ||
} | ||
|
||
impl<I: Iterator + ?Sized> Iterator for &I { | ||
type Item = I::Item; | ||
} |
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,16 @@ | ||
//@ known-bug: #131342 | ||
// see also: 131342-2.rs | ||
|
||
fn main() { | ||
let mut items = vec![1, 2, 3, 4, 5].into_iter(); | ||
problem_thingy(&mut items); | ||
} | ||
|
||
fn problem_thingy(items: &mut impl Iterator<Item = u8>) { | ||
let mut peeker = items.peekable(); | ||
match peeker.peek() { | ||
Some(_) => (), | ||
None => return (), | ||
} | ||
problem_thingy(&mut peeker); | ||
} |
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,9 @@ | ||
//@ known-bug: #131347 | ||
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir | ||
|
||
struct S; | ||
static STUFF: [i8] = [0; S::N]; | ||
|
||
fn main() { | ||
assert_eq!(STUFF, [0; 63]); | ||
} |
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,33 @@ | ||
//@ known-bug: #131373 | ||
|
||
trait LockReference: 'static { | ||
type Ref<'a>; | ||
} | ||
|
||
struct SliceRef<'a, T: ?Sized> { | ||
_x: &'a T, | ||
} | ||
|
||
impl<'a, T: ?Sized, SR: LockReference> IntoIterator for SliceRef<'a, T> | ||
where | ||
&'a T: IntoIterator<Item = &'a SR>, | ||
{ | ||
type Item = SR::Ref<'a>; | ||
type IntoIter = std::iter::Map<<&'a T as IntoIterator>::IntoIter, | ||
for<'c> fn(&'c SR) -> SR::Ref<'c>>; | ||
fn into_iter(self) -> Self::IntoIter { | ||
loop {} | ||
} | ||
} | ||
|
||
impl LockReference for () { | ||
type Ref<'a> = (); | ||
} | ||
|
||
fn locked() -> SliceRef<'static, [()]> { | ||
loop {} | ||
} | ||
|
||
fn main() { | ||
let _ = locked().into_iter(); | ||
} |
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,12 @@ | ||
//@ known-bug: #131406 | ||
|
||
trait Owner { | ||
const C<const N: u32>: u32 = N; | ||
} | ||
|
||
impl Owner for () {} | ||
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {} | ||
|
||
fn main() { | ||
take0::<128>(()); | ||
} |