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

Update rust toolchain version #750

Merged
merged 4 commits into from
Jan 17, 2022
Merged

Conversation

celinval
Copy link
Contributor

Description of changes:

Update toolchain version to the latest nightly version.

Resolved issues:

Resolves #747

Call-outs:

There has been a fixed that was pushed to rustc where they now normalize the struct-tail type when satisfying a Pointee obligation. I have not applied the fix yet, and this change keeps the same behavior for rmc. I wasn't able to reproduce the issue posted in the related PR yet. rust-lang/rust#92248

Testing:

  • How is this change tested?

  • Is this a refactor change?

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@celinval celinval requested a review from a team as a code owner January 13, 2022 01:22
src/rmc-compiler/rustc_codegen_rmc/src/codegen/typ.rs Outdated Show resolved Hide resolved
Comment on lines -384 to -395
Rvalue::NullaryOp(NullOp::Box, t) => {
let t = self.monomorphize(*t);
let layout = self.layout_of(t);
let size = layout.size.bytes_usize();
let box_ty = self.tcx.mk_box(t);
let box_ty = self.codegen_ty(box_ty);
let cbmc_t = self.codegen_ty(t);
let box_contents = BuiltinFn::Malloc
.call(vec![Expr::int_constant(size, Type::size_t())], Location::none())
.cast_to(cbmc_t.to_pointer());
self.box_value(box_contents, box_ty)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This NullOp::Box had deprecated and replaced by ShallowInitBox. So they finally removed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}
/// A pointer to the mir type should be a vtable fat pointer.
pub fn use_vtable_fat_pointer(&self, mir_type: Ty<'tcx>) -> bool {
let metadata = mir_type.ptr_metadata_ty(self.tcx);
let metadata = mir_type.ptr_metadata_ty(self.tcx, |ty| ty);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we made a function

fn normalize_type(ty: Ty<'tcx>) -> Ty<'tcx> {
  ty
}

Copy link
Contributor

@danielsn danielsn left a comment

Choose a reason for hiding this comment

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

Approved modulo discussion

Add a TODO and a link to the issue.
In order to make it easier to read and implement in the future.
This exact line where the assertion is may change whenever we update the
rust toolchain, which makes this test unreliable. We still ensure that
the assertion fails. Note that this may still fail if the message or the
check gets updated, but this shouldn't happen frequently.
@celinval
Copy link
Contributor Author

Approved modulo discussion

Thanks. I added the placeholder function as suggested.

@celinval celinval merged commit 87ccca6 into model-checking:main Jan 17, 2022
@celinval celinval deleted the issue-747-merge branch January 17, 2022 23:01
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 22, 2022
Fixes model-checking#747.

* Update typ.rs. Add a placeholder for type normalization function
  to make it easier to read and implement in the future.

* Remove the LOC of expected failure on std function. This exact line
 where the assertion is may change whenever we update the rust toolchain,
 which makes this test unreliable. We still ensure that the assertion fails.
 Note that this may still fail if the message or the check gets updated, but
 this shouldn't happen frequently.
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 25, 2022
Fixes model-checking#747.

* Update typ.rs. Add a placeholder for type normalization function
  to make it easier to read and implement in the future.

* Remove the LOC of expected failure on std function. This exact line
 where the assertion is may change whenever we update the rust toolchain,
 which makes this test unreliable. We still ensure that the assertion fails.
 Note that this may still fail if the message or the check gets updated, but
 this shouldn't happen frequently.
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
Fixes model-checking#747.

* Update typ.rs. Add a placeholder for type normalization function
  to make it easier to read and implement in the future.

* Remove the LOC of expected failure on std function. This exact line
 where the assertion is may change whenever we update the rust toolchain,
 which makes this test unreliable. We still ensure that the assertion fails.
 Note that this may still fail if the message or the check gets updated, but
 this shouldn't happen frequently.
tedinski pushed a commit that referenced this pull request Apr 27, 2022
Fixes #747.

* Update typ.rs. Add a placeholder for type normalization function
  to make it easier to read and implement in the future.

* Remove the LOC of expected failure on std function. This exact line
 where the assertion is may change whenever we update the rust toolchain,
 which makes this test unreliable. We still ensure that the assertion fails.
 Note that this may still fail if the message or the check gets updated, but
 this shouldn't happen frequently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2022 week 02: Merge changes from rustc repository
2 participants