diff options
Diffstat (limited to 'tests/ui/associated-consts')
| -rw-r--r-- | tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs | 23 | ||||
| -rw-r--r-- | tests/ui/associated-consts/trait-associated-const-usage-43483.rs | 17 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs new file mode 100644 index 00000000000..f0fe2db432b --- /dev/null +++ b/tests/ui/associated-consts/constant-trait-item-reference-selection-26095.rs @@ -0,0 +1,23 @@ +// https://github.com/rust-lang/rust/issues/26095 +//@ check-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +trait HasNumber<T> { + const Number: usize; +} + +enum One {} +enum Two {} + +enum Foo {} + +impl<T> HasNumber<T> for One { + const Number: usize = 1; +} + +impl<T> HasNumber<T> for Two { + const Number: usize = 2; +} + +fn main() {} diff --git a/tests/ui/associated-consts/trait-associated-const-usage-43483.rs b/tests/ui/associated-consts/trait-associated-const-usage-43483.rs new file mode 100644 index 00000000000..c24157d45e7 --- /dev/null +++ b/tests/ui/associated-consts/trait-associated-const-usage-43483.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/43483 +//@ check-pass +#![allow(dead_code)] +#![allow(unused_variables)] +trait VecN { + const DIM: usize; +} + +trait Mat { + type Row: VecN; +} + +fn m<M: Mat>() { + let x = M::Row::DIM; +} + +fn main() {} |
