Skip to content

Commit

Permalink
Add some ICEs
Browse files Browse the repository at this point in the history
- rust-lang/rust#99173
- rust-lang/rust#103708
- rust-lang/rust#104827
- rust-lang/rust#105209
- rust-lang/rust#106298
- rust-lang/rust#106423

Signed-off-by: Yuki Okushi <jtitor@2k36.org>

rust-lang/rust#99173
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor committed Jan 14, 2023
1 parent 7beb5e5 commit 6103eea
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ices/103708.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(min_specialization)]

trait Dance {}

impl<'a, T> Dance for T {}

impl Dance for bool {}

fn main() {}
15 changes: 15 additions & 0 deletions ices/104827.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(try_trait_v2)]

use std::ops::FromResidual;

struct MySnafu;

fn test_function() {
impl FromResidual for MySnafu {
fn from_residual(s: Self) -> Self {
todo!()
}
}
}

fn main() {}
5 changes: 5 additions & 0 deletions ices/105209.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

rustc -Zunpretty=ast-tree - << EOF
#![c={#![c[)x
EOF
50 changes: 50 additions & 0 deletions ices/106298.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

cat > Cargo.toml <<'EOF'
[package]
name = "alba"
version = "0.0.1"
edition = "2021"
[dependencies]
sera = { path = "sera/" }
EOF

mkdir -p src sera/src

cat > sera/Cargo.toml <<'EOF'
[package]
name = "sera"
version = "0.0.1"
edition = "2021"
[lib]
crate-type = ["proc-macro"]
EOF

cat > sera/src/lib.rs << EOF
extern crate proc_macro;
struct PanicOnDrop;
impl Drop for PanicOnDrop {
fn drop(&mut self) { panic!("panic on drop!"); }
}
#[proc_macro_derive(Panic)]
pub fn derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let _p_on_d = PanicOnDrop;
panic!("panic during panic-during-expand's derive")
}
EOF

cat > src/main.rs << EOF
#[macro_use]
extern crate sena;
#[derive(sena::Panic)]
struct S { x: u8 }
fn main() {}
EOF

cargo check
52 changes: 52 additions & 0 deletions ices/106423.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#![feature(generic_const_exprs, generic_arg_infer)]
#![allow(incomplete_features)]
#![allow(unused)]

use std::mem::MaybeUninit;

pub struct Arr<T, const N: usize> {
v: [MaybeUninit<T>; N],
}

impl<T, const N: usize> Arr<T, N> {
const ELEM: MaybeUninit<T> = MaybeUninit::uninit();
const INIT: [MaybeUninit<T>; N] = [Self::ELEM; N]; // important for optimization of `new`

fn new() -> Self {
Arr { v: Self::INIT }
}
}

pub struct BaFormatFilter<const N: usize> {}

pub enum DigitalFilter<const N: usize>
where
[(); N * 2 + 1]: Sized,
[(); N * 2]: Sized,
{
Ba(BaFormatFilter<{ N * 2 + 1 }>),
}

pub fn iirfilter_st_copy<const N: usize, const M: usize>(_: [f32; M]) -> DigitalFilter<N>
where
[(); N * 2 + 1]: Sized,
[(); N * 2]: Sized,
{
let zpk = zpk2tf_st(&Arr::<f32, { N * 2 }>::new(), &Arr::<f32, { N * 2 }>::new());
DigitalFilter::Ba(zpk)
}

pub fn zpk2tf_st<const N: usize>(
_z: &Arr<f32, N>,
_p: &Arr<f32, N>,
) -> BaFormatFilter<{ N + 1 }>
where
[(); N + 1]: Sized,
{
BaFormatFilter {}
}


fn main() {
iirfilter_st_copy::<4, 2>([10., 50.,]);
}
49 changes: 49 additions & 0 deletions ices/99173.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

cat > Cargo.toml <<'EOF'
[package]
name = "alba"
version = "0.0.1"
edition = "2021"
[dependencies]
sera = { path = "sera/" }
EOF

mkdir -p src sera/src

cat > sera/Cargo.toml <<'EOF'
[package]
name = "sera"
version = "0.0.1"
edition = "2021"
[lib]
crate-type = ["proc-macro"]
EOF

cat > sera/src/lib.rs << EOF
extern crate proc_macro;
#[proc_macro]
pub fn ignore(input: TokenStream) -> TokenStream {
let mut result : TokenStream = TokenStream::new();
result.into()
}
#[proc_macro]
pub fn this_fails(input: TokenStream) -> TokenStream {
let mut result : TokenStream = TokenStream::new();
result.extend::<TokenStream>("metamodel_macros::ignore!(42).into()".parse().unwrap());
result.into()
}
EOF

cat > src/main.rs << EOF
#[test]
pub fn bug_report() {
sera::this_fails!(1*2*3*7);
}
EOF

cargo test

0 comments on commit 6103eea

Please sign in to comment.