]> git.lizzy.rs Git - rust.git/blob - tests/ui/return/return-impl-trait-bad.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / return / return-impl-trait-bad.rs
1 trait Trait {}
2 impl Trait for () {}
3
4 fn bad_echo<T>(_t: T) -> T {
5     "this should not suggest impl Trait" //~ ERROR mismatched types
6 }
7
8 fn bad_echo_2<T: Trait>(_t: T) -> T {
9     "this will not suggest it, because that would probably be wrong" //~ ERROR mismatched types
10 }
11
12 fn other_bounds_bad<T>() -> T
13 where
14     T: Send,
15     Option<T>: Send,
16 {
17     "don't suggest this, because Option<T> places additional constraints" //~ ERROR mismatched types
18 }
19
20 // FIXME: implement this check
21 trait GenericTrait<T> {}
22
23 fn used_in_trait<T>() -> T
24 where
25     T: Send,
26     (): GenericTrait<T>,
27 {
28     "don't suggest this, because the generic param is used in the bound." //~ ERROR mismatched types
29 }
30
31 fn main() {}