]> git.lizzy.rs Git - rust.git/blob - tests/ui/return/return-impl-trait.rs
Rollup merge of #107486 - compiler-errors:bound-ty-keep-name, r=oli-obk
[rust.git] / tests / ui / return / return-impl-trait.rs
1 // run-rustfix
2
3 trait Trait {}
4 impl Trait for () {}
5
6 // this works
7 fn foo() -> impl Trait {
8     ()
9 }
10
11 fn bar<T: Trait + std::marker::Sync>() -> T
12 where
13     T: Send,
14 {
15     () //~ ERROR mismatched types
16 }
17
18 fn other_bounds<T>() -> T
19 where
20     T: Trait,
21     Vec<usize>: Clone,
22 {
23     () //~ ERROR mismatched types
24 }
25
26 fn main() {
27     foo();
28     bar::<()>();
29     other_bounds::<()>();
30 }