about summary refs log tree commit diff
path: root/clippy_utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'clippy_utils/src')
-rw-r--r--clippy_utils/src/lib.rs1
-rw-r--r--clippy_utils/src/msrvs.rs29
2 files changed, 30 insertions, 0 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index b7017411927..9b60c92bca1 100644
--- a/clippy_utils/src/lib.rs
+++ b/clippy_utils/src/lib.rs
@@ -38,6 +38,7 @@ pub mod diagnostics;
 pub mod eager_or_lazy;
 pub mod higher;
 mod hir_utils;
+pub mod msrvs;
 pub mod numeric_literal;
 pub mod paths;
 pub mod ptr;
diff --git a/clippy_utils/src/msrvs.rs b/clippy_utils/src/msrvs.rs
new file mode 100644
index 00000000000..00df04c0144
--- /dev/null
+++ b/clippy_utils/src/msrvs.rs
@@ -0,0 +1,29 @@
+use rustc_semver::RustcVersion;
+
+macro_rules! msrv_aliases {
+    ($($major:literal,$minor:literal,$patch:literal {
+        $($name:ident),* $(,)?
+    })*) => {
+        $($(
+        pub const $name: RustcVersion = RustcVersion::new($major, $minor, $patch);
+        )*)*
+    };
+}
+
+// names may refer to stabilized feature flags or library items
+msrv_aliases! {
+    1,53,0 { OR_PATTERNS }
+    1,50,0 { BOOL_THEN }
+    1,46,0 { CONST_IF_MATCH }
+    1,45,0 { STR_STRIP_PREFIX }
+    1,42,0 { MATCHES_MACRO }
+    1,41,0 { RE_REBALANCING_COHERENCE, RESULT_MAP_OR_ELSE }
+    1,40,0 { MEM_TAKE, NON_EXHAUSTIVE, OPTION_AS_DEREF }
+    1,38,0 { POINTER_CAST }
+    1,37,0 { TYPE_ALIAS_ENUM_VARIANTS }
+    1,36,0 { ITERATOR_COPIED }
+    1,35,0 { OPTION_COPIED, RANGE_CONTAINS }
+    1,34,0 { TRY_FROM }
+    1,30,0 { ITERATOR_FIND_MAP }
+    1,17,0 { FIELD_INIT_SHORTHAND, STATIC_IN_CONST }
+}