Created
June 9, 2016 06:10
-
-
Save Limeth/8e033e948de2ce07de256ca3815dfdf6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn main() { | |
| println!("Hello, world!"); | |
| } | |
| trait BaseFloat {} | |
| trait NumPoint<F: BaseFloat> {} | |
| trait AbstractSurface<F: BaseFloat, P: NumPoint<F>> {} | |
| trait Surface<F: BaseFloat, P: NumPoint<F>> {} | |
| // I want to make anything that implements an AbstractSurface | |
| // automatically inherit the functionality for Surface. | |
| impl<F: BaseFloat, P: NumPoint<F>, A: AbstractSurface<F, P>> | |
| Surface<F, P> for A { | |
| } | |
| // I also want to let users make their own implementation of | |
| // Surface. | |
| struct PerlinSurface3<F: BaseFloat>; | |
| impl<F: BaseFloat, P: NumPoint<F>> | |
| Surface<F, P> for PerlinSurface3<F> { | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiling scratchpad v0.1.0 (file:///home/limeth/workspace/rust/scratchpad)
src/main.rs:19:1: 22:2 error: conflicting implementations of trait
Surface<_, _>for typePerlinSurface3<_>: [E0119]src/main.rs:19 impl<F: BaseFloat, P: NumPoint>
^
src/main.rs:19:1: 22:2 help: run
rustc --explain E0119to see a detailed explanationsrc/main.rs:12:1: 14:2 note: conflicting implementation is here:
src/main.rs:12 impl<F: BaseFloat, P: NumPoint, A: AbstractSurface<F, P>>
^
error: aborting due to previous error
error: Could not compile
scratchpad.To learn more, run the command again with --verbose.