Skip to content

Commit

Permalink
add 6 ices
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Aug 6, 2022
1 parent dfb66fc commit 8ee3903
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ices/100075.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
trait Marker {}
impl<T> Marker for T {}

fn maybe<T>(_t: T) ->
Option<
//removing the line below makes it compile
&'static
T> {
None
}

fn _g<T>(t: &'static T) -> &'static impl Marker {
if let Some(t) = maybe(t) {
return _g(t);
}
todo!()
}

pub fn main() {}
9 changes: 9 additions & 0 deletions ices/100103.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(let_else)]
fn main() {
let Some(x) = Some(()) else {
match Err(()) {
Err(()) => return (),
Ok(val) => val,
}
};
}
13 changes: 13 additions & 0 deletions ices/100114.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![allow(warnings)]
#![feature(never_type)]
#![allow(const_err)]

use std::mem::MaybeUninit;

const fn never() -> ! {
unsafe { MaybeUninit::uninit().assume_init() }
}

const NEVER: ! = never();

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

cat > out.rs <<'EOF'
// struct Peekable<I: Iterator>
use std::iter::Peekable;
pub struct Span<F: Fn(&i32)> {
inner: Peekable<ConditionalIterator<F>>,
}
struct ConditionalIterator<F> {
f: F,
}
impl<F: Fn(&i32)> Iterator for ConditionalIterator<F> {
type Item = ();
fn next(&mut self) -> Option<Self::Item> {
todo!()
}
}
EOF

rustdoc --edition=2021 out.rs

5 changes: 5 additions & 0 deletions ices/100183.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct Struct {
y: (typeof("hey"),),
}

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

rustc "-Zcrate-attr=feature(with_negative_coherence)" - <<'EOF'
#![feature(negative_impls)]
// FIXME: this should compile
trait MyPredicate<'a> {}
impl<'a, T> !MyPredicate<'a> for &T where T: 'a {}
trait MyTrait<'a> {}
impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
impl<'a, T> MyTrait<'a> for &'a T {}
//~^ ERROR: conflicting implementations of trait `MyTrait<'_>` for type `&_`
fn main() {}
EOF

0 comments on commit 8ee3903

Please sign in to comment.