canndrew / error_def

Rust syntax extension for generating error-handling boilerplate code.
GNU General Public License v2.0
18 stars 1 forks source link

Build errors #6

Closed U007D closed 6 years ago

U007D commented 6 years ago

Hi, @canndrew. First of all, let me say 'thank you' for error_def--it is a very nice library. IMHO, it removes more boilerplate from the error-handling process than any of the others.

I'm getting errors building it, though, whether I pull from crates.io or from github directly. Any ideas what might be wrong?

$ git clone git@github.com:canndrew/error_def && cd error_def`
Cloning into 'error_def'...
remote: Counting objects: 177, done.
remote: Total 177 (delta 0), reused 0 (delta 0), pack-reused 177
Receiving objects: 100% (177/177), 42.30 KiB | 6.04 MiB/s, done.
Resolving deltas: 100% (98/98), done.

$ cargo test
   Compiling error_def v0.3.14 (file:///home/brad/development/rust/error_def)
error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:228:16
    |
228 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:228:16
    |
228 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:337:65
    |
337 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:337:65
    |
337 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:496:24brad@SocratesV:~/development/rust/error_def$ cargo test
   Compiling error_def v0.3.14 (file:///home/brad/development/rust/error_def)
error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:228:16
    |
228 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:228:16
    |
228 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:337:65
    |
337 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:337:65
    |
337 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:496:24
    |
496 |   let debug_fmt_impl = ImplItem {
    |                        ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:496:24
    |
496 |   let debug_fmt_impl = ImplItem {
    |                        ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:646:26
    |
646 |   let display_fmt_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:687:26
    |
687 |   let description_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:755:65
    |
755 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:815:20
    |
815 |   let cause_impl = ImplItem {
    |                    ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:646:26
    |
646 |   let display_fmt_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:826:16
    |
826 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:850:16
    |
850 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:687:26
    |
687 |   let description_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:874:16
    |
874 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:956:30
    |
956 |         let from_meth_impl = ImplItem {
    |                              ^^^^^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:755:65
    |
755 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:991:69
    |
991 |                   parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:966:22
    |
966 |         items.push(P(Item {
    |                      ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:815:20
    |
815 |   let cause_impl = ImplItem {
    |                    ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:826:16
    |
826 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:850:16
    |
850 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:874:16
    |
874 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:956:30
    |
956 |         let from_meth_impl = ImplItem {
    |                              ^^^^^^^^ missing `tokens`

error[E0063]: missing field `beginning_vert` in initializer of `syntax::ast::Arm`
    --> src/lib.rs:1062:25
     |
1062 |               arms.push(Arm {
     |                         ^^^ missing `beginning_vert`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:991:69
    |
991 |                   parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:966:22
    |
966 |         items.push(P(Item {
    |                      ^^^^ missing `tokens`

error: aborting due to 14 previous errors

error: Could not compile `error_def`.
warning: build failed, waiting for other jobs to finish...
error[E0063]: missing field `beginning_vert` in initializer of `syntax::ast::Arm`
    --> src/lib.rs:1062:25
     |
1062 |               arms.push(Arm {
     |                         ^^^ missing `beginning_vert`

error: aborting due to 14 previous errors

error: Could not compile `error_def`.

To learn more, run the command again with --verbose.

    |
496 |   let debug_fmt_impl = ImplItem {
    |                        ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:496:24
    |
496 |   let debug_fmt_impl = ImplItem {
    |                        ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:646:26
    |
646 |   let display_fmt_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:687:26
    |
687 |   let description_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:755:65
    |
755 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:815:20
    |
815 |   let cause_impl = ImplItem {
    |                    ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:646:26
    |
646 |   let display_fmt_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:826:16
    |
826 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:850:16
    |
850 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:687:26
    |
687 |   let description_impl = ImplItem {
    |                          ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:874:16
    |
874 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:956:30
    |
956 |         let from_meth_impl = ImplItem {
    |                              ^^^^^^^^ missing `tokens`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:755:65
    |
755 |               parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:991:69
    |
991 |                   parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:966:22
    |
966 |         items.push(P(Item {
    |                      ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:815:20
    |
815 |   let cause_impl = ImplItem {
    |                    ^^^^^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:826:16
    |
826 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:850:16
    |
850 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:874:16
    |
874 |   items.push(P(Item {
    |                ^^^^ missing `tokens`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::ImplItem`
   --> src/lib.rs:956:30
    |
956 |         let from_meth_impl = ImplItem {
    |                              ^^^^^^^^ missing `tokens`

error[E0063]: missing field `beginning_vert` in initializer of `syntax::ast::Arm`
    --> src/lib.rs:1062:25
     |
1062 |               arms.push(Arm {
     |                         ^^^ missing `beginning_vert`

error[E0063]: missing field `span` in initializer of `syntax::ast::AngleBracketedParameterData`
   --> src/lib.rs:991:69
    |
991 |                   parameters: Some(P(PathParameters::AngleBracketed(AngleBracketedParameterData {
    |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `span`

error[E0063]: missing field `tokens` in initializer of `syntax::ast::Item`
   --> src/lib.rs:966:22
    |
966 |         items.push(P(Item {
    |                      ^^^^ missing `tokens`

error: aborting due to 14 previous errors

error: Could not compile `error_def`.
warning: build failed, waiting for other jobs to finish...
error[E0063]: missing field `beginning_vert` in initializer of `syntax::ast::Arm`
    --> src/lib.rs:1062:25
     |
1062 |               arms.push(Arm {
     |                         ^^^ missing `beginning_vert`

error: aborting due to 14 previous errors

error: Could not compile `error_def`.

To learn more, run the command again with --verbose.
canndrew commented 6 years ago

Hi @U007D, thanks for the compliment and sorry for taking so long to get round to this. This library makes heavy use of nightly-only, compiler-internal APIs so it tends to break often and badly. I'll rewrite it in the next couple of days to use quasi-quoting instead (something I've been meaning to do for a while), and that should make it a fair bit more stable. In the mean time the only option is to use an older version of nightly (from whenever I published the latest version).

canndrew commented 6 years ago

This is now fixed, 0.3.15 is published to crates.io. Hopefully it should be a lot more stable from now on.

U007D commented 6 years ago

I read through the diff--that was quite a bit of work--thank you for jumping on this.

Can you point me to any reading on quasi-quoting? It's not something I've run into before, and my google searches didn't appear to turn up much useful background.

canndrew commented 6 years ago

I mean using #[feature(quote)] and the quote_*! macros. I don't know if they're documented anywhere but you can look in the compiler source code to see how to use them. They're macros which allow you to generate an AST from Rust code rather than writing out an AST manually. eg:

quote_item!(enum Foo { ... })

Rather than:

Item {
    ident: Ident::from_string("Foo"),
    attrs: Vec::new(),
    id: DUMMY_NODE_ID,
    node: ItemKind::Enum(
        EnumDef {
            variants: ...
        },
        Generics::default(),
    ),
    vis: Visibility::Public,
    span: DUMMY_SP,
}