diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 20:20:14 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-13 00:03:31 +0500 |
| commit | 98934707eb7824cd48ee3889d4570c1406c39ba4 (patch) | |
| tree | ea1189bcf19374f2c0c23a546c3133f2999117a9 /tests/ui/traits/tryfrominterror-result-comparison.rs | |
| parent | 47b8a32ca311e2c441f4e7d747bfd75f0045baa1 (diff) | |
| download | rust-98934707eb7824cd48ee3889d4570c1406c39ba4.tar.gz rust-98934707eb7824cd48ee3889d4570c1406c39ba4.zip | |
cleaned up some tests
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
Diffstat (limited to 'tests/ui/traits/tryfrominterror-result-comparison.rs')
| -rw-r--r-- | tests/ui/traits/tryfrominterror-result-comparison.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/ui/traits/tryfrominterror-result-comparison.rs b/tests/ui/traits/tryfrominterror-result-comparison.rs index 66a78b3f842..8a2741e9058 100644 --- a/tests/ui/traits/tryfrominterror-result-comparison.rs +++ b/tests/ui/traits/tryfrominterror-result-comparison.rs @@ -1,12 +1,19 @@ +//! This test verifies that `std::num::TryFromIntError` correctly implements `PartialEq`, +//! allowing `Result<T, TryFromIntError>` values to be compared for equality using `==`. +//! It specifically checks a successful numeric conversion scenario where the `Result::Ok` +//! variant is compared, ensuring that the comparison yields the expected boolean result. + //@ run-pass -#![allow(unused_must_use)] +#![allow(unused_must_use)] // Allow ignoring the result of the comparison for the test's purpose use std::convert::TryFrom; use std::num::TryFromIntError; fn main() { let x: u32 = 125; + // Attempt to convert u32 to u8, which should succeed as 125 fits in u8. let y: Result<u8, TryFromIntError> = u8::try_from(x); + // Verify that the Result can be correctly compared with an Ok value. y == Ok(125); } |
