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

Add more ICEs #244

Merged
merged 2 commits into from
Jan 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ices/66930.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![crate_type = "lib"]

static UTF8_CHAR_WIDTH: [u8; 0] = [];

pub fn utf8_char_width(b: u8) -> usize {
UTF8_CHAR_WIDTH[b as usize] as usize
}
5 changes: 5 additions & 0 deletions ices/67514.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![feature(or_patterns)]

fn foo((Some(_) | None): Option<u32>) {}

fn main() {}
27 changes: 27 additions & 0 deletions ices/67552.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
fn main() {
rec(Empty);
}

struct Empty;

impl Iterator for Empty {
type Item = ();
fn next<'a>(&'a mut self) -> core::option::Option<()> {
None
}
}

fn identity<T>(x: T) -> T {
x
}

fn rec<T>(mut it: T)
where
T: Iterator,
{
if () == () {
T::count(it);
} else {
rec(identity(&mut it))
}
}
15 changes: 15 additions & 0 deletions ices/67739.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![allow(incomplete_features)]
#![feature(const_generics)]

use std::mem;

pub trait Trait {
type Associated : Sized;

fn associated_size(&self) -> usize {
[0u8; mem::size_of::<Self::Associated>()];
0
}
}

fn main() {}
25 changes: 25 additions & 0 deletions ices/67830.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
trait MyFn<Arg> {
type Output;
fn call(&self, arg: Arg) -> Self::Output;
}

struct Wrap<F>(F);

impl<A, B, F> MyFn<A> for Wrap<F>
where
F: Fn(A) -> B
{
type Output = B;

fn call(&self, arg: A) -> Self::Output {
(self.0)(arg)
}
}


struct A;
fn test() -> impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a> {
Wrap(|a| Some(a).into_iter())
}

fn main() {}
9 changes: 9 additions & 0 deletions ices/67844.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
trait WithAssoc { type AssocType; }

trait WithParam<A> {}

type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;

fn my_fun() -> Return<()> {}

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

trait MyTrait {}
impl MyTrait for () {}

impl<F> FnOnce<()> for &F {
type Output = impl MyTrait ;
fn call_once(self, _:() ) -> Self::Output { }
}

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

pub trait Trait {
type Associated;
}

pub struct Foo<T, A = <T as Trait>::Associated, const N: u8>(T, A);

impl<T: Trait, const N: u8> Foo<T, N> {
}

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

struct Caca<const A: &'static str> {
s: String
}

impl<const A: &str> Default for Caca<A> {
fn default() -> Self {
let a = Self::A;
Self {
s: A.to_string()
}
}
}

fn main() {
println!("Hello, world!");
}