]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/in-trait/method-signature-matches.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / impl-trait / in-trait / method-signature-matches.rs
1 // edition: 2021
2
3 #![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
4 #![allow(incomplete_features)]
5
6 trait Uwu {
7     fn owo(x: ()) -> impl Sized;
8 }
9
10 impl Uwu for () {
11     fn owo(_: u8) {}
12     //~^ ERROR method `owo` has an incompatible type for trait
13 }
14
15 trait AsyncUwu {
16     async fn owo(x: ()) {}
17 }
18
19 impl AsyncUwu for () {
20     async fn owo(_: u8) {}
21     //~^ ERROR method `owo` has an incompatible type for trait
22 }
23
24 trait TooMuch {
25     fn calm_down_please() -> impl Sized;
26 }
27
28 impl TooMuch for () {
29     fn calm_down_please(_: (), _: (), _: ()) {}
30     //~^ ERROR method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
31 }
32
33 trait TooLittle {
34     fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
35 }
36
37 impl TooLittle for () {
38     fn come_on_a_little_more_effort() {}
39     //~^ 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
40 }
41
42 trait Lifetimes {
43     fn early<'early, T>(x: &'early T) -> impl Sized;
44 }
45
46 impl Lifetimes for () {
47     fn early<'late, T>(_: &'late ()) {}
48     //~^ ERROR method `early` has an incompatible type for trait
49 }
50
51 fn main() {}