Structurally resolve before builtin_index in EUV
This commit is contained in:
parent
1af490de42
commit
61aac551b8
2 changed files with 18 additions and 1 deletions
|
@ -1741,7 +1741,11 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
|
||||||
}
|
}
|
||||||
|
|
||||||
PatKind::Slice(before, ref slice, after) => {
|
PatKind::Slice(before, ref slice, after) => {
|
||||||
let Some(element_ty) = place_with_id.place.ty().builtin_index() else {
|
let Some(element_ty) = self
|
||||||
|
.cx
|
||||||
|
.try_structurally_resolve_type(pat.span, place_with_id.place.ty())
|
||||||
|
.builtin_index()
|
||||||
|
else {
|
||||||
debug!("explicit index of non-indexable type {:?}", place_with_id);
|
debug!("explicit index of non-indexable type {:?}", place_with_id);
|
||||||
return Err(self
|
return Err(self
|
||||||
.cx
|
.cx
|
||||||
|
|
13
tests/ui/traits/next-solver/typeck/index-of-projection.rs
Normal file
13
tests/ui/traits/next-solver/typeck/index-of-projection.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
//@ compile-flags: -Znext-solver
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
// Fixes a regression in `rustc_attr` where we weren't normalizing the
|
||||||
|
// output type of a index operator performing a `Ty::builtin_index` call,
|
||||||
|
// leading to an ICE.
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut vec = [1, 2, 3];
|
||||||
|
let x = || {
|
||||||
|
let [..] = &vec[..];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue