kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
438 stars 36 forks source link

Use `quote_spanned` when generating calls to `gc_arena` methods #12

Closed Aaron1011 closed 3 years ago

Aaron1011 commented 3 years ago

We now span calls to Collect::needs_trace and Collect::trace with the span of the field that we're generating the call for. This leads to nicer error messages when a trait bound is not fulfulled (and likely better runtime backtraces as well)

Aaron1011 commented 3 years ago

The CircleCI tests failed, but I'm getting a 404 page when I click on 'Details'

kyren commented 3 years ago

The CircleCI tests failed, but I'm getting a 404 page when I click on 'Details'

CircleCI is failing due to a rustfmt error:

                 let ty = &b.ast().ty;
                 quote_spanned!(b.ast().span()=>
                     || <#ty as gc_arena::Collect>::needs_trace()
-                ).to_tokens(&mut needs_trace_body);
+                )
+                .to_tokens(&mut needs_trace_body);
             }
         }
         // Likewise, this will skip any fields that have `#[collect(require_static)]`

But I'm not too concerned about it, I can make a rustfmt pass in a bit before doing another release. Otherwise this makes sense and LGTM.

Also CircleCI has been erroring for me recently at git checkout for some reason, I have no idea why yet and I haven't fixed it.