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

Commit 9076c00

Browse files
authored
Merge pull request #984 from matthiaskrgr/ices_6
add more ices
2 parents 5dc7a9c + da5ed4f commit 9076c00

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

ices/89271.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
rustc -Zsave-analysis - <<EOF
4+
#![feature(lang_items)]
5+
// #![feature(no_core)]
6+
// #![no_core]
7+
8+
#[lang = "fn"]
9+
trait MyFn<T> {
10+
const call: i32 = 42;
11+
//~^ ERROR: `call` trait item in `fn`/`fn_mut` lang item must be a function
12+
}
13+
14+
#[lang = "fn_mut"]
15+
trait MyFnMut<T> {
16+
fn call(i: i32, j: i32) -> i32 { i + j }
17+
//~^ ERROR: first argument of `call` in `fn`/`fn_mut` lang item must be a reference
18+
}
19+
20+
fn main() {
21+
let a = || 42;
22+
a();
23+
24+
let mut i = 0;
25+
let mut b = || { i += 1; };
26+
b();
27+
}
28+
29+
fn main() {}
30+
EOF

ices/89290.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(const_fn_trait_bound)]
2+
#![feature(const_trait_impl)]
3+
4+
const fn foo<T: ~const Drop>(_: T) {}
5+
6+
const fn bar() {
7+
foo(|| ());
8+
}
9+
10+
pub fn main() {}

ices/89304.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(generic_const_exprs)]
2+
3+
struct GenericStruct<const T: usize> { val: i64 }
4+
5+
impl<const T: usize> From<GenericStruct<T>> for GenericStruct<{T + 1}> {
6+
fn from(other: GenericStruct<T>) -> Self {
7+
Self { val: other.val }
8+
}
9+
}
10+
11+
impl<const T: usize> From<GenericStruct<{T + 1}>> for GenericStruct<T> {
12+
fn from(other: GenericStruct<{T + 1}>) -> Self {
13+
Self { val: other.val }
14+
}
15+
}
16+
17+
pub fn main() {}

ices/89312.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
trait T { type Item; }
4+
5+
type Alias<'a> = impl T<Item = &'a ()>;
6+
7+
struct S;
8+
impl<'a> T for &'a S {
9+
type Item = &'a ();
10+
}
11+
12+
fn filter_positive<'a>() -> Alias<'a> {
13+
&S
14+
}
15+
16+
fn with_positive(fun: impl Fn(Alias<'_>)) {
17+
fun(filter_positive());
18+
}
19+
20+
fn main() {
21+
with_positive(|_| ());
22+
}

0 commit comments

Comments
 (0)