rust/tests/ui/traits/bound/impl-comparison-duplicates.rs

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

16 lines
332 B
Rust
Raw Normal View History

2024-02-07 02:42:01 +00:00
//@ check-pass
// Tests that type parameter bounds on an implementation need not match the
// trait exactly, as long as the implementation doesn't demand *more* bounds
// than the trait.
trait A {
fn foo<T: Eq + Ord>(&self);
}
impl A for isize {
fn foo<T: Ord>(&self) {} // Ord implies Eq, so this is ok.
}
fn main() {}