diff options
| author | Yotam Ofek <yotamofek@microsoft.com> | 2025-06-27 16:59:25 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotamofek@microsoft.com> | 2025-06-27 18:07:07 +0000 |
| commit | 0e32036debd1daba5bd079a47eeaf93ec7da99b3 (patch) | |
| tree | 83355e0f408abd50da9e079f4b87d130346addc4 /tests/ui/const-generics/generic_const_exprs | |
| parent | 13c46fd0b089360922a557d8e18a63a2c41dfbeb (diff) | |
| download | rust-0e32036debd1daba5bd079a47eeaf93ec7da99b3.tar.gz rust-0e32036debd1daba5bd079a47eeaf93ec7da99b3.zip | |
gce: don't ICE on non-local const
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/non-local-const.rs | 10 | ||||
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/non-local-const.stderr | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/non-local-const.rs b/tests/ui/const-generics/generic_const_exprs/non-local-const.rs new file mode 100644 index 00000000000..0a30cc385ac --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/non-local-const.rs @@ -0,0 +1,10 @@ +// regression test for #133808. + +#![feature(generic_const_exprs)] +#![feature(min_generic_const_args)] +#![allow(incomplete_features)] +#![crate_type = "lib"] + +pub trait Foo {} +impl Foo for [u8; std::path::MAIN_SEPARATOR] {} +//~^ ERROR the constant `MAIN_SEPARATOR` is not of type `usize` diff --git a/tests/ui/const-generics/generic_const_exprs/non-local-const.stderr b/tests/ui/const-generics/generic_const_exprs/non-local-const.stderr new file mode 100644 index 00000000000..d8df3269a19 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/non-local-const.stderr @@ -0,0 +1,10 @@ +error: the constant `MAIN_SEPARATOR` is not of type `usize` + --> $DIR/non-local-const.rs:9:14 + | +LL | impl Foo for [u8; std::path::MAIN_SEPARATOR] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `char` + | + = note: the length of array `[u8; MAIN_SEPARATOR]` must be type `usize` + +error: aborting due to 1 previous error + |
