Skip to content

Commit

Permalink
add 5 ices
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Aug 28, 2022
1 parent 7ae9495 commit f4e4112
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ices/100878.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![crate_type = "lib"]
pub fn get_u16_from_unaligned_manual(data: [u8; 1]) -> u8 {
data[0] << 8
}

8 changes: 8 additions & 0 deletions ices/101001.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rustc --crate-type lib -Zmeta-stats - <<'EOF'
pub fn a() {}
EOF

33 changes: 33 additions & 0 deletions ices/101020.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#![feature(generic_associated_types)]
pub trait LendingIterator {
type Item<'a>
where
Self: 'a;

fn consume<F>(self, _f: F)
where
Self: Sized,
for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>,
{
}
}

impl<I: LendingIterator + ?Sized> LendingIterator for &mut I {
type Item<'a> = I::Item<'a> where Self: 'a;
}
struct EmptyIter;
impl LendingIterator for EmptyIter {
type Item<'a> = &'a mut () where Self:'a;
}
pub trait FuncInput<'a, F>
where
F: Foo<Self>,
Self: Sized,
{
}
impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {}
trait Foo<T> {}

fn map_test() {
(&mut EmptyIter).consume(());
}
13 changes: 13 additions & 0 deletions ices/101036.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![feature(generic_const_exprs)]

const fn t<const N: usize>() -> u8 {
N as u8
}

#[repr(u8)]
enum T<const N: u8 = { T::<0>::A as u8 + T::<0>::B as u8 }>
where
[(); N as usize]:
{
A = t::<N>() as u8, B
}
20 changes: 20 additions & 0 deletions ices/101076.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

cat > out.rs <<'EOF'
const _: () = {
#[macro_export]
macro_rules! first_macro {
() => {}
}
mod foo {
#[macro_export]
macro_rules! second_macro {
() => {}
}
}
};
EOF

rustdoc out.rs

0 comments on commit f4e4112

Please sign in to comment.