]> git.lizzy.rs Git - rust.git/blob - src/test/ui/coherence/coherence-fn-inputs.rs
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
[rust.git] / src / test / ui / coherence / coherence-fn-inputs.rs
1 // Test that we consider these two types completely equal:
2 //
3 // * `for<'a, 'b> fn(&'a u32, &'b u32)`
4 // * `for<'c> fn(&'c u32, &'c u32)`
5 //
6 // For a long time we considered these to be distinct types. But in fact they
7 // are equivalent, if you work through the implications of subtyping -- this is
8 // because:
9 //
10 // * `'c` can be the intersection of `'a` and `'b` (and there is always an intersection)
11 // * `'a` and `'b` can both be equal to `'c`
12
13 trait Trait {}
14 impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {}
15 impl Trait for for<'c> fn(&'c u32, &'c u32) {
16     //~^ ERROR conflicting implementations
17     //
18     // Note in particular that we do NOT get a future-compatibility warning
19     // here. This is because the new leak-check proposed in [MCP 295] does not
20     // "error" when these two types are equated.
21     //
22     // [MCP 295]: https://github.com/rust-lang/compiler-team/issues/295
23 }
24
25 fn main() {}