From 324bd7e90f69a173ca1b15b212f893017fee62ff Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 26 Apr 2023 14:41:42 -0400 Subject: [PATCH] Add extern crate rustc_driver This fixes the build on nightly. --- .github/workflows/rust.yml | 2 +- README.md | 4 ++-- src/common.rs | 2 -- src/lib.rs | 2 ++ test-project/tests/pretty/macro.pp | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9529632..ce6a84b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,7 +57,7 @@ jobs: run: rustup component add rustc-dev - name: Run tests - run: cargo +nightly build --features rustc + run: cargo +nightly test --features rustc - name: Run test-project tests with `rustc` feature run: cd test-project && cargo +nightly test --features rustc diff --git a/README.md b/README.md index c01a40c..c063665 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To use `compiletest-rs` in your application, add the following to `Cargo.toml` ```toml [dev-dependencies] -compiletest_rs = "0.9" +compiletest_rs = "0.10.0" ``` By default, `compiletest-rs` should be able to run on both stable, beta and @@ -28,7 +28,7 @@ crate. ```toml [dev-dependencies] -compiletest_rs = { version = "0.9", features = [ "rustc" ] } +compiletest_rs = { version = "0.10.0", features = [ "rustc" ] } ``` Create a `tests` folder in the root folder of your project. Create a test file diff --git a/src/common.rs b/src/common.rs index 332e9a6..2fe75af 100644 --- a/src/common.rs +++ b/src/common.rs @@ -14,8 +14,6 @@ use std::fmt; use std::fs::{read_dir, remove_file}; use std::str::FromStr; use std::path::PathBuf; -#[cfg(feature = "rustc")] -use rustc_session; use test::ColorConfig; use runtest::dylib_env_var; diff --git a/src/lib.rs b/src/lib.rs index 6ad8d53..8489453 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,6 +13,8 @@ #![cfg_attr(feature = "rustc", feature(test))] #![deny(unused_imports)] +#[cfg(feature = "rustc")] +extern crate rustc_driver; #[cfg(feature = "rustc")] extern crate rustc_session; diff --git a/test-project/tests/pretty/macro.pp b/test-project/tests/pretty/macro.pp index b6ee55c..6a05149 100644 --- a/test-project/tests/pretty/macro.pp +++ b/test-project/tests/pretty/macro.pp @@ -4,9 +4,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -// pretty-compare-only -// pretty-mode:expanded -// pp-exact:macro.pp +//@pretty-compare-only +//@pretty-mode:expanded +//@pp-exact:macro.pp macro_rules! square { ($x : expr) => { $x * $x } ; }