Skip to content

Commit

Permalink
normalize field projection ty to fix broken MIR issue
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Apr 23, 2020
1 parent 66f7a5d commit 7bafb57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_mir/borrow_check/type_check/mod.rs
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
Expand Up @@ -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],);
&()
}

Expand Down

0 comments on commit 7bafb57

Please sign in to comment.