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

Commit ea6dc9a

Browse files
fanninpmJohnTitor
andauthored
Add some ICEs (#670)
Co-authored-by: Yuki Okushi <[email protected]>
1 parent 1e4e601 commit ea6dc9a

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed

ices/77708.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
rustc --edition 2018 -C incremental=foo --crate-type lib - <<'EOF'
4+
#![feature(const_generics, const_evaluatable_checked)]
5+
#![allow(incomplete_features)]
6+
use core::{convert::TryFrom, num::NonZeroUsize};
7+
8+
struct A<const N: NonZeroUsize>([u8; N.get()]) where [u8; N.get()]: Sized;
9+
10+
impl<'a, const N: NonZeroUsize> TryFrom<&'a [u8]> for A<N> where [u8; N.get()]: Sized {
11+
type Error = ();
12+
fn try_from(slice: &'a [u8]) -> Result<A<N>, ()> {
13+
let _x = <&[u8; N.get()] as TryFrom<&[u8]>>::try_from(slice);
14+
unimplemented!();
15+
}
16+
}
17+
EOF

ices/82418.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(const_generics)]
2+
#![feature(const_evaluatable_checked)]
3+
4+
pub struct Foobar<T, const N: usize> {
5+
t: T,
6+
}
7+
8+
pub trait Footrait {
9+
const N: usize;
10+
}
11+
12+
impl<T> Footrait for T {
13+
const N: usize = 0;
14+
}
15+
16+
pub fn new_foo<T>(t: T) -> Foobar<T, { <T as Footrait>::N }>
17+
where
18+
T: Footrait,
19+
{
20+
Foobar { t }
21+
}
22+
23+
fn main() {
24+
let foo = new_foo(0);
25+
}

ices/82438.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn main() {
2+
let inner;
3+
let outer = || {
4+
inner = || {};
5+
inner();
6+
};
7+
outer();
8+
}

ices/82455.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn map<T>(_: fn() -> Option<&'static T>) -> Option<T> {
2+
None
3+
}
4+
5+
fn value() -> Option<&'static _> {
6+
Option::<&'static u8>::None
7+
}
8+
9+
const _: Option<_> = {
10+
let _: Option<_> = map(value);
11+
};

ices/82504.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![crate_type = "lib"]
2+
#![feature(decl_macro)]
3+
4+
pub mod module {
5+
mod private {
6+
__helper__! { [$] recurse }
7+
8+
macro __helper__ ([$dol:tt] $exported_name:ident) {
9+
macro_rules! $exported_name {() => ()}
10+
pub(crate) use $exported_name;
11+
}
12+
// pub(crate) use recurse;
13+
}
14+
pub(super) use private::recurse;
15+
}
16+
17+
module::recurse!();

0 commit comments

Comments
 (0)