diff --git a/tests/crashes/132765.rs b/tests/crashes/132765.rs new file mode 100644 index 0000000000000..01e8fdaacff77 --- /dev/null +++ b/tests/crashes/132765.rs @@ -0,0 +1,12 @@ +//@ known-bug: #132765 + +trait LendingIterator { + type Item<'q>; + fn for_each(&self, _f: Box)>) {} +} + +fn f(_: ()) {} + +fn main() { + LendingIterator::for_each(&(), f); +} diff --git a/tests/crashes/132766.rs b/tests/crashes/132766.rs new file mode 100644 index 0000000000000..5f5117d77a521 --- /dev/null +++ b/tests/crashes/132766.rs @@ -0,0 +1,9 @@ +//@ known-bug: #132766 + +trait Trait {} +impl<'a> Trait for () { + fn pass2<'a>() -> impl Trait2 {} +} + +trait Trait2 {} +impl Trait2 for () {} diff --git a/tests/crashes/132767.rs b/tests/crashes/132767.rs new file mode 100644 index 0000000000000..1135261a9b4c7 --- /dev/null +++ b/tests/crashes/132767.rs @@ -0,0 +1,24 @@ +//@ known-bug: #132767 + +trait Func { + type Ret; +} +impl R, R> Func for F { + type Ret = R; +} + +trait Id {} +fn invalid_impl_trait() -> impl Id {} + +struct Foo { + _func: T, + value: Option<::Ret>, +} + +fn main() { + let foo = Foo { + _func: invalid_impl_trait, + value: None, + }; + drop(foo.value); +} diff --git a/tests/crashes/132882.rs b/tests/crashes/132882.rs new file mode 100644 index 0000000000000..6b5e4dba803b0 --- /dev/null +++ b/tests/crashes/132882.rs @@ -0,0 +1,13 @@ +//@ known-bug: #132882 + +use std::ops::Add; + +pub trait Numoid +where + for &'a Self: Add, +{ +} + +pub fn compute(a: N) -> N { + &a + a +} diff --git a/tests/crashes/132981.rs b/tests/crashes/132981.rs new file mode 100644 index 0000000000000..36808ac91e2fc --- /dev/null +++ b/tests/crashes/132981.rs @@ -0,0 +1,5 @@ +//@ known-bug: #132981 +//@compile-flags: -Clink-dead-code=true --crate-type lib + +#![feature(rust_cold_cc)] +pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/crashes/133056.rs b/tests/crashes/133056.rs new file mode 100644 index 0000000000000..3fb6954d3e7ba --- /dev/null +++ b/tests/crashes/133056.rs @@ -0,0 +1,26 @@ +//@ known-bug: #133056 + +pub enum ApiError {} +pub struct TokioError { + source: ApiError, +} +pub enum Error { + Api { b: bool }, + Ethereum, + Tokio { source: TokioError }, +} + +mod assert { + use std::mem::TransmuteFrom; + + pub fn is_transmutable() + where + Dst: TransmuteFrom, + { + } +} + +fn test() { + type Dst = Error; + assert::is_transmutable::(); +} diff --git a/tests/crashes/133063.rs b/tests/crashes/133063.rs new file mode 100644 index 0000000000000..132b5486170a8 --- /dev/null +++ b/tests/crashes/133063.rs @@ -0,0 +1,8 @@ +//@ known-bug: #133063 + +fn foo(x: !) { + match x { + (! | !) if false => {} + _ => {} + } +} diff --git a/tests/crashes/133065.rs b/tests/crashes/133065.rs new file mode 100644 index 0000000000000..69c7a2ed3f128 --- /dev/null +++ b/tests/crashes/133065.rs @@ -0,0 +1,15 @@ +//@ known-bug: #133065 +//@compile-flags: -Zvalidate-mir -Zinline-mir -Zinline-mir-threshold=300 +trait Bar: Sized { + fn bar(self) {} +} + +impl Bar for T { + fn bar() { + let _ = "Hello".bytes().nth(3); + } +} + +fn main() { + ().bar(); +} diff --git a/tests/crashes/133066.rs b/tests/crashes/133066.rs new file mode 100644 index 0000000000000..732ebb7079fd0 --- /dev/null +++ b/tests/crashes/133066.rs @@ -0,0 +1,12 @@ +//@ known-bug: #133066 +trait Owner { + const C: u32; +} + +impl Owner for () {;} + +fn take0(_: impl Owner = { N }>) {} + +fn main() { + take0::(()); +} diff --git a/tests/crashes/133199.rs b/tests/crashes/133199.rs new file mode 100644 index 0000000000000..76535fa83a6d0 --- /dev/null +++ b/tests/crashes/133199.rs @@ -0,0 +1,11 @@ +//@ known-bug: #133199 +//@ aux-build: aux133199.rs + +extern crate aux133199; + +use aux133199::FixedBitSet; + +fn main() { + FixedBitSet::<7>::new(); + //~^ ERROR +} diff --git a/tests/crashes/133275-1.rs b/tests/crashes/133275-1.rs new file mode 100644 index 0000000000000..73c04f5d6e410 --- /dev/null +++ b/tests/crashes/133275-1.rs @@ -0,0 +1,13 @@ +//@ known-bug: #133275 +#![feature(const_trait_impl)] +#![feature(associated_type_defaults)] + +#[const_trait] +trait Foo3 +where + Self::Baz: Clone, +{ + type Baz = T; +} + +pub fn main() {} diff --git a/tests/crashes/133275-2.rs b/tests/crashes/133275-2.rs new file mode 100644 index 0000000000000..a774b3cdb6905 --- /dev/null +++ b/tests/crashes/133275-2.rs @@ -0,0 +1,15 @@ +//@ known-bug: #133275 +#![feature(const_trait_impl)] +#[const_trait] +pub trait Owo::T> {} + +#[const_trait] +trait Foo3 +where + Self::Bar: Clone, + Self::Baz: Clone, +{ + type Bar = Vec; + type Baz = T; + //~^ ERROR the trait bound `T: Clone` is not satisfied +} diff --git a/tests/crashes/auxiliary/aux133199.rs b/tests/crashes/auxiliary/aux133199.rs new file mode 100644 index 0000000000000..40765d92fbfe9 --- /dev/null +++ b/tests/crashes/auxiliary/aux133199.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +pub struct FixedBitSet; + +impl FixedBitSet +where + [u8; N.div_ceil(8)]: Sized, +{ + pub fn new() -> Self { + todo!() + } +}