Skip to content

Commit

Permalink
Remove version_check usage
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Sep 1, 2024
1 parent 27142aa commit b5b7741
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 43 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
- run: rustup toolchain install ${{ matrix.rust-version }}
- run: cargo +${{ matrix.rust-version }} test --all

ui-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo +stable test ui --cfg run_ui_tests

test-fmt:
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ test-crate = { path = "./test-crate" }
syn = { version = "2", features = ["full"] }
trybuild = { version = "1.0.99", features = ["diff"] }

[build-dependencies]
version_check = "0.9"

[features]
default = ["syn-error"]
syn-error = ["syn"]
syn-error = ["dep:syn"]
nightly = []

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(run_ui_tests)'] }
13 changes: 0 additions & 13 deletions build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions proc-macro-error-attr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
quote = "1"
proc-macro2 = "1"

[build-dependencies]
version_check = "0.9"
6 changes: 0 additions & 6 deletions proc-macro-error-attr/build.rs

This file was deleted.

12 changes: 0 additions & 12 deletions proc-macro-error-attr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ fn impl_proc_macro_error(attr: TokenStream2, input: TokenStream2) -> Result<Toke
Ok(res.into())
}

#[cfg(not(always_assert_unwind))]
fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream {
let is_proc_macro_hack = settings.is_set(ProcMacroHack);
let closure = if settings.is_set(AssertUnwindSafe) {
Expand All @@ -93,17 +92,6 @@ fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream {
quote!( ::proc_macro_error::entry_point(#closure, #is_proc_macro_hack) )
}

// FIXME:
// proc_macro::TokenStream does not implement UnwindSafe until 1.37.0.
// Considering this is the closure's return type the unwind safety check would fail
// for virtually every closure possible, the check is meaningless.
#[cfg(always_assert_unwind)]
fn gen_body(block: TokenTree, settings: Settings) -> proc_macro2::TokenStream {
let is_proc_macro_hack = settings.is_set(ProcMacroHack);
let closure = quote!(::std::panic::AssertUnwindSafe(|| #block ));
quote!( ::proc_macro_error::entry_point(#closure, #is_proc_macro_hack) )
}

fn detect_proc_macro_hack(attrs: &[Attribute]) -> bool {
attrs
.iter()
Expand Down
1 change: 0 additions & 1 deletion src/imp/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub(crate) fn emit_diagnostic(diag: Diagnostic) {
IS_DIRTY.with(|c| c.set(true));
PLevel::Error
}
_ => unreachable!(),
};

let mut res = PDiag::spanned(span, level, msg);
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
//! [`ToTokens`]: https://docs.rs/quote/1.0.3/quote/trait.ToTokens.html
//!

#![cfg_attr(not(use_fallback), feature(proc_macro_diagnostic))]
#![cfg_attr(feature = "nightly", feature(proc_macro_diagnostic))]
#![forbid(unsafe_code)]
#![allow(clippy::needless_doctest_main)]

Expand All @@ -295,11 +295,11 @@ mod diagnostic;
mod macros;
mod sealed;

#[cfg(use_fallback)]
#[cfg(not(feature = "nightly"))]
#[path = "imp/fallback.rs"]
mod imp;

#[cfg(not(use_fallback))]
#[cfg(feature = "nightly")]
#[path = "imp/delegate.rs"]
mod imp;

Expand Down
2 changes: 1 addition & 1 deletion tests/macro-errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg_attr(skip_ui_tests, ignore)]
#[test]
#[cfg(run_ui_tests)]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/*.rs");
Expand Down

0 comments on commit b5b7741

Please sign in to comment.