mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add test for const impl
This commit is contained in:
parent
0686daab4e
commit
b3207d531d
16
src/test/ui/const-generics/impl-const-generic-struct.rs
Normal file
16
src/test/ui/const-generics/impl-const-generic-struct.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
struct S<const X: u32>;
|
||||
|
||||
impl<const X: u32> S<{X}> {
|
||||
fn x() -> u32 {
|
||||
X
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(S::<19>::x(), 19);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/impl-const-generic-struct.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user