diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:23 +0000 |
commit | 20431706a863f92cb37dc512fef6e48d192aaf2c (patch) | |
tree | 2867f13f5fd5437ba628c67d7f87309ccadcd286 /vendor/matches | |
parent | Releasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/matches/.cargo-checksum.json | 1 | ||||
-rw-r--r-- | vendor/matches/Cargo.toml | 24 | ||||
-rw-r--r-- | vendor/matches/lib.rs | 128 | ||||
-rw-r--r-- | vendor/matches/tests/macro_use_one.rs | 11 | ||||
-rw-r--r-- | vendor/matches/tests/use_star.rs | 10 | ||||
-rw-r--r-- | vendor/rustc_tools_util/LICENSE-MIT (renamed from vendor/matches/LICENSE) | 4 |
6 files changed, 3 insertions, 175 deletions
diff --git a/vendor/matches/.cargo-checksum.json b/vendor/matches/.cargo-checksum.json deleted file mode 100644 index 65871b7ff..000000000 --- a/vendor/matches/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"194024a82bba1c84226ac827330511fba74474a7914b1319e6700285c15f5812","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"9f4187510972f5fc356ca60d19daa0e69643dd6b530edf7c928cbd75a2b990c5","tests/macro_use_one.rs":"4f599fae16f1aef369050bf0ad74cbefec06c430b29e0c9ab0811ac9592e997a","tests/use_star.rs":"39a23b8002544f65e7a896e2cefe8e0af7404151fa65d327e748f5c1101badf8"},"package":"a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"}
\ No newline at end of file diff --git a/vendor/matches/Cargo.toml b/vendor/matches/Cargo.toml deleted file mode 100644 index 57a249a40..000000000 --- a/vendor/matches/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies -# -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) - -[package] -name = "matches" -version = "0.1.9" -authors = ["Simon Sapin <simon.sapin@exyr.org>"] -description = "A macro to evaluate, as a boolean, whether an expression matches a pattern." -documentation = "https://docs.rs/matches/" -license = "MIT" -repository = "https://github.com/SimonSapin/rust-std-candidates" - -[lib] -name = "matches" -path = "lib.rs" diff --git a/vendor/matches/lib.rs b/vendor/matches/lib.rs deleted file mode 100644 index 3bcd6e2fe..000000000 --- a/vendor/matches/lib.rs +++ /dev/null @@ -1,128 +0,0 @@ -#![no_std] - -/// Check if an expression matches a refutable pattern. -/// -/// Syntax: `matches!(` *expression* `,` *pattern* `)` -/// -/// Return a boolean, true if the expression matches the pattern, false otherwise. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// pub enum Foo<T> { -/// A, -/// B(T), -/// } -/// -/// impl<T> Foo<T> { -/// pub fn is_a(&self) -> bool { -/// matches!(*self, Foo::A) -/// } -/// -/// pub fn is_b(&self) -> bool { -/// matches!(*self, Foo::B(_)) -/// } -/// } -/// -/// # fn main() { } -/// ``` -#[macro_export] -macro_rules! matches { - ($expression:expr, $($pattern:tt)+) => { - match $expression { - $($pattern)+ => true, - _ => false - } - } -} - -/// Assert that an expression matches a refutable pattern. -/// -/// Syntax: `assert_matches!(` *expression* `,` *pattern* `)` -/// -/// Panic with a message that shows the expression if it does not match the -/// pattern. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// fn main() { -/// let data = [1, 2, 3]; -/// assert_matches!(data.get(1), Some(_)); -/// } -/// ``` -#[macro_export] -macro_rules! assert_matches { - ($expression:expr, $($pattern:tt)+) => { - match $expression { - $($pattern)+ => (), - ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)), - } - } -} - -/// Assert that an expression matches a refutable pattern using debug assertions. -/// -/// Syntax: `debug_assert_matches!(` *expression* `,` *pattern* `)` -/// -/// If debug assertions are enabled, panic with a message that shows the -/// expression if it does not match the pattern. -/// -/// When debug assertions are not enabled, this macro does nothing. -/// -/// # Examples -/// -/// ``` -/// #[macro_use] -/// extern crate matches; -/// -/// fn main() { -/// let data = [1, 2, 3]; -/// debug_assert_matches!(data.get(1), Some(_)); -/// } -/// ``` -#[macro_export] -macro_rules! debug_assert_matches { - ($expression:expr, $($pattern:tt)+) => { - if cfg!(debug_assertions) { - match $expression { - $($pattern)+ => (), - ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)), - } - } - } -} - -#[test] -fn matches_works() { - let foo = Some("-12"); - assert!(matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - )); -} - -#[test] -fn assert_matches_works() { - let foo = Some("-12"); - assert_matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - ); -} - -#[test] -#[should_panic(expected = "assertion failed: `Some(\"-AB\")` does not match ")] -fn assert_matches_panics() { - let foo = Some("-AB"); - assert_matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - ); -} diff --git a/vendor/matches/tests/macro_use_one.rs b/vendor/matches/tests/macro_use_one.rs deleted file mode 100644 index a527a89ce..000000000 --- a/vendor/matches/tests/macro_use_one.rs +++ /dev/null @@ -1,11 +0,0 @@ -// https://github.com/SimonSapin/rust-std-candidates/issues/12 -#[macro_use(matches)] extern crate matches; - -#[test] -fn matches_works() { - let foo = Some("-12"); - assert!(matches!(foo, Some(bar) if - matches!(bar.as_bytes()[0], b'+' | b'-') && - matches!(bar.as_bytes()[1], b'0'...b'9') - )); -} diff --git a/vendor/matches/tests/use_star.rs b/vendor/matches/tests/use_star.rs deleted file mode 100644 index 58a670b93..000000000 --- a/vendor/matches/tests/use_star.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! https://github.com/SimonSapin/rust-std-candidates/issues/22 - -extern crate matches; - -use matches::*; - -#[test] -fn test_assert_matches() { - assert_matches!(4, 4) -} diff --git a/vendor/matches/LICENSE b/vendor/rustc_tools_util/LICENSE-MIT index a7b759a49..b724b24aa 100644 --- a/vendor/matches/LICENSE +++ b/vendor/rustc_tools_util/LICENSE-MIT @@ -1,4 +1,6 @@ -Copyright (c) 2014-2016 Simon Sapin +MIT License + +Copyright (c) 2014-2022 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |