proc_macro2_diagnostic 0.6.0

Use `Diagnostic` compiler messages from proc_macro2 code with Result-like syntax.
Documentation
use std::path::PathBuf;

use trybuild::{self, TestCases};

#[allow(clippy::no_effect)]
fn examples(path: &str) -> PathBuf {
    let mut examples = PathBuf::from("tests/compilation/examples");
    cfg_select! {
        not(any(has_proc_macro_diagnostic, has_try_trait_v2)) => examples.push("neither"),
        not(has_proc_macro_diagnostic) => examples.push("no_diagnostic"),
        not(has_try_trait_v2) => examples.push("no_try"),
        _ => (),
    };
    examples.push(path);
    examples
}

#[test]
fn failures() {
    let t = TestCases::new();
    t.compile_fail(examples("fail_*.rs"));
}

#[test]
fn ok() {
    let t = TestCases::new();
    t.pass(examples("pass_*.rs"));
}