]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/concrete-const-impl-method.rs
Rollup merge of #75485 - RalfJung:pin, r=nagisa
[rust.git] / src / test / ui / const-generics / concrete-const-impl-method.rs
1 // Test that a method/associated non-method within an impl block of a concrete const type i.e. A<2>,
2 // is callable.
3 // run-pass
4 // revisions: full min
5
6 #![cfg_attr(full, feature(const_generics))]
7 #![cfg_attr(full, allow(incomplete_features))]
8 #![cfg_attr(min, feature(min_const_generics))]
9
10 pub struct A<const N: u32>;
11
12 impl A<2> {
13     fn impl_method(&self) -> u32 {
14         17
15     }
16
17     fn associated_non_method() -> u32 {
18         17
19     }
20 }
21
22 fn main() {
23     let val: A<2> = A;
24     assert_eq!(val.impl_method(), 17);
25     assert_eq!(A::<2>::associated_non_method(), 17);
26 }