-
Notifications
You must be signed in to change notification settings - Fork 275
Update c2rust-refactor to nightly-2022-08-08 #1328
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I reviewed 100/127 files. I'll review the rest a bit later. Left a few comments, but it generally all looks fine to my cursory review so far.
let (defaultness, generics, sig, body) = expect!([i.kind] | ||
ItemKind::Fn(box Fn { defaultness, generics, sig, body }) | ||
=> (defaultness, generics, sig, body)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's expect!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal macro from src/macros.rs
that tries to match a value against the given pattern, and panics if the matching fails. We could try to get rid of it but it's already used in a hundred other places, so I'm not sure it's worth the effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps. It's not very clear what it does vs. assert_matches!
, although I'm not sure if it's worth the effort. I'd definitely prefer to use assert_matches!
and matches!
over the handrolled matches!
and expect!
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For new ones, though, I'd rather just use assert_matches!
.
ac75014
to
c958fe0
Compare
c958fe0
to
b0a8be1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed some more. Still reviewing the last 15 files or so.
However, when I checked out the code, I got a bunch of compiler errors/warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to submit these comments.
if let Some(ldid) = def_id.as_local() { | ||
let mod_hir_id = self.cx.ty_ctxt().parent_module_from_def_id(ldid); | ||
let mod_id = self.cx.hir_map().local_def_id_to_node_id(mod_hir_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to put this idiom in its own function? It's used a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that doesn't need to be done here in this PR.
da612cb
to
073e366
Compare
4a917b1
to
b998b55
Compare
c351a8f
to
71e9d3d
Compare
71e9d3d
to
c42bdd0
Compare
Update the refactoring tool to build and run with the same Rust nightly as the transpiler.