about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_hir_typeck/src/pat.rs4
-rw-r--r--tests/ui/traits/new-solver/slice-match-byte-lit.rs2
-rw-r--r--tests/ui/traits/new-solver/slice-match-byte-lit.stderr11
3 files changed, 3 insertions, 14 deletions
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 19f82fbd3bf..42f4531c0ef 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -394,8 +394,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         let mut pat_ty = ty;
         if let hir::ExprKind::Lit(Spanned { node: ast::LitKind::ByteStr(..), .. }) = lt.kind {
             let expected = self.structurally_resolve_type(span, expected);
-            if let ty::Ref(_, inner_ty, _) = expected.kind()
-                && matches!(inner_ty.kind(), ty::Slice(_))
+            if let ty::Ref(_, inner_ty, _) = *expected.kind()
+                && self.try_structurally_resolve_type(span, inner_ty).is_slice()
             {
                 let tcx = self.tcx;
                 trace!(?lt.hir_id.local_id, "polymorphic byte string lit");
diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.rs b/tests/ui/traits/new-solver/slice-match-byte-lit.rs
index 5f9c0df6450..4f848062595 100644
--- a/tests/ui/traits/new-solver/slice-match-byte-lit.rs
+++ b/tests/ui/traits/new-solver/slice-match-byte-lit.rs
@@ -1,5 +1,5 @@
 // compile-flags: -Ztrait-solver=next
-// known-bug: rust-lang/trait-system-refactor-initiative#38
+// check-pass
 
 fn test(s: &[u8]) {
     match &s[0..3] {
diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.stderr b/tests/ui/traits/new-solver/slice-match-byte-lit.stderr
deleted file mode 100644
index cd48a6d1843..00000000000
--- a/tests/ui/traits/new-solver/slice-match-byte-lit.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0271]: type mismatch resolving `[u8; 3] <: <[u8] as Index<Range<usize>>>::Output`
-  --> $DIR/slice-match-byte-lit.rs:6:9
-   |
-LL |     match &s[0..3] {
-   |           -------- this expression has type `&<[u8] as Index<std::ops::Range<usize>>>::Output`
-LL |         b"uwu" => {}
-   |         ^^^^^^ types differ
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0271`.