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

rust: mark follow method of Follow trait as unsafe #6951

Closed
wants to merge 1 commit into from

Conversation

marmeladema
Copy link
Contributor

I took the liberty to enable the unsafe_op_in_unsafe_fn lint in
order to not blindly allow all unsafe code in follow methods.

@github-actions github-actions bot added c++ codegen Involving generating code from schema rust labels Nov 23, 2021
I took the liberty to enable the `unsafe_op_in_unsafe_fn` lint in
order to not blindly allow all unsafe code in follow methods.
@marmeladema
Copy link
Contributor Author

I also ran cargo fmt which is why there are couple of unrelated changes.

@aardappel
Copy link
Collaborator

For reviewability I would leave any formatting changes to a separate PR.

@@ -216,6 +216,7 @@ bool GenerateRustModuleRootFile(const Parser &parser,
for (auto it = sub_modules.begin(); it != sub_modules.end(); it++) {
code += "pub mod " + it->first + " {";
code.IncrementIdentLevel();
code += "#![deny(unsafe_op_in_unsafe_fn)]";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it makes more sense for this to be at the top of the module root file, or at the top of every generated object file. I believe the #![...] attributes will cover all nested modules so there's some redundant coverage and also it currently misses the generated code that's in the root namespace.

@CasperN
Copy link
Collaborator

CasperN commented Dec 2, 2021

I also ran cargo fmt which is why there are couple of unrelated changes.

No problem, my brain classifies the extra unsafes as more or less formatting no-op changes.

Generally LGTM with one comment

@dbaileychess
Copy link
Collaborator

@marmeladema Any update to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ codegen Involving generating code from schema rust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants