about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2020-04-23 18:14:01 -0300
committerSantiago Pastorino <spastorino@gmail.com>2020-04-23 18:14:01 -0300
commit7bafb5704d9727b3897f086d9f159e62bc40ce42 (patch)
tree423a4567d7b1dc6a14a1599c8c7db649b8b2f57c
parent66f7a5d92f5adb9053bf66e0bf8f6d31d404870d (diff)
downloadrust-7bafb5704d9727b3897f086d9f159e62bc40ce42.tar.gz
rust-7bafb5704d9727b3897f086d9f159e62bc40ce42.zip
normalize field projection ty to fix broken MIR issue
-rw-r--r--src/librustc_mir/borrow_check/type_check/mod.rs1
-rw-r--r--src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs
index 796efd2bab9..8ed5993acbb 100644
--- a/src/librustc_mir/borrow_check/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/type_check/mod.rs
@@ -686,6 +686,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
                 let fty = self.sanitize_type(place, fty);
                 match self.field_ty(place, base, field, location) {
                     Ok(ty) => {
+                        let ty = self.cx.normalize(ty, location);
                         if let Err(terr) = self.cx.eq_types(
                             ty,
                             fty,
diff --git a/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs b/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
index 07af8310424..9d44aa1361c 100644
--- a/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
+++ b/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
@@ -7,6 +7,7 @@ fn init_hash(_: &mut [u8; HASH_LEN]) {}
 fn foo<'a>() -> &'a () {
     Hash([0; HASH_LEN]);
     init_hash(&mut [0; HASH_LEN]);
+    let (_array,) = ([0; HASH_LEN],);
     &()
 }