Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize field projection ty to fix broken MIR issue #71488

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_mir/borrow_check/type_check/mod.rs
Original file line number Diff line number Diff line change
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is field_ty used in more places? Do those places normalize too? Maybe it would be good to normalize inside field_ty itself.

Copy link
Member Author

@spastorino spastorino Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to be the only call to that field_ty. There's another call with normalization that happens here but that calls this field_ty.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, I can move both normalize calls inside field_ty if you prefer.

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
Original file line number Diff line number Diff line change
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