]> git.lizzy.rs Git - rust.git/blob - tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs
Auto merge of #106853 - TimNN:undo-remap, r=oli-obk
[rust.git] / tests / ui / coherence / coherence-fn-covariant-bound-vs-static.rs
1 // Test that impls for these two types are considered ovelapping:
2 //
3 // * `for<'r> fn(fn(&'r u32))`
4 // * `fn(fn(&'a u32)` where `'a` is free
5 //
6 // This is because, for `'a = 'static`, the two types overlap.
7 // Effectively for them to be equal to you get:
8 //
9 // * `for<'r> fn(fn(&'r u32)) <: fn(fn(&'static u32))`
10 //   * true if `exists<'r> { 'r: 'static }` (obviously true)
11 // * `fn(fn(&'static u32)) <: for<'r> fn(fn(&'r u32))`
12 //   * true if `forall<'r> { 'static: 'r }` (also true)
13
14 trait Trait {}
15
16 impl Trait for for<'r> fn(fn(&'r ())) {}
17 impl<'a> Trait for fn(fn(&'a ())) {}
18 //~^ ERROR conflicting implementations
19 //
20 // Note in particular that we do NOT get a future-compatibility warning
21 // here. This is because the new leak-check proposed in [MCP 295] does not
22 // "error" when these two types are equated.
23 //
24 // [MCP 295]: https://github.com/rust-lang/compiler-team/issues/295
25
26 fn main() {}