about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/const-generics/slice-const-param-mismatch.rs3
-rw-r--r--src/test/ui/const-generics/slice-const-param-mismatch.stderr15
-rw-r--r--src/test/ui/const-generics/slice-const-param.rs1
3 files changed, 16 insertions, 3 deletions
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 edc9a0f09ff..73c75ae6668 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<const T: &'static str>;
 struct ConstBytes<const T: &'static [u8]>;
 
 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<b"AAA"> = ConstBytes::<{&[0x41, 0x41, 0x41]}>;
     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //~ 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 1c3afa00b49..72369ab24eb 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<b"AAA"> = ConstBytes::<b"BBB">;
    |                                 ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"`
@@ -24,6 +33,6 @@ LL |     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
    = 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 ba82a0377bf..2629caa3921 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<const BYTES: &'static [u8]>() -> &'static [u8] {
 
 pub fn main() {
     assert_eq!(function_with_str::<"Rust">(), "Rust");
+    assert_eq!(function_with_str::<"ℇ㇈↦">(), "ℇ㇈↦");
     assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
     assert_eq!(function_with_bytes::<{&[0x41, 0x41, 0x41, 0x41]}>(), b"AAAA");
 }