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

add 5 ices #1390

Merged
merged 2 commits into from
Aug 20, 2022
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
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() {}
File renamed without changes.