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

Commit 23f85bf

Browse files
authored
Merge pull request #1472 from JohnTitor/add-ices-20221222
2 parents a5f95bf + f42bc9e commit 23f85bf

File tree

11 files changed

+200
-0
lines changed

11 files changed

+200
-0
lines changed

ices/104736.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
rustc -C opt-level=3 - << EOF
4+
#![crate_type = "lib"]
5+
6+
pub struct A;
7+
pub struct B;
8+
9+
impl Drop for A {
10+
fn drop(&mut self) {}
11+
}
12+
impl Drop for B {
13+
fn drop(&mut self) {}
14+
}
15+
16+
#[inline(always)]
17+
pub fn no_unwind() {}
18+
19+
pub fn weird_temporary(a: A, b: B, nothing: ((), (), ()), x: bool) -> ((), (), ()) {
20+
'scope: {
21+
(
22+
{
23+
let _z = b;
24+
if x {
25+
break 'scope nothing;
26+
}
27+
},
28+
match { a } {
29+
_ => (),
30+
},
31+
no_unwind(),
32+
)
33+
}
34+
}
35+
36+
EOF

ices/105238-1.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![allow(incomplete_features)]
2+
#![feature(generic_const_exprs)]
3+
4+
trait Ret {
5+
type R;
6+
}
7+
8+
struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>, std::marker::PhantomData<V>);
9+
10+
impl<U, V> Ret for Cond<true, U, V> {
11+
type R = U;
12+
}
13+
14+
impl<U, V> Ret for Cond<false, U, V> {
15+
type R = V;
16+
}
17+
18+
struct RobinHashTable<const MAX_LENGTH: usize, CellIdx = Cond<{ MAX_LENGTH < 65535 }, u16, u32>>
19+
where
20+
CellIdx: Ret,
21+
{
22+
_idx: CellIdx::R,
23+
}
24+
25+
fn main() {
26+
use std::mem::size_of;
27+
println!("{}", size_of::<RobinHashTable<1024>>());
28+
println!("{}", size_of::<RobinHashTable<65536>>());
29+
}

ices/105238-2.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![allow(incomplete_features)]
2+
#![feature(generic_const_exprs)]
3+
4+
trait Ret {
5+
type R;
6+
}
7+
8+
struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>, std::marker::PhantomData<V>);
9+
10+
impl<U, V> Ret for Cond<true, U, V> {
11+
type R = U;
12+
}
13+
14+
impl<U, V> Ret for Cond<false, U, V> {
15+
type R = V;
16+
}
17+
18+
struct RobinHashTable<
19+
const MAX_LENGTH: usize,
20+
CellIdx = <Cond<{ MAX_LENGTH < 65535 }, u16, u32> as Ret>::R,
21+
> {
22+
_idx: CellIdx,
23+
}
24+
25+
fn main() {
26+
use std::mem::size_of;
27+
println!("{}", size_of::<RobinHashTable<1024>>());
28+
println!("{}", size_of::<RobinHashTable<65536>>());
29+
}

ices/105249.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
rustc -Zpolymorphize=on - << EOF
4+
trait Foo<T> {
5+
fn print<'a>(&'a self) where T: 'a { println!("foo"); }
6+
}
7+
8+
impl<'a> Foo<&'a ()> for () { }
9+
10+
trait Bar: for<'a> Foo<&'a ()> { }
11+
12+
impl Bar for () {}
13+
14+
fn main() {
15+
(&() as &dyn Bar).print(); // Segfault
16+
}
17+
18+
EOF

ices/105488.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
pub trait MyFnOnce {
2+
type Output;
3+
4+
fn call_my_fn_once(self) -> Self::Output;
5+
}
6+
7+
pub struct WrapFnOnce<F>(F);
8+
9+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
10+
type Output = D::Output;
11+
12+
fn call_my_fn_once(self) -> Self::Output {
13+
D::call_my_fn_once(self.0())
14+
}
15+
}
16+
17+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for F {
18+
type Output = D::Output;
19+
20+
fn call_my_fn_once(self) -> Self::Output {
21+
D::call_my_fn_once(self())
22+
}
23+
}
24+
25+
pub fn my_fn_1() -> impl MyFnOnce {
26+
my_fn_2
27+
}
28+
29+
pub fn my_fn_2() -> impl MyFnOnce {
30+
WrapFnOnce(my_fn_1)
31+
}
32+
33+
fn main() {
34+
let v = my_fn_1();
35+
36+
let _ = v.call_my_fn_once();
37+
}

ices/105631.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(generic_const_exprs)]
2+
3+
struct A<const B: str = 1, C>;
4+
5+
fn main() {}

ices/105700.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![recursion_limit="4"]
2+
#![k1]
3+
#![k2]
4+
#![k3]
5+
#![k4]
6+
#![k5]
7+
8+
fn main() {}

ices/105709.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(generic_const_exprs)]
2+
#![feature(inline_const)]
3+
#![allow(incomplete_features)]
4+
5+
pub struct ConstDefaultUnstable<const N: usize = { const { 3 } }>;
6+
7+
fn main() {}

ices/105742.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
cat > out.rs << EOF
4+
use std::ops::Index;
5+
6+
fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
7+
let _ = s;
8+
}
9+
10+
trait SVec: Index<<Self as SVec>::Item, Output = <Index<<Self as SVec>::Item, Output = <Self as SVec>::Item> as SVec>::Item> {
11+
type Item<'a, T>;
12+
13+
fn len(&self) -> <Self as SVec>::Item;
14+
}
15+
16+
fn main() {}
17+
18+
EOF
19+
20+
rustdoc -Znormalize-docs out.rs

ices/105777.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(dyn_star)]
2+
3+
const _: dyn* Send = &();
4+
// static V: dyn* Send = Sync = &();
5+
6+
fn main() {}

0 commit comments

Comments
 (0)