mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
more ice tests
This commit is contained in:
parent
55cac26a9e
commit
ff096f83f7
11
tests/crashes/126062.rs
Normal file
11
tests/crashes/126062.rs
Normal file
@ -0,0 +1,11 @@
|
||||
//@ known-bug: rust-lang/rust#126062
|
||||
struct Fail<T>(Fail);
|
||||
impl<T> Fail<i32> {
|
||||
const C: () = panic!();
|
||||
}
|
||||
|
||||
fn f<T>() {
|
||||
if false {
|
||||
let _val = &Fail::<T>::C;
|
||||
}
|
||||
}
|
23
tests/crashes/126148.rs
Normal file
23
tests/crashes/126148.rs
Normal file
@ -0,0 +1,23 @@
|
||||
//@ known-bug: rust-lang/rust#126148
|
||||
|
||||
#![feature(effects)]
|
||||
use std::ops::{FromResidual, Try};
|
||||
|
||||
struct TryMe;
|
||||
struct Error;
|
||||
|
||||
impl const FromResidual<Error> for TryMe {}
|
||||
|
||||
impl const Try for TryMe {
|
||||
type Output = ();
|
||||
type Residual = Error;
|
||||
}
|
||||
|
||||
const fn t() -> TryMe {
|
||||
TryMe?;
|
||||
TryMe
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
t();
|
||||
};
|
10
tests/crashes/126182.rs
Normal file
10
tests/crashes/126182.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//@ known-bug: rust-lang/rust#126182
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct Cond<const B: bool>;
|
||||
|
||||
struct Thing<T = Cond<0>>(T);
|
||||
|
||||
impl Thing {}
|
30
tests/crashes/126267.rs
Normal file
30
tests/crashes/126267.rs
Normal file
@ -0,0 +1,30 @@
|
||||
//@ known-bug: rust-lang/rust#126267
|
||||
|
||||
#![feature(transmutability)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub enum ApiError {}
|
||||
pub struct TokioError {
|
||||
b: bool,
|
||||
}
|
||||
pub enum Error {
|
||||
Api { source: ApiError },
|
||||
Ethereum,
|
||||
Tokio { source: TokioError },
|
||||
}
|
||||
|
||||
mod assert {
|
||||
use std::mem::BikeshedIntrinsicFrom;
|
||||
|
||||
pub fn is_transmutable<Src, Dst>()
|
||||
where
|
||||
Dst: BikeshedIntrinsicFrom<Src>, // safety is NOT assumed
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
fn test() {
|
||||
struct Src;
|
||||
type Dst = Error;
|
||||
assert::is_transmutable::<Src, Dst>();
|
||||
}
|
12
tests/crashes/126269.rs
Normal file
12
tests/crashes/126269.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//@ known-bug: rust-lang/rust#126269
|
||||
#![feature(coerce_unsized)]
|
||||
|
||||
pub enum Foo<T> {
|
||||
Bar([T; usize::MAX]),
|
||||
}
|
||||
|
||||
use std::ops::CoerceUnsized;
|
||||
|
||||
impl<T, U> CoerceUnsized<U> for T {}
|
||||
|
||||
fn main() {}
|
28
tests/crashes/126272.rs
Normal file
28
tests/crashes/126272.rs
Normal file
@ -0,0 +1,28 @@
|
||||
//@ known-bug: rust-lang/rust#126272
|
||||
|
||||
#![feature(adt_const_params)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use std::marker::ConstParamTy;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, ConstParamTy)]
|
||||
struct Foo {
|
||||
value: i32,
|
||||
nested: &'static Bar<std::fmt::Debug>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, ConstParamTy)]
|
||||
struct Bar<T>(T);
|
||||
|
||||
struct Test<const F: Foo>;
|
||||
|
||||
fn main() {
|
||||
let x: Test<
|
||||
{
|
||||
Foo {
|
||||
value: 3,
|
||||
nested: &Bar(4),
|
||||
}
|
||||
},
|
||||
> = Test;
|
||||
}
|
9
tests/crashes/126359.rs
Normal file
9
tests/crashes/126359.rs
Normal file
@ -0,0 +1,9 @@
|
||||
//@ known-bug: rust-lang/rust#126359
|
||||
|
||||
struct OppOrder<const N: u8 = 3, T = u32> {
|
||||
arr: [T; N],
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = OppOrder::<3, u32> { arr: [0, 0, 0] };
|
||||
}
|
14
tests/crashes/126376.rs
Normal file
14
tests/crashes/126376.rs
Normal file
@ -0,0 +1,14 @@
|
||||
//@ known-bug: rust-lang/rust#126376
|
||||
mod a {
|
||||
pub mod b {
|
||||
pub mod c {
|
||||
pub trait D {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use a::*;
|
||||
use e as b;
|
||||
use b::c::D as e;
|
||||
|
||||
fn e() {}
|
29
tests/crashes/126377.rs
Normal file
29
tests/crashes/126377.rs
Normal file
@ -0,0 +1,29 @@
|
||||
//@ known-bug: rust-lang/rust#126377
|
||||
|
||||
#![feature(effects)]
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
mod assert {
|
||||
use std::mem::{Assume, BikeshedIntrinsicFrom};
|
||||
|
||||
pub fn is_transmutable<
|
||||
Src,
|
||||
Dst,
|
||||
const ASSUME_ALIGNMENT: bool,
|
||||
const ASSUME_LIFETIMES: bool,
|
||||
const ASSUME_SAFETY: bool,
|
||||
const ASSUME_VALIDITY: bool,
|
||||
>()
|
||||
where
|
||||
Dst: BikeshedIntrinsicFrom<
|
||||
Src,
|
||||
{ }
|
||||
>,
|
||||
{}
|
||||
}
|
||||
|
||||
const fn from_options() -> Assume {
|
||||
#[repr(C)] struct Src;
|
||||
#[repr(C)] struct Dst;
|
||||
assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>();
|
||||
}
|
10
tests/crashes/126385.rs
Normal file
10
tests/crashes/126385.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//@ known-bug: rust-lang/rust#126385
|
||||
pub struct MyStruct<'field> {
|
||||
field: &'_ [u32],
|
||||
}
|
||||
|
||||
impl MyStruct<'_> {
|
||||
pub fn _<'a>(field: &'a[u32]) -> Self<new> {
|
||||
Self{field}
|
||||
}
|
||||
}
|
15
tests/crashes/126389.rs
Normal file
15
tests/crashes/126389.rs
Normal file
@ -0,0 +1,15 @@
|
||||
//@ known-bug: rust-lang/rust#126389
|
||||
|
||||
mod a {
|
||||
pub mod b {
|
||||
pub mod c {}
|
||||
}
|
||||
}
|
||||
|
||||
use a::*;
|
||||
|
||||
use b::c;
|
||||
|
||||
use c as b;
|
||||
|
||||
fn c() {}
|
20
tests/crashes/126416.rs
Normal file
20
tests/crashes/126416.rs
Normal file
@ -0,0 +1,20 @@
|
||||
//@ known-bug: rust-lang/rust#126416
|
||||
|
||||
trait Output<'a, T: 'a> {
|
||||
type Type;
|
||||
}
|
||||
|
||||
struct Wrapper;
|
||||
|
||||
impl Wrapper {
|
||||
fn do_something_wrapper<O, F>(&mut self, _: F)
|
||||
where
|
||||
F: for<'a> FnOnce(<F as Output<i32>>::Type),
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut wrapper = Wrapper;
|
||||
wrapper.do_something_wrapper(|value| ());
|
||||
}
|
11
tests/crashes/126521.rs
Normal file
11
tests/crashes/126521.rs
Normal file
@ -0,0 +1,11 @@
|
||||
//@ known-bug: rust-lang/rust#126521
|
||||
macro_rules! foo {
|
||||
($val:ident) => {
|
||||
true;
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[expect(semicolon_in_expressions_from_macros)]
|
||||
let _ = foo!(x);
|
||||
}
|
Loading…
Reference in New Issue
Block a user