From b9ddcc08ce1e7476939af45cb286f44b9bc28af3 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 13:41:48 -0400 Subject: [PATCH 1/7] updated to use rustc-check-cfg --- test_util/build.rs | 32 ++++++++++++-------------------- test_util/src/lib.rs | 39 +++++++++++++++++++++++++++------------ vergen-git2/build.rs | 32 ++++++++++++-------------------- vergen-git2/src/lib.rs | 38 ++++++++++++++++++++++++++------------ vergen-gitcl/build.rs | 32 ++++++++++++-------------------- vergen-gitcl/src/lib.rs | 38 ++++++++++++++++++++++++++------------ vergen-gix/build.rs | 32 ++++++++++++-------------------- vergen-gix/src/lib.rs | 38 ++++++++++++++++++++++++++------------ vergen-lib/build.rs | 32 ++++++++++++-------------------- vergen-lib/src/lib.rs | 38 ++++++++++++++++++++++++++------------ vergen-pretty/build.rs | 33 +++++++++++++-------------------- vergen-pretty/src/lib.rs | 38 ++++++++++++++++++++++++++------------ vergen/build.rs | 32 ++++++++++++-------------------- vergen/src/lib.rs | 38 ++++++++++++++++++++++++++------------ 14 files changed, 268 insertions(+), 224 deletions(-) diff --git a/test_util/build.rs b/test_util/build.rs index 086074bb..b33f7ed6 100644 --- a/test_util/build.rs +++ b/test_util/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 87d6e0f2..76c3088e 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -74,12 +74,13 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -98,6 +99,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -125,17 +127,16 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -149,10 +150,13 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -163,8 +167,10 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -172,7 +178,6 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -185,13 +190,16 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -225,27 +233,33 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints @@ -269,6 +283,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- )] #![cfg_attr(all(doc, nightly), feature(doc_auto_cfg))] #![cfg_attr(all(docsrs, nightly), feature(doc_cfg))] +#![cfg_attr(coverage_nightly, feature(coverage_attribute))] #[cfg(all(test, not(feature = "repo")))] use {anyhow as _, serial_test as _}; diff --git a/vergen-git2/build.rs b/vergen-git2/build.rs index 086074bb..b33f7ed6 100644 --- a/vergen-git2/build.rs +++ b/vergen-git2/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen-git2/src/lib.rs b/vergen-git2/src/lib.rs index b1467b0d..41518412 100644 --- a/vergen-git2/src/lib.rs +++ b/vergen-git2/src/lib.rs @@ -254,12 +254,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -278,6 +279,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -305,17 +307,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -329,10 +330,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -343,8 +347,10 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -352,7 +358,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -365,13 +370,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -405,27 +413,33 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints diff --git a/vergen-gitcl/build.rs b/vergen-gitcl/build.rs index 086074bb..b33f7ed6 100644 --- a/vergen-gitcl/build.rs +++ b/vergen-gitcl/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen-gitcl/src/lib.rs b/vergen-gitcl/src/lib.rs index f4adee61..44027c0f 100644 --- a/vergen-gitcl/src/lib.rs +++ b/vergen-gitcl/src/lib.rs @@ -254,12 +254,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -278,6 +279,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -305,17 +307,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -329,10 +330,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -343,8 +347,10 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -352,7 +358,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -365,13 +370,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -405,27 +413,33 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints diff --git a/vergen-gix/build.rs b/vergen-gix/build.rs index 086074bb..b33f7ed6 100644 --- a/vergen-gix/build.rs +++ b/vergen-gix/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen-gix/src/lib.rs b/vergen-gix/src/lib.rs index 6b8e3c01..ff4f4e9f 100644 --- a/vergen-gix/src/lib.rs +++ b/vergen-gix/src/lib.rs @@ -254,12 +254,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -278,6 +279,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -305,17 +307,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -329,10 +330,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -343,8 +347,10 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -352,7 +358,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -365,13 +370,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -405,27 +413,33 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints diff --git a/vergen-lib/build.rs b/vergen-lib/build.rs index 086074bb..b33f7ed6 100644 --- a/vergen-lib/build.rs +++ b/vergen-lib/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen-lib/src/lib.rs b/vergen-lib/src/lib.rs index 45432832..5747e218 100644 --- a/vergen-lib/src/lib.rs +++ b/vergen-lib/src/lib.rs @@ -16,12 +16,13 @@ lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -40,6 +41,7 @@ clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -67,17 +69,16 @@ hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -91,10 +92,13 @@ missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -105,8 +109,10 @@ pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -114,7 +120,6 @@ rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -127,13 +132,16 @@ tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -167,27 +175,33 @@ unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints diff --git a/vergen-pretty/build.rs b/vergen-pretty/build.rs index e12e7ad6..55a41676 100644 --- a/vergen-pretty/build.rs +++ b/vergen-pretty/build.rs @@ -12,11 +12,11 @@ use { }; fn main() -> Result<()> { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); setup_env() } @@ -92,40 +92,33 @@ fn emit() -> Result<()> { #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen-pretty/src/lib.rs b/vergen-pretty/src/lib.rs index f70187cb..d0b69bed 100644 --- a/vergen-pretty/src/lib.rs +++ b/vergen-pretty/src/lib.rs @@ -106,12 +106,13 @@ assert!(!buf.is_empty()); lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -130,6 +131,7 @@ assert!(!buf.is_empty()); clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -157,17 +159,16 @@ assert!(!buf.is_empty()); hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -181,10 +182,13 @@ assert!(!buf.is_empty()); missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -195,8 +199,10 @@ assert!(!buf.is_empty()); pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -204,7 +210,6 @@ assert!(!buf.is_empty()); rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -217,13 +222,16 @@ assert!(!buf.is_empty()); tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -257,27 +265,33 @@ assert!(!buf.is_empty()); unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints diff --git a/vergen/build.rs b/vergen/build.rs index 086074bb..b33f7ed6 100644 --- a/vergen/build.rs +++ b/vergen/build.rs @@ -1,48 +1,40 @@ pub fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-check-cfg=cfg(coverage_nightly)"); nightly(); beta(); stable(); - msrv(); - lints_fix(); } #[rustversion::nightly] fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); println!("cargo:rustc-cfg=nightly"); } #[rustversion::not(nightly)] -fn nightly() {} +fn nightly() { + println!("cargo:rustc-check-cfg=cfg(nightly)"); +} #[rustversion::beta] fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); println!("cargo:rustc-cfg=beta"); } #[rustversion::not(beta)] -fn beta() {} +fn beta() { + println!("cargo:rustc-check-cfg=cfg(beta)"); +} #[rustversion::stable] fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); println!("cargo:rustc-cfg=stable"); } #[rustversion::not(stable)] -fn stable() {} - -#[rustversion::before(1.70)] -fn msrv() {} - -#[rustversion::since(1.70)] -fn msrv() { - println!("cargo:rustc-cfg=msrv"); -} - -#[rustversion::before(1.75)] -fn lints_fix() {} - -#[rustversion::since(1.75)] -fn lints_fix() { - println!("cargo:rustc-cfg=lints_fix") +fn stable() { + println!("cargo:rustc-check-cfg=cfg(stable)"); } diff --git a/vergen/src/lib.rs b/vergen/src/lib.rs index b05117f0..f3541375 100644 --- a/vergen/src/lib.rs +++ b/vergen/src/lib.rs @@ -300,12 +300,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## lint_reasons, multiple_supertrait_upcastable, must_not_suspend, + mut_preserve_binding_mode_2024, non_exhaustive_omitted_patterns_lint, rustdoc_missing_doc_code_examples, strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] #![cfg_attr( nightly, deny( @@ -324,6 +325,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## clashing_extern_declarations, coherence_leak_check, confusable_idents, + const_eval_mutable_ptr_in_final_value, const_evaluatable_unchecked, const_item_mutation, dead_code, @@ -351,17 +353,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## hidden_glob_reexports, improper_ctypes, improper_ctypes_definitions, - incomplete_features, indirect_structural_match, inline_no_sanitize, internal_features, - invalid_doc_attributes, invalid_from_utf8, invalid_macro_export_arguments, invalid_nan_comparisons, invalid_value, irrefutable_let_patterns, - keyword_idents, + keyword_idents_2018, + keyword_idents_2024, large_assignments, late_bound_lifetime_arguments, legacy_derive_helpers, @@ -375,10 +376,13 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## missing_docs, mixed_script_confusables, named_arguments_used_positionally, + never_type_fallback_flowing_into_unsafe, no_mangle_generic_items, non_ascii_idents, non_camel_case_types, + non_contiguous_range_endpoints, non_fmt_panics, + non_local_definitions, non_shorthand_field_patterns, non_snake_case, non_upper_case_globals, @@ -389,8 +393,10 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## pointer_structural_match, private_bounds, private_interfaces, + redundant_lifetimes, redundant_semicolons, - refining_impl_trait, + refining_impl_trait_internal, + refining_impl_trait_reachable, renamed_and_removed_lints, repr_transparent_external_private_fields, rust_2021_incompatible_closure_captures, @@ -398,7 +404,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## rust_2021_prefixes_incompatible_syntax, rust_2021_prelude_collisions, semicolon_in_expressions_from_macros, - single_use_lifetimes, special_module_name, stable_features, static_mut_refs, @@ -411,13 +416,16 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## tyvar_behind_raw_pointer, uncommon_codepoints, unconditional_recursion, + uncovered_param_in_projection, undefined_naked_function_abi, unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, unknown_lints, + unknown_or_malformed_diagnostic_attributes, unnameable_test_items, + unnameable_types, unreachable_code, unreachable_patterns, unreachable_pub, @@ -451,27 +459,33 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unused_variables, useless_ptr_null_checks, variant_size_differences, + wasm_c_abi, where_clauses_object_safety, while_true, writes_through_immutable_pointer, ) )] -// If nightly and unstable, allow `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(unstable_features))] -// If nightly and not unstable, deny `unstable_features` -#![cfg_attr(all(not(feature = "unstable"), nightly), deny(unstable_features))] +// If nightly and unstable, allow `incomplete_features` and `unstable_features` +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] +// If nightly and not unstable, deny `incomplete_features` and `unstable_features` +#![cfg_attr( + all(not(feature = "unstable"), nightly), + deny(incomplete_features, unstable_features) +)] // The unstable lints #![cfg_attr( all(feature = "unstable", nightly), deny( + dereferencing_mut_binding, fuzzy_provenance_casts, lossy_provenance_casts, multiple_supertrait_upcastable, must_not_suspend, non_exhaustive_omitted_patterns, unfulfilled_lint_expectations, - // unknown_or_malformed_diagnostic_attributes, - unnameable_types, ) )] // clippy lints From 4b35b145cf98e003cf9ab73fb6a68854982ca129 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 15:14:43 -0400 Subject: [PATCH 2/7] allow unstable on nightly --- test_util/src/lib.rs | 6 +++++- vergen-git2/src/lib.rs | 6 +++++- vergen-gitcl/src/lib.rs | 6 +++++- vergen-gix/src/lib.rs | 6 +++++- vergen-lib/src/lib.rs | 6 +++++- vergen-pretty/src/lib.rs | 6 +++++- vergen/src/lib.rs | 6 +++++- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 76c3088e..22ea3f97 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -239,6 +239,10 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), @@ -283,7 +287,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- )] #![cfg_attr(all(doc, nightly), feature(doc_auto_cfg))] #![cfg_attr(all(docsrs, nightly), feature(doc_cfg))] -#![cfg_attr(coverage_nightly, feature(coverage_attribute))] +#![cfg_attr(all(nightly, coverage_nightly), feature(coverage_attribute))] #[cfg(all(test, not(feature = "repo")))] use {anyhow as _, serial_test as _}; diff --git a/vergen-git2/src/lib.rs b/vergen-git2/src/lib.rs index 41518412..b362dbca 100644 --- a/vergen-git2/src/lib.rs +++ b/vergen-git2/src/lib.rs @@ -419,10 +419,14 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( diff --git a/vergen-gitcl/src/lib.rs b/vergen-gitcl/src/lib.rs index 44027c0f..259ddba6 100644 --- a/vergen-gitcl/src/lib.rs +++ b/vergen-gitcl/src/lib.rs @@ -419,10 +419,14 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( diff --git a/vergen-gix/src/lib.rs b/vergen-gix/src/lib.rs index ff4f4e9f..73cd10d6 100644 --- a/vergen-gix/src/lib.rs +++ b/vergen-gix/src/lib.rs @@ -419,10 +419,14 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( diff --git a/vergen-lib/src/lib.rs b/vergen-lib/src/lib.rs index 5747e218..9f7adce3 100644 --- a/vergen-lib/src/lib.rs +++ b/vergen-lib/src/lib.rs @@ -181,10 +181,14 @@ writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( diff --git a/vergen-pretty/src/lib.rs b/vergen-pretty/src/lib.rs index d0b69bed..99f0faa3 100644 --- a/vergen-pretty/src/lib.rs +++ b/vergen-pretty/src/lib.rs @@ -271,10 +271,14 @@ assert!(!buf.is_empty()); writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( diff --git a/vergen/src/lib.rs b/vergen/src/lib.rs index f3541375..64dc4bbf 100644 --- a/vergen/src/lib.rs +++ b/vergen/src/lib.rs @@ -465,10 +465,14 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] +#![cfg_attr( + all(nightly), + allow(unstable_features) +)] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( From 670607cb84c93355afc65ef9e54dbdeede849d67 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 15:15:17 -0400 Subject: [PATCH 3/7] rustfmt --- test_util/src/lib.rs | 5 +---- vergen-git2/src/lib.rs | 10 ++-------- vergen-gitcl/src/lib.rs | 10 ++-------- vergen-gix/src/lib.rs | 10 ++-------- vergen-lib/src/lib.rs | 10 ++-------- vergen-pretty/src/lib.rs | 10 ++-------- vergen/src/lib.rs | 10 ++-------- 7 files changed, 13 insertions(+), 52 deletions(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 22ea3f97..6aec4434 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -239,10 +239,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), diff --git a/vergen-git2/src/lib.rs b/vergen-git2/src/lib.rs index b362dbca..0262b69e 100644 --- a/vergen-git2/src/lib.rs +++ b/vergen-git2/src/lib.rs @@ -419,15 +419,9 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen-gitcl/src/lib.rs b/vergen-gitcl/src/lib.rs index 259ddba6..9bdf3644 100644 --- a/vergen-gitcl/src/lib.rs +++ b/vergen-gitcl/src/lib.rs @@ -419,15 +419,9 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen-gix/src/lib.rs b/vergen-gix/src/lib.rs index 73cd10d6..141fcc20 100644 --- a/vergen-gix/src/lib.rs +++ b/vergen-gix/src/lib.rs @@ -419,15 +419,9 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen-lib/src/lib.rs b/vergen-lib/src/lib.rs index 9f7adce3..91a0f840 100644 --- a/vergen-lib/src/lib.rs +++ b/vergen-lib/src/lib.rs @@ -181,15 +181,9 @@ writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen-pretty/src/lib.rs b/vergen-pretty/src/lib.rs index 99f0faa3..252b31d5 100644 --- a/vergen-pretty/src/lib.rs +++ b/vergen-pretty/src/lib.rs @@ -271,15 +271,9 @@ assert!(!buf.is_empty()); writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen/src/lib.rs b/vergen/src/lib.rs index 64dc4bbf..f0f33e64 100644 --- a/vergen/src/lib.rs +++ b/vergen/src/lib.rs @@ -465,15 +465,9 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## writes_through_immutable_pointer, ) )] -#![cfg_attr( - all(nightly), - allow(unstable_features) -)] +#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), From 4ed2b859d1304107519de03971be95e4b3443f71 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 15:22:25 -0400 Subject: [PATCH 4/7] removed duplicate lint --- test_util/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 6aec4434..877ee652 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -243,7 +243,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- // If nightly and unstable, allow `incomplete_features` and `unstable_features` #![cfg_attr( all(feature = "unstable", nightly), - allow(incomplete_features, unstable_features) + allow(incomplete_features) )] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( From 2aa924725bac5e1be500d00b68a35622934ef608 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 15:23:14 -0400 Subject: [PATCH 5/7] rustfmt --- test_util/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 877ee652..874443c3 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -241,10 +241,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- )] #![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr( - all(feature = "unstable", nightly), - allow(incomplete_features) -)] +#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), From 167baf9d2448175f67d4925b5bf1fd6122fca68a Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 15:49:24 -0400 Subject: [PATCH 6/7] fix code coverage unstable issue --- test_util/src/lib.rs | 6 ++++-- vergen-git2/Cargo.toml | 2 +- vergen-gitcl/Cargo.toml | 2 +- vergen-gix/Cargo.toml | 2 +- vergen-lib/Cargo.toml | 2 +- vergen/Cargo.toml | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 874443c3..82e6431d 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -239,9 +239,11 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- writes_through_immutable_pointer, ) )] -#![cfg_attr(all(nightly), allow(unstable_features))] // If nightly and unstable, allow `incomplete_features` and `unstable_features` -#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))] +#![cfg_attr( + all(feature = "unstable", nightly), + allow(incomplete_features, unstable_features) +)] // If nightly and not unstable, deny `incomplete_features` and `unstable_features` #![cfg_attr( all(not(feature = "unstable"), nightly), diff --git a/vergen-git2/Cargo.toml b/vergen-git2/Cargo.toml index fe69f0d1..52e3f942 100644 --- a/vergen-git2/Cargo.toml +++ b/vergen-git2/Cargo.toml @@ -52,7 +52,7 @@ lazy_static = "1.4.0" regex = "1.10.3" serial_test = "3.0.0" temp-env = "0.3.6" -test_util = { path = "../test_util", features = ["repo"] } +test_util = { path = "../test_util", features = ["repo", "unstable"] } [package.metadata.docs.rs] features = ["build", "cargo", "emit_and_set", "rustc", "si"] diff --git a/vergen-gitcl/Cargo.toml b/vergen-gitcl/Cargo.toml index 75312c21..791e5e74 100644 --- a/vergen-gitcl/Cargo.toml +++ b/vergen-gitcl/Cargo.toml @@ -51,7 +51,7 @@ lazy_static = "1.4.0" regex = "1.10.3" serial_test = "3.0.0" temp-env = "0.3.6" -test_util = { path = "../test_util", features = ["repo"] } +test_util = { path = "../test_util", features = ["repo", "unstable"] } [package.metadata.docs.rs] features = ["build", "cargo", "emit_and_set", "rustc", "si"] diff --git a/vergen-gix/Cargo.toml b/vergen-gix/Cargo.toml index 552d0592..3828a027 100644 --- a/vergen-gix/Cargo.toml +++ b/vergen-gix/Cargo.toml @@ -58,7 +58,7 @@ rustversion = "1.0.14" [dev-dependencies] lazy_static = "1.4.0" regex = "1.10.2" -test_util = { path = "../test_util", features = ["repo"] } +test_util = { path = "../test_util", features = ["repo", "unstable"] } serial_test = "3.0.0" temp-env = "0.3.6" diff --git a/vergen-lib/Cargo.toml b/vergen-lib/Cargo.toml index 36da698c..0fb9252e 100644 --- a/vergen-lib/Cargo.toml +++ b/vergen-lib/Cargo.toml @@ -49,7 +49,7 @@ rustversion = "1.0.14" [dev-dependencies] serial_test = "3.0.0" temp-env = "0.3.6" -test_util = { path = "../test_util" } +test_util = { path = "../test_util", features = ["unstable"] } [package.metadata.docs.rs] features = ["build", "cargo", "git", "rustc", "si"] diff --git a/vergen/Cargo.toml b/vergen/Cargo.toml index 1239bac5..f0729c7f 100644 --- a/vergen/Cargo.toml +++ b/vergen/Cargo.toml @@ -53,7 +53,7 @@ rustversion = "1.0.14" [dev-dependencies] lazy_static = "1.4.0" regex = "1.9.1" -test_util = { path = "../test_util" } +test_util = { path = "../test_util", features = ["unstable"] } serial_test = "3.0.0" temp-env = "0.3.6" From fedb37ddfe80217a400877d6c5d63e722eed0f06 Mon Sep 17 00:00:00 2001 From: Jason Ozias Date: Mon, 6 May 2024 16:17:43 -0400 Subject: [PATCH 7/7] allow unexpected_cfgs lint --- test_util/src/lib.rs | 3 +-- vergen-git2/src/lib.rs | 3 +-- vergen-gitcl/src/lib.rs | 3 +-- vergen-gix/src/lib.rs | 3 +-- vergen-lib/src/lib.rs | 3 +-- vergen-pretty/src/lib.rs | 3 +-- vergen/src/lib.rs | 3 +-- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 82e6431d..6dc79ad3 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -80,7 +80,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -192,7 +192,6 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen- unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen-git2/src/lib.rs b/vergen-git2/src/lib.rs index 0262b69e..07c7391c 100644 --- a/vergen-git2/src/lib.rs +++ b/vergen-git2/src/lib.rs @@ -260,7 +260,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -372,7 +372,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen-gitcl/src/lib.rs b/vergen-gitcl/src/lib.rs index 9bdf3644..443a43dc 100644 --- a/vergen-gitcl/src/lib.rs +++ b/vergen-gitcl/src/lib.rs @@ -260,7 +260,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -372,7 +372,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen-gix/src/lib.rs b/vergen-gix/src/lib.rs index 141fcc20..b173b388 100644 --- a/vergen-gix/src/lib.rs +++ b/vergen-gix/src/lib.rs @@ -260,7 +260,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -372,7 +372,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen-lib/src/lib.rs b/vergen-lib/src/lib.rs index 91a0f840..2048e1d9 100644 --- a/vergen-lib/src/lib.rs +++ b/vergen-lib/src/lib.rs @@ -22,7 +22,7 @@ strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -134,7 +134,6 @@ unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen-pretty/src/lib.rs b/vergen-pretty/src/lib.rs index 252b31d5..691a06a6 100644 --- a/vergen-pretty/src/lib.rs +++ b/vergen-pretty/src/lib.rs @@ -112,7 +112,7 @@ assert!(!buf.is_empty()); strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -224,7 +224,6 @@ assert!(!buf.is_empty()); unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings, diff --git a/vergen/src/lib.rs b/vergen/src/lib.rs index f0f33e64..a0ec8c46 100644 --- a/vergen/src/lib.rs +++ b/vergen/src/lib.rs @@ -306,7 +306,7 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## strict_provenance, ) )] -#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes))] +#![cfg_attr(nightly, allow(box_pointers, single_use_lifetimes, unexpected_cfgs))] #![cfg_attr( nightly, deny( @@ -418,7 +418,6 @@ let build = BuildBuilder::default().build_timestamp(true).build()?;"## unconditional_recursion, uncovered_param_in_projection, undefined_naked_function_abi, - unexpected_cfgs, ungated_async_fn_track_caller, uninhabited_static, unit_bindings,