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

add more ICEs #1052

Merged
merged 1 commit into from
Dec 13, 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
7 changes: 7 additions & 0 deletions ices/91370.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extern {
fn r() {
impl Copy for u8 {}
}
}

pub fn main() {}
23 changes: 23 additions & 0 deletions ices/91745.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

rustc -Zmir-opt-level=3 --crate-type lib - <<'EOF'
pub trait Foo {
type Bar;
}

pub trait Broken {
type Assoc;
fn broken(&self) where Self::Assoc: Foo;
}

impl<T> Broken for T {
type Assoc = ();
fn broken(&self) where Self::Assoc: Foo {
let _x: <Self::Assoc as Foo>::Bar;
}
}

fn main() {
let _m: &dyn Broken<Assoc=()> = &();
}
EOF
20 changes: 20 additions & 0 deletions ices/91801-0.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pub struct Something;

type Validator<'a> = dyn 'a + Send + Sync + Fn(&'a Something) -> Result<(), ()>;

pub static ALL_VALIDATORS: &[(&'static str, &'static Validator)] = &[(
"validate that credits and debits balance",
&validate_something,
)];

fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Validator<'a> {
return Box::new(move |something: &'_ Something| -> Result<(), ()> {
first(something).or_else(|_| second(something))
})
}

fn validate_something(_: &Something) -> Result<(), ()> {
Ok(())
}

fn main() {}
5 changes: 5 additions & 0 deletions ices/91801-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn or<'a>(first: &'static (dyn Fn(&'a i32))) -> dyn 'a + Fn(&'a i32) {
return Box::new(panic!());
}

fn main() {}
7 changes: 7 additions & 0 deletions ices/91803.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trait Foo<'a> {}

fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> {
return Box::new(panic!());
}

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

extern "C" {
type Content;
}

pub struct List {
len: usize,
_opaque: Content,
}

pub fn main() {
let _len = match Option::<&List>::None {
Some(a) => a.len,
None => 0,
};
}
17 changes: 17 additions & 0 deletions ices/91827-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(extern_types)]

extern "C" {
type Content;
}

pub struct List {
len: usize,
_opaque: Content,
}

pub const Z: usize = {
let a = [0usize; 4];
unsafe { &*(&a as *const _ as *const List) }.len
};

pub fn main() {}