vergen_lib/
lib.rs

1// Copyright (c) 2022 vergen developers
2//
3// Licensed under the Apache License, Version 2.0
4// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0> or the MIT
5// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. All files in the project carrying such notice may not be copied,
7// modified, or distributed except according to those terms.
8
9//! # vergen-lib - Common structs, enums and constants used to support [`vergen`](https://docs.rs/vergen)
10//!
11
12// rustc lints
13#![cfg_attr(
14    all(feature = "unstable", nightly),
15    feature(
16        coverage_attribute,
17        multiple_supertrait_upcastable,
18        must_not_suspend,
19        non_exhaustive_omitted_patterns_lint,
20        rustdoc_missing_doc_code_examples,
21        strict_provenance_lints,
22    )
23)]
24#![cfg_attr(nightly, allow(single_use_lifetimes, unexpected_cfgs))]
25#![cfg_attr(
26    nightly,
27    deny(
28        absolute_paths_not_starting_with_crate,
29        ambiguous_glob_imports,
30        ambiguous_glob_reexports,
31        ambiguous_wide_pointer_comparisons,
32        anonymous_parameters,
33        array_into_iter,
34        asm_sub_register,
35        async_fn_in_trait,
36        bad_asm_style,
37        bare_trait_objects,
38        break_with_label_and_loop,
39        clashing_extern_declarations,
40        coherence_leak_check,
41        confusable_idents,
42        const_evaluatable_unchecked,
43        const_item_mutation,
44        dangling_pointers_from_temporaries,
45        dead_code,
46        deprecated,
47        deprecated_in_future,
48        deprecated_where_clause_location,
49        deref_into_dyn_supertrait,
50        deref_nullptr,
51        drop_bounds,
52        dropping_copy_types,
53        dropping_references,
54        duplicate_macro_attributes,
55        dyn_drop,
56        elided_lifetimes_in_associated_constant,
57        elided_lifetimes_in_paths,
58        ellipsis_inclusive_range_patterns,
59        explicit_outlives_requirements,
60        exported_private_dependencies,
61        ffi_unwind_calls,
62        forbidden_lint_groups,
63        forgetting_copy_types,
64        forgetting_references,
65        for_loops_over_fallibles,
66        function_item_references,
67        hidden_glob_reexports,
68        improper_ctypes,
69        improper_ctypes_definitions,
70        inline_no_sanitize,
71        internal_features,
72        invalid_from_utf8,
73        invalid_macro_export_arguments,
74        invalid_nan_comparisons,
75        invalid_value,
76        irrefutable_let_patterns,
77        keyword_idents_2018,
78        keyword_idents_2024,
79        large_assignments,
80        late_bound_lifetime_arguments,
81        legacy_derive_helpers,
82        let_underscore_drop,
83        macro_use_extern_crate,
84        map_unit_fn,
85        meta_variable_misuse,
86        missing_abi,
87        missing_copy_implementations,
88        missing_debug_implementations,
89        missing_docs,
90        mixed_script_confusables,
91        named_arguments_used_positionally,
92        never_type_fallback_flowing_into_unsafe,
93        no_mangle_generic_items,
94        non_ascii_idents,
95        non_camel_case_types,
96        non_contiguous_range_endpoints,
97        non_fmt_panics,
98        non_local_definitions,
99        non_shorthand_field_patterns,
100        non_snake_case,
101        non_upper_case_globals,
102        noop_method_call,
103        opaque_hidden_inferred_bound,
104        overlapping_range_endpoints,
105        path_statements,
106        private_bounds,
107        private_interfaces,
108        redundant_lifetimes,
109        redundant_semicolons,
110        refining_impl_trait_internal,
111        refining_impl_trait_reachable,
112        renamed_and_removed_lints,
113        repr_transparent_external_private_fields,
114        rust_2021_incompatible_closure_captures,
115        rust_2021_incompatible_or_patterns,
116        rust_2021_prefixes_incompatible_syntax,
117        rust_2021_prelude_collisions,
118        semicolon_in_expressions_from_macros,
119        special_module_name,
120        stable_features,
121        static_mut_refs,
122        suspicious_double_ref_op,
123        trivial_bounds,
124        trivial_casts,
125        trivial_numeric_casts,
126        type_alias_bounds,
127        tyvar_behind_raw_pointer,
128        uncommon_codepoints,
129        unconditional_recursion,
130        uncovered_param_in_projection,
131        undefined_naked_function_abi,
132        ungated_async_fn_track_caller,
133        uninhabited_static,
134        unit_bindings,
135        unknown_lints,
136        unknown_or_malformed_diagnostic_attributes,
137        unnameable_test_items,
138        unnameable_types,
139        unreachable_code,
140        unreachable_patterns,
141        unreachable_pub,
142        unsafe_code,
143        unsafe_op_in_unsafe_fn,
144        unstable_name_collisions,
145        unstable_syntax_pre_expansion,
146        unused_allocation,
147        unused_assignments,
148        unused_associated_type_bounds,
149        unused_attributes,
150        unused_braces,
151        unused_comparisons,
152        unused_crate_dependencies,
153        unused_doc_comments,
154        unused_extern_crates,
155        unused_features,
156        unused_import_braces,
157        unused_imports,
158        unused_labels,
159        unused_lifetimes,
160        unused_macro_rules,
161        unused_macros,
162        unused_must_use,
163        unused_mut,
164        unused_parens,
165        unused_qualifications,
166        unused_results,
167        unused_unsafe,
168        unused_variables,
169        useless_ptr_null_checks,
170        variant_size_differences,
171        wasm_c_abi,
172        while_true,
173    )
174)]
175#![cfg_attr(all(nightly), allow(unstable_features))]
176// If nightly and unstable, allow `incomplete_features` and `unstable_features`
177#![cfg_attr(all(feature = "unstable", nightly), allow(incomplete_features))]
178// If nightly and not unstable, deny `incomplete_features` and `unstable_features`
179#![cfg_attr(
180    all(not(feature = "unstable"), nightly),
181    deny(incomplete_features, unstable_features)
182)]
183// The unstable lints
184#![cfg_attr(
185    all(feature = "unstable", nightly),
186    deny(
187        fuzzy_provenance_casts,
188        lossy_provenance_casts,
189        multiple_supertrait_upcastable,
190        must_not_suspend,
191        non_exhaustive_omitted_patterns,
192        unfulfilled_lint_expectations,
193    )
194)]
195// clippy lints
196#![cfg_attr(nightly, deny(clippy::all, clippy::pedantic))]
197// rustdoc lints
198#![cfg_attr(
199    nightly,
200    deny(
201        rustdoc::bare_urls,
202        rustdoc::broken_intra_doc_links,
203        rustdoc::invalid_codeblock_attributes,
204        rustdoc::invalid_html_tags,
205        rustdoc::missing_crate_level_docs,
206        rustdoc::private_doc_tests,
207        rustdoc::private_intra_doc_links,
208    )
209)]
210#![cfg_attr(
211    all(nightly, feature = "unstable"),
212    deny(rustdoc::missing_doc_code_examples)
213)]
214#![cfg_attr(all(doc, nightly), feature(doc_auto_cfg))]
215#![cfg_attr(all(docsrs, nightly), feature(doc_cfg))]
216
217#[cfg(test)]
218use {temp_env as _, test_util as _};
219
220pub mod constants;
221mod emitter;
222mod entries;
223mod keys;
224mod utils;
225
226pub use emitter::Emitter;
227#[doc(hidden)]
228pub use entries::test_gen::CustomInsGen;
229#[doc(hidden)]
230pub use entries::test_gen::CustomInsGenBuilder;
231pub use entries::Add as AddEntries;
232pub use entries::AddCustom as AddCustomEntries;
233pub use entries::CargoRerunIfChanged;
234pub use entries::CargoRustcEnvMap;
235pub use entries::CargoWarning;
236pub use entries::DefaultConfig;
237pub use keys::vergen_key::VergenKey;
238pub use utils::add_default_map_entry;
239pub use utils::add_map_entry;
240pub use utils::count_idempotent;