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

Add a few ICEs and move some fixed ones around #564

Merged
merged 17 commits into from
Dec 20, 2020
21 changes: 21 additions & 0 deletions ices/51388.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

cat > bar.rs << 'EOF'
pub fn hello_world()
{
println!("hello world");
}
EOF

cat > foo.rs << 'EOF'
extern crate bar;

pub fn foo()
{
bar::hello_world();
}
EOF

rustc --crate-type rlib --emit metadata bar.rs
rustc --crate-type rlib --emit llvm-bc bar.rs
rustc --crate-type rlib --emit llvm-bc foo.rs -L .
67 changes: 67 additions & 0 deletions ices/52893.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
impl<P, T, Name, F, OLIST, FINAL> AddClass<Name, F> for Class<P, T>
where
Self: At<Name>,
<Class<P, T> as At<Name>>::AtRes: Push<F>,
<<Class<P, T> as At<Name>>::AtRes as Push<F>>::PushRes:
ToRef<Output = Class<P, OLIST>> + Push<OLIST>,
<<<Class<P, T> as At<Name>>::AtRes as Push<F>>::PushRes as Push<OLIST>>::PushRes:
Entry<Data = FINAL>,
{
type Output = Class<P, FINAL>;

fn init(self, func: F) -> Self::Output {
let builder = self.at();
let builder = builder.push(func);
let output = builder.to_ref();
builder.push(output)
}
}

struct Class<P, T> {
path: P,
data: T,
}

trait At<Name> {
type AtRes;

fn at(self) -> Self::AtRes;
}

trait Push<T> {
type PushRes;

fn push(self, other: T) -> Self::PushRes;
}

trait AddClass<Name, F> {
type Output;

fn init(self, func: F) -> Self::Output;
}

trait Entry {
type Data;
}

impl<P, T> Class<P, T> {
fn with<Name, F>(self, constructor: F) -> <Self as AddClass<Name, F>>::Output
where
Self: AddClass<Name, F>,
{
loop {}
}

fn from<F>(self, constructor: F) -> <Self as AddClass<P, F>>::Output
where
Self: AddClass<P, F>,
{
loop {}
}
}

trait ToRef {
type Output;

fn to_ref(&self) -> Self::Output;
}
42 changes: 42 additions & 0 deletions ices/67684.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

rustc - << 'EOF'
#![crate_type = "lib"]
trait ParseError {
type StreamError;
}
impl<T> ParseError for T {
type StreamError = ();
}
trait Stream {
type Error;
}
trait Parser
where
<Self as Parser>::PartialState: Default,
{
type PartialState;
fn parse_mode(&Self, Self::PartialState) {}
}
struct AndThen<A, B>(core::marker::PhantomData<(A, B)>);
impl<A, B> Parser for AndThen<A, B>
where
A: Stream,
B: Into<<A::Error as ParseError>::StreamError>,
{
type PartialState = ();
}
fn expr<A>() -> impl Parser
where
A: Stream,
{
AndThen::<A, ()>(core::marker::PhantomData)
}
fn parse_mode_impl<A>()
where
A::Error: ParseError,
A: Stream,
{
Parser::parse_mode(&expr::<A>(), Default::default())
}
EOF
9 changes: 9 additions & 0 deletions ices/73663.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
macro_rules! cbor_map {
($key:expr) => {
$key.signum();
};
}

fn main() {
cbor_map! { #[cfg(test)] 4};
}
8 changes: 8 additions & 0 deletions ices/78651.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rustc - <<EOF
use std::result;
impl result {
fn into_future() -> Err {}
}
EOF
8 changes: 8 additions & 0 deletions ices/80060.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rustc -Z mir-opt-level=2 -Z instrument-coverage - <<EOF
pub fn main() {
let c = || {};
c();
}
EOF
4 changes: 4 additions & 0 deletions ices/80062.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn sof<usize>() -> usize {}
fn test<T>() {
let _: [u8; sof::<T>()];
}
15 changes: 15 additions & 0 deletions ices/80074.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

rustc --edition=2018 -C embed-bitcode=no -C debuginfo=2 --crate-type=lib - << 'EOF'
macro_rules! foo_ { () => {}; }
use foo_ as foo;
EOF

rustc --edition=2018 -C embed-bitcode=no -C debuginfo=2 --extern test_project=$(ls librust_out.*) - << 'EOF'
#[macro_use]
extern crate test_project;

fn main() {
foo!();
}
EOF
17 changes: 17 additions & 0 deletions ices/80077.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(
const_assume,
const_evaluatable_checked,
const_generics,
use std::intrinsics::assume;
)]
#![allow(incomplete_features)]

const fn foo(n: usize) -> usize { n }

pub struct Bar<const N: usize>(usize);

impl<const N: usize> Bar<N> where [(); foo(N)]: {
fn spam(i: usize) { }
}

fn main() {}
10 changes: 10 additions & 0 deletions ices/80125.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type ExternCallback = extern "C" fn(*const u8, u32, str);

pub struct Struct(ExternCallback);

#[no_mangle]
pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
Struct(bind)
}

fn main() {}
6 changes: 6 additions & 0 deletions ices/80134.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
let matches = App::new()
.arg(
Arg::with_name(OPT_MODE)é
);
}