]> git.proxmox.com Git - rustc.git/blame - src/test/ui/coherence/coherence-subtyping.rs
New upstream version 1.43.0+dfsg1
[rustc.git] / src / test / ui / coherence / coherence-subtyping.rs
CommitLineData
0731742a
XL
1// Test that two distinct impls which match subtypes of one another
2// yield coherence errors (or not) depending on the variance.
3//
4// Note: This scenario is currently accepted, but as part of the
5// universe transition (#56105) may eventually become an error.
6
7// revisions: old re
74b04a01 8// check-pass
0731742a 9
0731742a 10trait TheTrait {
74b04a01 11 fn foo(&self) {}
0731742a
XL
12}
13
74b04a01 14impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
0731742a
XL
15
16impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
74b04a01
XL
17 //[re]~^ WARNING conflicting implementation
18 //[re]~^^ WARNING this was previously accepted by the compiler but is being phased out
19 //[old]~^^^ WARNING conflicting implementation
20 //[old]~^^^^ WARNING this was previously accepted by the compiler but is being phased out
0731742a
XL
21}
22
74b04a01 23fn main() {}