We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 714ed98 commit b9d9a49Copy full SHA for b9d9a49
src/generate/register.rs
@@ -499,15 +499,25 @@ pub fn fields(
499
}
500
501
502
- proxy_items.extend(quote! {
503
- ///Writes `variant` to the field
504
- #inline
505
- pub fn variant(self, variant: #pc_w) -> &'a mut W {
506
- #unsafety {
507
- self.#bits(variant.into())
+ if unsafety.is_some() {
+ proxy_items.extend(quote! {
+ ///Writes `variant` to the field
+ #inline
+ pub fn variant(self, variant: #pc_w) -> &'a mut W {
+ unsafe {
508
+ self.#bits(variant.into())
509
+ }
510
- }
- });
511
+ });
512
+ } else {
513
514
515
516
517
518
519
520
521
522
for v in &variants {
523
let pc = &v.pc;
0 commit comments