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

Dead code in the code generator #485

Open
psychon opened this issue Jun 15, 2020 · 2 comments
Open

Dead code in the code generator #485

psychon opened this issue Jun 15, 2020 · 2 comments
Labels
good first issue Good for newcomers P4 Priority Low

Comments

@psychon
Copy link
Owner

psychon commented Jun 15, 2020

The following diff does not cause make to fail, which means that we can remove two arguments from emit_struct_type:

diff --git a/generator/src/generator/namespace.rs b/generator/src/generator/namespace.rs
index d9881d1..3581a76 100644
--- a/generator/src/generator/namespace.rs
+++ b/generator/src/generator/namespace.rs
@@ -2353,6 +2353,8 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> {
         doc: Option<&xcbdefs::Doc>,
         out: &mut Output,
     ) {
+        assert!(!skip_length_field);
+        assert!(generate_try_parse);
         assert!(!(generate_serialize && !fields_need_serialize));
 
         let deducible_fields = gather_deducible_fields(fields);

General question: Is there a simple approach to find similar cases in the code generator?

@psychon psychon added good first issue Good for newcomers P4 Priority Low labels Jun 15, 2020
@DemiMarie
Copy link

Does Rust have code coverage support?

@psychon
Copy link
Owner Author

psychon commented Sep 14, 2021

Honest answer: I don't know. Google found https://blog.rust-lang.org/inside-rust/2020/11/12/source-based-code-coverage.html which says:

Nightly Rust already supports another kind of source code coverage, commonly called gcov, which relies on debug info to map from LLVM IR to lines of source code.

So... I guess this means that there already is support for some nightly-only kind of code coverage. (And this blog post talks about another nightly-only way being added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P4 Priority Low
Projects
None yet
Development

No branches or pull requests

2 participants