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

Add missing semicolons after macro calls #7

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Conversation

schneems
Copy link
Owner

@schneems schneems commented Dec 12, 2024

Otherwise I was getting this error:

error: macros that expand to items must be delimited with braces or followed by a semicolon
   --> /Users/rschneeman/.cargo/registry/src/index.crates.io-6f17d22bba15001f/magic_migrate-0.2.0/src/lib.rs:437:34
    |
419 |   macro_rules! try_migrate_link {
    |   ----------------------------- in this expansion of `$crate::try_migrate_link!` (#3)
...
437 |           $crate::try_migrate_link!($b, $($rest),*)
    |                                    ^^^^^^^^^^^^^^^^
...
714 |   macro_rules! try_migrate_deserializer_chain {
    |   -------------------------------------------
    |   |
    |   in this expansion of `try_migrate_deserializer_chain!` (#1)
    |   in this expansion of `$crate::try_migrate_deserializer_chain!` (#2)
...
737 |           $crate::try_migrate_link!($a, $($rest),+);
    |           ----------------------------------------- in this macro invocation (#3)
...
764 |           $crate::try_migrate_deserializer_chain!(error: $err, deserializer: $deser, chain: [$a, $($rest),+]);
    |           --------------------------------------------------------------------------------------------------- in this macro invocation (#2)
    |
   ::: buildpacks/ruby/src/layers/bundle_install_layer.rs:120:1
    |
120 | / try_migrate_deserializer_chain!(
121 | |     chain: [MetadataV1, MetadataV2, MetadataV3],
122 | |     error: MetadataMigrateError,
123 | |     deserializer: toml::Deserializer::new,
124 | | );
    | |_- in this macro invocation (#1)

error: could not compile `heroku-ruby-buildpack` (bin "heroku-ruby-buildpack") due to 1 previous error
⛄️ 3.3.1 🚀 /Users/rschneeman/Documents/projects/work/buildpacks-ruby/buildpacks/ruby (schneems/pub-traits)
$ RUSTFLAGS="-Zmacro-backtrace" cargo build 
   Compiling heroku-ruby-buildpack v0.0.0 (/Users/rschneeman/Documents/projects/work/buildpacks-ruby/buildpacks/ruby)
error: macros that expand to items must be delimited with braces or followed by a semicolon
   --> /Users/rschneeman/.cargo/registry/src/index.crates.io-6f17d22bba15001f/magic_migrate-0.2.0/src/lib.rs:437:34
    |
419 |   macro_rules! try_migrate_link {
    |   ----------------------------- in this expansion of `$crate::try_migrate_link!` (#3)
...
437 |           $crate::try_migrate_link!($b, $($rest),*)
    |                                    ^^^^^^^^^^^^^^^^
...
714 |   macro_rules! try_migrate_deserializer_chain {
    |   -------------------------------------------
    |   |
    |   in this expansion of `try_migrate_deserializer_chain!` (#1)
    |   in this expansion of `$crate::try_migrate_deserializer_chain!` (#2)
...
737 |           $crate::try_migrate_link!($a, $($rest),+);
    |           ----------------------------------------- in this macro invocation (#3)
...
764 |           $crate::try_migrate_deserializer_chain!(error: $err, deserializer: $deser, chain: [$a, $($rest),+]);
    |           --------------------------------------------------------------------------------------------------- in this macro invocation (#2)
    |
   ::: buildpacks/ruby/src/layers/bundle_install_layer.rs:120:1
    |
120 | / try_migrate_deserializer_chain!(
121 | |     chain: [MetadataV1, MetadataV2, MetadataV3],
122 | |     error: MetadataMigrateError,
123 | |     deserializer: toml::Deserializer::new,
124 | | );
    | |_- in this macro invocation (#1)

From this code:

try_migrate_deserializer_chain!(
    chain: [MetadataV1, MetadataV2, MetadataV3],
    error: MetadataMigrateError,
    deserializer: toml::Deserializer::new,
);

Presumably because I was using 3 values instead of just 2.

I tried to induce the same error here #8 but I'm unable to do so with the same test suite.

@schneems schneems force-pushed the schneems/fix-semicolons branch from aac74b7 to f193bfc Compare December 12, 2024 17:04
Otherwise I was getting this error:

```
$ RUSTFLAGS="-Zmacro-backtrace" cargo build
   Compiling heroku-ruby-buildpack v0.0.0 (/Users/rschneeman/Documents/projects/work/buildpacks-ruby/buildpacks/ruby)
error: macros that expand to items must be delimited with braces or followed by a semicolon
   --> /Users/rschneeman/.cargo/registry/src/index.crates.io-6f17d22bba15001f/magic_migrate-0.2.0/src/lib.rs:437:34
    |
419 |   macro_rules! try_migrate_link {
    |   ----------------------------- in this expansion of `$crate::try_migrate_link!` (#3)
...
437 |           $crate::try_migrate_link!($b, $($rest),*)
    |                                    ^^^^^^^^^^^^^^^^
...
714 |   macro_rules! try_migrate_deserializer_chain {
    |   -------------------------------------------
    |   |
    |   in this expansion of `try_migrate_deserializer_chain!` (#1)
    |   in this expansion of `$crate::try_migrate_deserializer_chain!` (#2)
...
737 |           $crate::try_migrate_link!($a, $($rest),+);
    |           ----------------------------------------- in this macro invocation (#3)
...
764 |           $crate::try_migrate_deserializer_chain!(error: $err, deserializer: $deser, chain: [$a, $($rest),+]);
    |           --------------------------------------------------------------------------------------------------- in this macro invocation (#2)
    |
   ::: buildpacks/ruby/src/layers/bundle_install_layer.rs:120:1
    |
120 | / try_migrate_deserializer_chain!(
121 | |     chain: [MetadataV1, MetadataV2, MetadataV3],
122 | |     error: MetadataMigrateError,
123 | |     deserializer: toml::Deserializer::new,
124 | | );
    | |_- in this macro invocation (#1)
```

From this code:

```
try_migrate_deserializer_chain!(
    chain: [MetadataV1, MetadataV2, MetadataV3],
    error: MetadataMigrateError,
    deserializer: toml::Deserializer::new,
);
```

Presumably because I was using 3 values instead of just 2.
@schneems schneems force-pushed the schneems/fix-semicolons branch from f193bfc to 3fdf85c Compare December 12, 2024 17:05
@schneems schneems merged commit d11d63a into main Dec 12, 2024
4 checks passed
schneems added a commit to heroku/buildpacks-ruby that referenced this pull request Dec 12, 2024
schneems added a commit to heroku/buildpacks-ruby that referenced this pull request Dec 13, 2024
* Upgrade Rust version

* Add CacheDiff to dependencies

* Import and implement CacheDiff derive macro

* Use CacheDiff implementation for MetadataDiff

The CacheDiff is a public crate while MetadataDiff was a temporary experimentation platform internal to this buildpack

* Update magic_migrate

Due to schneems/magic_migrate#7

* Introduce metadata v3

The idea is to centralize all OS distribution information into a single attribute.

It's not yet used.

* Use metadata v3 for bundle_install

The coming move to CacheDiff prefers if one attribute relates to one difference reason. V2 introduced a distribution name and distribution value which we later determined looked better if it's combined to look like a single attribute to the user "OS Distribution." This move brings the attributes inline with how they're compared, now both name and value are evaluated and emited as a single unit.

* Implement CacheDiff on bundle_install layer

(Tests do not compile yet)

* Update tests for CacheDiff change

* Move OS distribution into a type

* Implement v3 metadata with condensed OS distribution

The coming move to CacheDiff prefers if one attribute relates to one difference reason. V2 introduced a distribution name and distribution value which we later determined looked better if it's combined to look like a single attribute to the user "OS Distribution." This move brings the attributes inline with how they're compared, now both name and value are evaluated and emitted as a single unit.

* Fix tests due to V3 migration

* Implement CacheDiff for ruby_install_layer

Does not compile yet due to tests

* Fix test compilation

* Implement CacheDiff for shared tests

* Update shared interfaces to use CacheDiff instead of MetadataDiff

* Replace qualified path with use

* Remove unused internal trait MetadataDiff

* Use regex for integration test match

* Use diff method directly

In the refactor we had two `diff` methods, now there's only one so we can use it instead of having to reference the trait. This shaves off some lines of the total diff.

* Format use statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant