rust/tests/ui/traits/issue-6128.rs

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

23 lines
490 B
Rust
Raw Normal View History

//@ run-pass
use std::collections::HashMap;
trait Graph<Node, Edge> {
2024-02-07 02:42:01 +00:00
fn f(&self, _: Edge); //~ WARN methods `f` and `g` are never used
fn g(&self, _: Node);
}
impl<E> Graph<isize, E> for HashMap<isize, isize> {
fn f(&self, _e: E) {
panic!();
}
fn g(&self, _e: isize) {
panic!();
}
}
pub fn main() {
let g : Box<HashMap<isize,isize>> = Box::new(HashMap::new());
2019-05-28 18:47:21 +00:00
let _g2 : Box<dyn Graph<isize,isize>> = g as Box<dyn Graph<isize,isize>>;
}