Skip to content

Commit

Permalink
Structurally normalize again for byte string lit pat checking
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 6, 2023
1 parent bd8aabe commit 906d2b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/new-solver/slice-match-byte-lit.rs
Original file line number Diff line number Diff line change
@@ -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] {
Expand Down
11 changes: 0 additions & 11 deletions tests/ui/traits/new-solver/slice-match-byte-lit.stderr

This file was deleted.

0 comments on commit 906d2b1

Please sign in to comment.