rust/tests/ui/coherence/coherence-subtyping.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
586 B
Rust
Raw Normal View History

// Test that two distinct impls which match subtypes of one another
// yield coherence errors (or not) depending on the variance.
//
// Note: This scenario is currently accepted, but as part of the
// universe transition (#56105) may eventually become an error.
2020-02-06 14:59:09 -06:00
// check-pass
2019-01-04 03:19:22 -06:00
2018-11-19 09:47:34 -06:00
trait TheTrait {
fn foo(&self) {}
}
impl TheTrait for for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8 {}
2018-11-19 09:47:34 -06:00
impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 {
//~^ WARNING conflicting implementation
//~^^ WARNING this was previously accepted by the compiler but is being phased out
}
fn main() {}