Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit e0f2794

Browse files
JohnTitorAlexendoo
authored andcommitted
Add more ICEs (#244)
* Add more ICEs * code review
1 parent d215287 commit e0f2794

File tree

9 files changed

+132
-0
lines changed

9 files changed

+132
-0
lines changed

ices/66930.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_type = "lib"]
2+
3+
static UTF8_CHAR_WIDTH: [u8; 0] = [];
4+
5+
pub fn utf8_char_width(b: u8) -> usize {
6+
UTF8_CHAR_WIDTH[b as usize] as usize
7+
}

ices/67514.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(or_patterns)]
2+
3+
fn foo((Some(_) | None): Option<u32>) {}
4+
5+
fn main() {}

ices/67552.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
fn main() {
2+
rec(Empty);
3+
}
4+
5+
struct Empty;
6+
7+
impl Iterator for Empty {
8+
type Item = ();
9+
fn next<'a>(&'a mut self) -> core::option::Option<()> {
10+
None
11+
}
12+
}
13+
14+
fn identity<T>(x: T) -> T {
15+
x
16+
}
17+
18+
fn rec<T>(mut it: T)
19+
where
20+
T: Iterator,
21+
{
22+
if () == () {
23+
T::count(it);
24+
} else {
25+
rec(identity(&mut it))
26+
}
27+
}

ices/67739.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![allow(incomplete_features)]
2+
#![feature(const_generics)]
3+
4+
use std::mem;
5+
6+
pub trait Trait {
7+
type Associated : Sized;
8+
9+
fn associated_size(&self) -> usize {
10+
[0u8; mem::size_of::<Self::Associated>()];
11+
0
12+
}
13+
}
14+
15+
fn main() {}

ices/67830.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
trait MyFn<Arg> {
2+
type Output;
3+
fn call(&self, arg: Arg) -> Self::Output;
4+
}
5+
6+
struct Wrap<F>(F);
7+
8+
impl<A, B, F> MyFn<A> for Wrap<F>
9+
where
10+
F: Fn(A) -> B
11+
{
12+
type Output = B;
13+
14+
fn call(&self, arg: A) -> Self::Output {
15+
(self.0)(arg)
16+
}
17+
}
18+
19+
20+
struct A;
21+
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
22+
Wrap(|a| Some(a).into_iter())
23+
}
24+
25+
fn main() {}

ices/67844.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
trait WithAssoc { type AssocType; }
2+
3+
trait WithParam<A> {}
4+
5+
type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;
6+
7+
fn my_fun() -> Return<()> {}
8+
9+
fn main() {}

ices/67856.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(unboxed_closures)]
2+
#![feature(type_alias_impl_trait)]
3+
#![feature(fn_traits)]
4+
5+
trait MyTrait {}
6+
impl MyTrait for () {}
7+
8+
impl<F> FnOnce<()> for &F {
9+
type Output = impl MyTrait ;
10+
fn call_once(self, _:() ) -> Self::Output { }
11+
}
12+
13+
fn main() {}

ices/67858.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
pub trait Trait {
5+
type Associated;
6+
}
7+
8+
pub struct Foo<T, A = <T as Trait>::Associated, const N: u8>(T, A);
9+
10+
impl<T: Trait, const N: u8> Foo<T, N> {
11+
}
12+
13+
fn main() {}

ices/67883.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(const_generics)]
2+
3+
struct Caca<const A: &'static str> {
4+
s: String
5+
}
6+
7+
impl<const A: &str> Default for Caca<A> {
8+
fn default() -> Self {
9+
let a = Self::A;
10+
Self {
11+
s: A.to_string()
12+
}
13+
}
14+
}
15+
16+
fn main() {
17+
println!("Hello, world!");
18+
}

0 commit comments

Comments
 (0)