Cannot compile simple tokio example

It's because of this recent change in proc-macro2. It looks at the compiler version to detect whether the two features you mentioned are stabilized yet. It's check looks like this:

if rustc < 79 {
    println!("cargo:rustc-cfg=no_literal_byte_character");
}

They were stabilized in 1.79, so this check would normally work. However, you are using a nightly release which is:

  1. From before the feature was stabilized.
  2. But still has version number 1.79 because it is a nightly created between 1.78 and 1.79.

So proc-macro2 thinks the feature has been stabilized, but the compiler thinks it hasn't. This causes the error. The check works on all stable versions of Rust, but is broken on your specific nightly release. To fix it, use a different compiler version.

1 Like