diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.rs b/src/test/ui/const-generics/slice-const-param-mismatch.rs index edc9a0f09ff29..73c75ae666805 100644 --- a/src/test/ui/const-generics/slice-const-param-mismatch.rs +++ b/src/test/ui/const-generics/slice-const-param-mismatch.rs @@ -5,7 +5,10 @@ struct ConstString; struct ConstBytes; pub fn main() { + let _: ConstString<"Hello"> = ConstString::<"Hello">; let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types + let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">; + let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types let _: ConstBytes = ConstBytes::<{&[0x41, 0x41, 0x41]}>; let _: ConstBytes = ConstBytes::; //~ ERROR mismatched types } diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.stderr b/src/test/ui/const-generics/slice-const-param-mismatch.stderr index 1c3afa00b4943..72369ab24ebfc 100644 --- a/src/test/ui/const-generics/slice-const-param-mismatch.stderr +++ b/src/test/ui/const-generics/slice-const-param-mismatch.stderr @@ -7,7 +7,7 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default error[E0308]: mismatched types - --> $DIR/slice-const-param-mismatch.rs:8:35 + --> $DIR/slice-const-param-mismatch.rs:9:35 | LL | let _: ConstString<"Hello"> = ConstString::<"World">; | ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` @@ -16,7 +16,16 @@ LL | let _: ConstString<"Hello"> = ConstString::<"World">; found type `ConstString<>` error[E0308]: mismatched types - --> $DIR/slice-const-param-mismatch.rs:10:33 + --> $DIR/slice-const-param-mismatch.rs:11:33 + | +LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; + | ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` + | + = note: expected type `ConstString<>` + found type `ConstString<>` + +error[E0308]: mismatched types + --> $DIR/slice-const-param-mismatch.rs:13:33 | LL | let _: ConstBytes = ConstBytes::; | ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` @@ -24,6 +33,6 @@ LL | let _: ConstBytes = ConstBytes::; = note: expected type `ConstBytes<>` found type `ConstBytes<>` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/slice-const-param.rs b/src/test/ui/const-generics/slice-const-param.rs index ba82a0377bf27..2629caa392106 100644 --- a/src/test/ui/const-generics/slice-const-param.rs +++ b/src/test/ui/const-generics/slice-const-param.rs @@ -13,6 +13,7 @@ pub fn function_with_bytes() -> &'static [u8] { pub fn main() { assert_eq!(function_with_str::<"Rust">(), "Rust"); + assert_eq!(function_with_str::<"ℇ㇈↦">(), "ℇ㇈↦"); assert_eq!(function_with_bytes::(), &[0x41, 0x41, 0x41, 0x41]); assert_eq!(function_with_bytes::<{&[0x41, 0x41, 0x41, 0x41]}>(), b"AAAA"); }