mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
25 lines
410 B
Rust
25 lines
410 B
Rust
//@ aux-build:const_defaulty.rs
|
|
//@ check-pass
|
|
extern crate const_defaulty;
|
|
use const_defaulty::Defaulted;
|
|
|
|
struct Local<const N: usize=4>;
|
|
impl Local {
|
|
fn new() -> Self {
|
|
Local
|
|
}
|
|
}
|
|
impl<const N: usize>Local<N> {
|
|
fn value(&self) -> usize {
|
|
N
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let v = Defaulted::new();
|
|
assert_eq!(v.value(), 3);
|
|
|
|
let l = Local::new();
|
|
assert_eq!(l.value(), 4);
|
|
}
|