Skip to content

Instantly share code, notes, and snippets.

@AndyShiue
Created November 9, 2023 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndyShiue/09cc09ffd62d62972e9dea0e07707491 to your computer and use it in GitHub Desktop.
Save AndyShiue/09cc09ffd62d62972e9dea0e07707491 to your computer and use it in GitHub Desktop.
overlapping instances in Rust
trait Foo {}
trait Bar {}
trait Demo<T> {
fn t(_: T) -> T;
}
struct Test;
impl <T: Foo> Demo<T> for Test {
fn t(_: T) -> T { panic!() }
}
impl <T: Bar> Demo<T> for Test {
fn t(_: T) -> T { panic!() }
}
fn main() {
println!("Hello, world!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment