-
-
Save riking/8a5197cc67a6514ac6583c67aae32f4c to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains 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
pub struct Foo; | |
fn main() { | |
recheck(); | |
let f = Foo; | |
let x = f.quux::<{ | |
impl Foo { | |
pub fn quux<const N: usize>(&self) -> usize { | |
N | |
} | |
} | |
10 | |
}>(); | |
assert_eq!(x, 10); | |
} | |
fn recheck() { | |
let f = Foo; | |
assert_eq!(f.quux::<10>(), 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment