Rollup merge of #112428 - compiler-errors:next-solver-struct-resolv-pat, r=lcnr
Structurally resolve pointee in `check_pat_lit` Gotta make sure to eager norm the pointee of the match scrutinee with the new solver. r? ``@lcnr``
This commit is contained in:
commit
a4490b18a7
@ -393,9 +393,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// They can denote both statically and dynamically-sized byte arrays.
|
||||
let mut pat_ty = ty;
|
||||
if let hir::ExprKind::Lit(Spanned { node: ast::LitKind::ByteStr(..), .. }) = lt.kind {
|
||||
let expected = self.structurally_resolved_type(span, expected);
|
||||
if let ty::Ref(_, inner_ty, _) = expected.kind()
|
||||
&& matches!(inner_ty.kind(), ty::Slice(_))
|
||||
if let ty::Ref(_, inner_ty, _) = *self.structurally_resolved_type(span, expected).kind()
|
||||
&& self.structurally_resolved_type(span, inner_ty).is_slice()
|
||||
{
|
||||
let tcx = self.tcx;
|
||||
trace!(?lt.hir_id.local_id, "polymorphic byte string lit");
|
||||
|
11
tests/ui/traits/new-solver/slice-match-byte-lit.rs
Normal file
11
tests/ui/traits/new-solver/slice-match-byte-lit.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// compile-flags: -Ztrait-solver=next
|
||||
// check-pass
|
||||
|
||||
fn test(s: &[u8]) {
|
||||
match &s[0..3] {
|
||||
b"uwu" => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user