2021年03月17日 : 今日も黒魔術をさわってる

デバッグがむずかしい

何故か、マクロで使ってる syn の中にある Parse 実装してる連中は、 std::Debug を実装しているはずなのに、dbg! マクロを使おうとすると

   |
   |     dbg!(attr_args);
   |     ^^^^^^^^^^^^^^^^ `NestedMeta` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   |
   = help: the trait `Debug` is not implemented for `NestedMeta`
   = note: required because of the requirements on the impl of `Debug` for `Vec<NestedMeta>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Vec<NestedMeta>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

とか怒られて、「なんでじゃー」って怒ってたんですが、最新のマニュアルみたら、

This is supported on crate feature extra-traits only.

って書いてありました…………。 ムキーーー!!

ということで、なんてこたーない、Cargo.tomlの

syn = "1.0.60"

syn = { version = "1.0.60", features = ["extra-traits"] }

にしたら、ちゃんとビルドできましたよ……。 だいぶ時間を無駄にした気がする……。

ていうか、Googleの検索結果がタコいんですよね……。 古いVersionのドキュメントや、Qiitaあたりを上位に出してくれるもんで……。 10年前のあんたは、そんな事はなかったのに……。

本日のタグ