blob: 294f93b30d0eed722dd6ebcaac46f783b7a14473 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// edition: 2021
// revisions: mismatch mismatch_async too_many too_few lt
#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![allow(incomplete_features)]
#[cfg(mismatch)]
trait Uwu {
fn owo(x: ()) -> impl Sized;
}
#[cfg(mismatch)]
impl Uwu for () {
fn owo(_: u8) {}
//[mismatch]~^ ERROR method `owo` has an incompatible type for trait
}
#[cfg(mismatch_async)]
trait AsyncUwu {
async fn owo(x: ()) {}
}
#[cfg(mismatch_async)]
impl AsyncUwu for () {
async fn owo(_: u8) {}
//[mismatch_async]~^ ERROR method `owo` has an incompatible type for trait
}
#[cfg(too_many)]
trait TooMuch {
fn calm_down_please() -> impl Sized;
}
#[cfg(too_many)]
impl TooMuch for () {
fn calm_down_please(_: (), _: (), _: ()) {}
//[too_many]~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
}
#[cfg(too_few)]
trait TooLittle {
fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
}
#[cfg(too_few)]
impl TooLittle for () {
fn come_on_a_little_more_effort() {}
//[too_few]~^ ERROR method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
}
#[cfg(lt)]
trait Lifetimes {
fn early<'early, T>(x: &'early T) -> impl Sized;
}
#[cfg(lt)]
impl Lifetimes for () {
fn early<'late, T>(_: &'late ()) {}
//[lt]~^ ERROR method `early` has an incompatible type for trait
}
fn main() {}
|