Skip to content

cargo build - error[E0658] - proc_macro::Literal::byte_character(byte) #537

Closed
@Rahix

Description

@Rahix

Originally reported in #535.

Due to a change in proc-macro2 version v1.0.80, the toolchain version we use is no longer supported (see dtolnay/proc-macro2#451). To reproduce:

cargo generate --git https://github.com/rahix/avr-hal-template -r bb141bd00f6b9687e986db8aeb66a3f3f50cca12 -n proc-macro-regression
cd proc-macro-regression/
cargo build

which end with the following build error:

   Compiling proc-macro2 v1.0.81
error[E0658]: use of unstable library feature 'proc_macro_byte_character'
   --> /home/rahix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.81/src/wrapper.rs:871:21
    |
871 |                     proc_macro::Literal::byte_character(byte)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #115268 <https://github.com/rust-lang/rust/issues/115268> for more information
    = help: add `#![feature(proc_macro_byte_character)]` to the crate attributes to enable
    = note: this compiler was built on 2024-03-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'proc_macro_c_str_literals'
   --> /home/rahix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.81/src/wrapper.rs:898:21
    |
898 |                     proc_macro::Literal::c_string(string)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #119750 <https://github.com/rust-lang/rust/issues/119750> for more information
    = help: add `#![feature(proc_macro_c_str_literals)]` to the crate attributes to enable
    = note: this compiler was built on 2024-03-21; consider upgrading it if it is out of date

For more information about this error, try `rustc --explain E0658`.
error: could not compile `proc-macro2` (lib) due to 2 previous errors

The solution to this issue comes in two parts:

  • We need to upgrade to a newer rust toolchain version again.
  • We need to pin proc-macro2 to v1.0.79 somewhere to ensure this won't hit us again. I am unsure where the right place for this is:
    • avr-device? Pulled in by everyone who might care about this, but feels like the wrong level for such a fix.
    • avr-hal-template? Gives users control over the fix, if it ever needs changing. Downside is that it does not reach existing users, only new ones...
    • avr-hal/arduino-hal/atmega-hal? Should allow reaching existing users more easily, but still not really the right level for the fix...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions