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

Commit b91b866

Browse files
authored
Merge pull request #455 from JohnTitor/add-ices-aug
Add 5 ICEs
2 parents 02ba5d3 + 0741168 commit b91b866

File tree

6 files changed

+123
-0
lines changed

6 files changed

+123
-0
lines changed
File renamed without changes.

ices/74761.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(member_constraints)]
2+
#![feature(type_alias_impl_trait)]
3+
4+
pub trait A {
5+
type B;
6+
fn f(&self) -> Self::B;
7+
}
8+
impl<'a, 'b> A for () {
9+
type B = impl core::fmt::Debug;
10+
11+
fn f(&self) -> Self::B {}
12+
}
13+
14+
fn main() {}

ices/74816.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![feature(associated_type_defaults)]
2+
#![feature(generic_associated_types)]
3+
#![allow(incomplete_features)]
4+
5+
trait Trait1 {
6+
fn foo();
7+
}
8+
9+
trait Trait2 {
10+
type Associated: Trait1 = Self;
11+
}
12+
13+
impl Trait2 for () {}
14+
15+
fn call_foo<T: Trait2>() {
16+
T::Associated::foo()
17+
}
18+
19+
fn main() {
20+
call_foo::<()>()
21+
}

ices/74906.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
#![crate_type = "lib"]
4+
5+
pub async fn baz<const H: usize>() {
6+
biz(&Vec::new()).await;
7+
}
8+
9+
const SIZE: usize = 16;
10+
11+
pub async fn biz(_: &[[u8; SIZE]]) {}

ices/74918.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
struct ChunkingIterator<T, S: 'static + Iterator<Item = T>> {
2+
source: S,
3+
}
4+
5+
impl<T, S: Iterator<Item = T>> Iterator for ChunkingIterator<T, S> {
6+
type Item = IteratorChunk<T, S>;
7+
8+
fn next(&mut self) -> Option<IteratorChunk<T, S>> {
9+
todo!()
10+
}
11+
}
12+
13+
struct IteratorChunk<'a, T, S: Iterator<Item = T>> {
14+
source: &'a mut S,
15+
}
16+
17+
impl<T, S: Iterator<Item = T>> Iterator for IteratorChunk<'_, T, S> {
18+
type Item = T;
19+
20+
fn next(&mut self) -> Option<T> {
21+
todo!()
22+
}
23+
}
24+
25+
fn main() {}

ices/75053.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
rustc -Zmir-opt-level=2 - << EOF
4+
#![feature(type_alias_impl_trait)]
5+
6+
use std::marker::PhantomData;
7+
8+
/* copied Index and TryFrom for convinience (and simplicity) */
9+
trait MyIndex<T> {
10+
type O;
11+
fn my_index(self) -> Self::O;
12+
}
13+
trait MyFrom<T>: Sized {
14+
type Error;
15+
fn my_from(value: T) -> Result<Self, Self::Error>;
16+
}
17+
18+
/* MCVE starts here */
19+
trait F {}
20+
impl F for () {}
21+
type DummyT<T> = impl F;
22+
fn _dummy_t<T>() -> DummyT<T> {}
23+
24+
struct Phantom1<T>(PhantomData<T>);
25+
struct Phantom2<T>(PhantomData<T>);
26+
struct Scope<T>(Phantom2<DummyT<T>>);
27+
28+
impl<T> Scope<T> {
29+
fn new() -> Self {
30+
unimplemented!()
31+
}
32+
}
33+
34+
impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
35+
type Error = ();
36+
fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
37+
unimplemented!()
38+
}
39+
}
40+
41+
impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
42+
type O = T;
43+
fn my_index(self) -> Self::O {
44+
MyFrom::my_from(self.0).ok().unwrap()
45+
}
46+
}
47+
48+
fn main() {
49+
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
50+
}
51+
52+
EOF

0 commit comments

Comments
 (0)