hackndev / zinc

The bare metal stack for rust
zinc.rs
Apache License 2.0
1k stars 100 forks source link

Various nightly fixes. #348

Closed farcaller closed 8 years ago

farcaller commented 9 years ago

This fixes a few things broken for #347 apart from one:

index 71ba8aa..ede9605 100644
--- a/ioreg/src/builder/union.rs
+++ b/ioreg/src/builder/union.rs
@@ -176,10 +176,9 @@ impl<'a> BuildUnionTypes<'a> {
     let padded_regs = PaddedRegsIterator::new(&mut regs);
     let fields =
       padded_regs.enumerate().map(|(n,r)| self.build_pad_or_reg(path, r, n));
-    let struct_def = ast::StructDef {
-      fields: FromIterator::from_iter(fields),
-      ctor_id: None,
-    };
+    let struct_def = ast::VariantData::Struct(
+        FromIterator::from_iter(fields),
+        ast::DUMMY_NODE_ID);
     let mut attrs: Vec<ast::Attribute> = vec!(
       utils::list_attribute(self.cx, "allow",
                             vec!("non_camel_case_types",

breaks ioreg with error: empty tuple structs and enum variants are not allowed, use unit structs and enum variants instead.

masche842 commented 8 years ago

Quick note: I'm pretty sure the problem is in this method: https://github.com/hackndev/zinc/blob/b46b4305d4f974eeedc7d428df3dc57b32c88114/ioreg/src/builder/register.rs#L151 It spits out:

  #[doc = "`0x0`. no documentation"]
      Input() = 0,

but it should rather be:

    #[doc = "`0x0`. no documentation"]
      Input = 0,

I still have to figure out how to fix that...

masche842 commented 8 years ago

Changing line 166 to

data: P(ast::VariantData::Unit(ast::DUMMY_NODE_ID)), 

seems to help. Pull request follows.

posborne commented 8 years ago

Tests pass on https://github.com/hackndev/zinc/pull/350 which buids on this