Skip to content

Commit

Permalink
add 5 ices
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Aug 19, 2022
1 parent f913963 commit 2291d39
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ices/100463.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
struct Foo<T> {
inner: Vec<T>,
}

impl<T> Foo<T> {
fn get(&self) -> impl Iterator<Item = &T> {
self.inner.iter()
}
}

fn main() {
let foo: Foo<()> = Foo { inner: Vec::new() };
let vals: Vec<_> = foo.get();
}
31 changes: 31 additions & 0 deletions ices/100550.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

rustc -Copt-level=2 --crate-type lib - <<'EOF'
pub trait Trait {
type Associated;
}
impl<T> Trait for T {
type Associated = T;
}
pub struct Struct<T>(<T as Trait>::Associated);
pub fn foo<T>() -> Struct<T>
where
T: Trait,
{
bar()
}
#[inline]
fn bar<T>() -> Struct<T> {
Struct(baz())
}
fn baz<T>() -> T {
unimplemented!()
}
EOF

25 changes: 25 additions & 0 deletions ices/100612.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

rustc "-Cdebuginfo=2" - <<'EOF'
// run-pass
#![feature(repr128, arbitrary_enum_discriminant)]
//~^ WARN the feature `repr128` is incomplete
#[derive(PartialEq, Debug)]
#[repr(i128)]
enum Test {
A(Box<u64>) = 0,
B(usize) = u64::MAX as i128 + 1,
}
fn main() {
assert_ne!(Test::A(Box::new(2)), Test::B(0));
// This previously caused a segfault.
//
// See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186
// for a detailed explanation.
}
EOF

15 changes: 15 additions & 0 deletions ices/100672.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(generic_associated_types)]

trait Bar<'a> {
type Ref<'b>
where
'a: 'b;
fn uwu(f: impl Fn(Self::Ref<'_>));
}

impl<'a> Bar<'a> for () {
type Ref<'b> = () where 'a: 'b;
fn uwu(f: impl Fn(())) {}
}

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

struct Foo<'a> {
foo: &'a mut usize,
}

trait Bar<'a> {
type FooRef<'b>
where
'a : 'b,
;
fn uwu (
foo: Foo<'a>,
f: impl for<'b> FnMut(Self::FooRef<'b>),
)
;
}
impl<'a> Bar<'a> for () {
type FooRef<'b>
=
&'b Foo<'a>
where
'a : 'b,
;

fn uwu (
foo: Foo<'a>,
mut f: impl for<'b> FnMut(&'b Foo<'a>), //relevant part
)
{
f(&foo);
}
}

fn main() {}

0 comments on commit 2291d39

Please sign in to comment.