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

Add some ICEs #627

Merged
merged 6 commits into from
Jan 30, 2021
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
21 changes: 21 additions & 0 deletions ices/80561.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#![feature(const_generics)]
#![feature(const_evaluatable_checked)]
pub struct SimpleStruct<const N: usize>([u8; N]);

impl<const N: usize> SimpleStruct<N> {
pub fn new() -> Self {
loop {}
}
}

pub trait TraitA {
const SIZE: usize;
fn zero()
where
[(); Self::SIZE]: ,
{
let _ = SimpleStruct::<{ Self::SIZE }>::new();
}
}

fn main() {}
8 changes: 8 additions & 0 deletions ices/81193.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![feature(associated_type_bounds)]
trait A<'a, 'b> {}
trait B<'a, 'b, 'c> {}
fn err<'u, 'a, F>()
where
for<'b> F: Iterator<Item: for<'c> B<'a, 'b, 'c> + for<'c> A<'a, 'c>>,
{
}
9 changes: 9 additions & 0 deletions ices/81246.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(allocator_api)]

fn ice() -> Box<(), &'static std::alloc::Global> {
todo!()
}

fn main() {
ice();
}
18 changes: 18 additions & 0 deletions ices/81270.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#![feature(allocator_api)]
fanninpm marked this conversation as resolved.
Show resolved Hide resolved
use std::alloc::{Layout, Allocator, Global, AllocError};
use std::ptr::NonNull;
use std::marker::PhantomData;

struct S<A>{ a: PhantomData<A>, b: [u8; 1] }
unsafe impl<A> Allocator for S<A> {
fn allocate(&self, _: Layout) -> Result<NonNull<[u8]>, AllocError> {
todo!();
}
unsafe fn deallocate(&self, _: NonNull<u8>, _: Layout) {
todo!();
}
}

fn main() {
let x: Box<u8, S<u8>> = Box::new_in(0, S { a: PhantomData, b: [0; 1] });
}
29 changes: 29 additions & 0 deletions ices/81403.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

rustc --emit=mir -Zmir-opt-level=2 - <<'EOF'
// build-pass
pub trait Foo<'a> {
type Bar;
fn foo(&'a self) -> Self::Bar;
}

impl<'a, 'b, T: 'a> Foo<'a> for &'b T {
type Bar = &'a T;
fn foo(&'a self) -> &'a T {
self
}
}

pub fn uncallable<T, F>(x: T, f: F)
where T: for<'a> Foo<'a>,
F: for<'a> Fn(<T as Foo<'a>>::Bar)
{
f(x.foo());
}

pub fn broken<F: Fn(&i32)>(x: &i32, f: F) {
uncallable(x, |y| f(y));
}

fn main() { }
EOF