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

Mark bits() as safe if a register has no reserved bits #666

Merged
merged 2 commits into from
Oct 13, 2022

Conversation

steelman
Copy link
Contributor

If a register has no fields but its write constraints allow full range of values to be written, then mark bits() as safe.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Emilgardis (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Oct 11, 2022
@steelman
Copy link
Contributor Author

@Rahix, you may be interested in this patch.

@Emilgardis
Copy link
Member

Emilgardis commented Oct 11, 2022

wasn't this implemented before? ah my bad, was thinking of the specific writes, this is for the register

@burrbull
Copy link
Member

You could reuse unsafety function.
+changelog

@steelman
Copy link
Contributor Author

@burrbull Can you explain?

@burrbull
Copy link
Member

fn unsafety(write_constraint: Option<&WriteConstraint>, width: u32) -> bool {

let mut unsafety = unsafety(f.write_constraint.as_ref(), width);

@steelman
Copy link
Contributor Author

OK, I will.

src/generate/register.rs Outdated Show resolved Hide resolved
@steelman
Copy link
Contributor Author

I messed up. Moment.

burrbull
burrbull previously approved these changes Oct 11, 2022
@burrbull
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Oct 11, 2022
666: Mark bits() as safe if a register has no reserved bits r=burrbull a=steelman

If a register has no fields but its write constraints allow full range of values to be written, then mark bits() as safe.

Co-authored-by: Łukasz Stelmach <stlman@poczta.fm>
@bors
Copy link
Contributor

bors bot commented Oct 11, 2022

Build failed:

@burrbull
Copy link
Member

format and rebase, please

If a register has no fields but its write constraints allow
full range of values to be written, then mark bits() as safe.

Replace match block with unsafety() function call.
@burrbull
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 13, 2022

Build succeeded:

@bors bors bot merged commit ebce6fb into rust-embedded:master Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants