| 1 | #![allow( |
| 2 | clippy::bool_to_int_with_if, |
| 3 | clippy::char_lit_as_u8, |
| 4 | clippy::deref_addrof, |
| 5 | clippy::diverging_sub_expression, |
| 6 | clippy::erasing_op, |
| 7 | clippy::extra_unused_type_parameters, |
| 8 | clippy::if_same_then_else, |
| 9 | clippy::ifs_same_cond, |
| 10 | clippy::ignored_unit_patterns, |
| 11 | clippy::items_after_statements, |
| 12 | clippy::let_and_return, |
| 13 | clippy::let_underscore_untyped, |
| 14 | clippy::literal_string_with_formatting_args, |
| 15 | clippy::match_bool, |
| 16 | clippy::needless_else, |
| 17 | clippy::never_loop, |
| 18 | clippy::overly_complex_bool_expr, |
| 19 | clippy::ptr_cast_constness, |
| 20 | clippy::redundant_closure_call, |
| 21 | clippy::redundant_pattern_matching, |
| 22 | clippy::too_many_lines, |
| 23 | clippy::uninlined_format_args, |
| 24 | clippy::unit_arg, |
| 25 | clippy::unnecessary_cast, |
| 26 | clippy::while_immutable_condition, |
| 27 | clippy::zero_ptr, |
| 28 | irrefutable_let_patterns |
| 29 | )] |
| 30 | |
| 31 | use selfrust-analyzer cargo anyhow 1.0.103 crate/::Enumrust-analyzer cargo anyhow 1.0.103 Enum#::Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#; |
| 32 | use anyhowrust-analyzer cargo anyhow 1.0.103 crate/::{anyhowrust-analyzer cargo anyhow 1.0.103 macros/anyhow!, ensurerust-analyzer cargo anyhow 1.0.103 ensure/, Chainrust-analyzer cargo anyhow 1.0.103 Chain#, Errorrust-analyzer cargo anyhow 1.0.103 Error#, Resultrust-analyzer cargo anyhow 1.0.103 Result#}; |
| 33 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#}; |
| 34 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/; |
| 35 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::{PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData# as Prust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#}; |
| 36 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/; |
| 37 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#; |
| 38 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/; |
| 39 | |
| 40 | struct Srust-analyzer cargo anyhow 1.0.103 S#; |
| 41 | |
| 42 | impl<T> Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<T> for Srust-analyzer cargo anyhow 1.0.103 S# { |
| 43 | type Outputrust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]Output# = bool; |
| 44 | fn addrust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add().(self, rhs: T) -> Selfrust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#Output# { |
| 45 | let _ = rhs; |
| 46 | false |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | trait Traitrust-analyzer cargo anyhow 1.0.103 Trait#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# { |
| 51 | const Vrust-analyzer cargo anyhow 1.0.103 Trait#V.: usize = 0; |
| 52 | fn trust-analyzer cargo anyhow 1.0.103 Trait#t().(self, i: i32) -> i32 { |
| 53 | i |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | impl<T> Traitrust-analyzer cargo anyhow 1.0.103 Trait# for T {} |
| 58 | |
| 59 | enum Enumrust-analyzer cargo anyhow 1.0.103 Enum#<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> { |
| 60 | #[allow(dead_code)] |
| 61 | Thingrust-analyzer cargo anyhow 1.0.103 Enum#Thing#(PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<T>), |
| 62 | Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#, |
| 63 | } |
| 64 | |
| 65 | impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for Enumrust-analyzer cargo anyhow 1.0.103 Enum#<T> { |
| 66 | fn eqrust-analyzer cargo anyhow 1.0.103 impl#[`Enum<T>`][`PartialEq<Self>`]eq().(&self, rhs: &Selfrust-analyzer cargo anyhow 1.0.103 impl#[`Enum<T>`][`PartialEq<Self>`]) -> bool { |
| 67 | memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::discriminantrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/discriminant().(self) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/impl#[`Discriminant<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/impl#[`Discriminant<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/impl#[`Discriminant<T>`][`PartialEq<Self>`]eq().memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::discriminantrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/discriminant().(rhs) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Enumrust-analyzer cargo anyhow 1.0.103 Enum#<T> { |
| 72 | fn fmtrust-analyzer cargo anyhow 1.0.103 impl#[`Enum<T>`][Debug]fmt().(&self, formatter: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 73 | formatter.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Generic") |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | #[track_caller] |
| 78 | fn assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().<T: Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#>(result: impl FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#() -> Resultrust-analyzer cargo anyhow 1.0.103 Result#<T>, expected: &'static str) { |
| 79 | let actual = result().unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 80 | |
| 81 | // In general different rustc versions will format the interpolated lhs and |
| 82 | // rhs $:expr fragment with insignificant differences in whitespace or |
| 83 | // punctuation, so we check the message in full against nightly and do just |
| 84 | // a cursory test on older toolchains. |
| 85 | if rustversionrust-analyzer cargo rustversion 1.0.22 crate/::cfgrust-analyzer cargo rustversion 1.0.22 cfg!!(nightly) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(miri) { |
| 86 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(actual, expected); |
| 87 | } else { |
| 88 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(actual.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(" vs "), expected.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(" vs ")); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 93 | fn test_recursionrust-analyzer cargo anyhow 1.0.103 test_recursion().() { |
| 94 | // Must not blow the default #[recursion_limit], which is 128. |
| 95 | #[rustfmt::skip] |
| 96 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!( |
| 97 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 98 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 99 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 100 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 101 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 102 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). |
| 103 | false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). false |
| 104 | )); |
| 105 | |
| 106 | test().unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 107 | } |
| 108 | |
| 109 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 110 | fn test_low_precedence_control_flowrust-analyzer cargo anyhow 1.0.103 test_low_precedence_control_flow().() { |
| 111 | #[allow(unreachable_code)] |
| 112 | let test = || { |
| 113 | let val = loop { |
| 114 | // Break has lower precedence than the comparison operators so the |
| 115 | // expression here is `S + (break (1 == 1))`. It would be bad if the |
| 116 | // ensure macro partitioned this input into `(S + break 1) == (1)` |
| 117 | // because that means a different thing than what was written. |
| 118 | ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). break 1 == 1); |
| 119 | }; |
| 120 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val) |
| 121 | }; |
| 122 | |
| 123 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(test().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()); |
| 124 | } |
| 125 | |
| 126 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 127 | fn test_low_precedence_binary_operatorrust-analyzer cargo anyhow 1.0.103 test_low_precedence_binary_operator().() { |
| 128 | // Must not partition as `false == (true && false)`. |
| 129 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(false == true && false)); |
| 130 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `false == true && false`"); |
| 131 | |
| 132 | // But outside the root level, it is fine. |
| 133 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(while false == true && false {} <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). ())); |
| 134 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 135 | test, |
| 136 | "Condition failed: `while false == true && false {} < ()` (() vs ())", |
| 137 | ); |
| 138 | |
| 139 | let a = 15; |
| 140 | let b = 3; |
| 141 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(a <= b || a -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). b <= 10)); |
| 142 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `a <= b || a - b <= 10`"); |
| 143 | } |
| 144 | |
| 145 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 146 | fn test_high_precedence_binary_operatorrust-analyzer cargo anyhow 1.0.103 test_high_precedence_binary_operator().() { |
| 147 | let a = 15; |
| 148 | let b = 3; |
| 149 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(a -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). b <= 10)); |
| 150 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `a - b <= 10` (12 vs 10)"); |
| 151 | } |
| 152 | |
| 153 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 154 | fn test_closurerust-analyzer cargo anyhow 1.0.103 test_closure().() { |
| 155 | // Must not partition as `(S + move) || (1 == 1)` by treating move as an |
| 156 | // identifier, nor as `(S + move || 1) == (1)` by misinterpreting the |
| 157 | // closure precedence. |
| 158 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). move || 1 == 1)); |
| 159 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `S + move || 1 == 1`"); |
| 160 | |
| 161 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). || 1 == 1)); |
| 162 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `S + || 1 == 1`"); |
| 163 | |
| 164 | // Must not partition as `S + ((move | ()) | 1) == 1` by treating those |
| 165 | // pipes as bitwise-or. |
| 166 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). move |()| 1 == 1)); |
| 167 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `S + move |()| 1 == 1`"); |
| 168 | |
| 169 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). |()| 1 == 1)); |
| 170 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `S + |()| 1 == 1`"); |
| 171 | } |
| 172 | |
| 173 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 174 | fn test_unaryrust-analyzer cargo anyhow 1.0.103 test_unary().() { |
| 175 | let mut x = &1; |
| 176 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x == 2)); |
| 177 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `*x == 2` (1 vs 2)"); |
| 178 | |
| 179 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[`&i32`][Not]not().x == 1)); |
| 180 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `!x == 1` (-2 vs 1)"); |
| 181 | |
| 182 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&i32`][Neg]neg().x == 1)); |
| 183 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `-x == 1` (-1 vs 1)"); |
| 184 | |
| 185 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&x == &&2)); |
| 186 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `&x == &&2` (1 vs 2)"); |
| 187 | |
| 188 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&mut x == *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().&&mut &2)); |
| 189 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `&mut x == *&&mut &2` (1 vs 2)"); |
| 190 | } |
| 191 | |
| 192 | #[rustversionrust-analyzer cargo rustversion 1.0.22 crate/::sincerust-analyzer cargo rustversion 1.0.22 since:(1.82)] |
| 193 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 194 | fn test_raw_addrrust-analyzer cargo anyhow 1.0.103 test_raw_addr().() { |
| 195 | let mut x = 1; |
| 196 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). &raw const x != Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). &raw mut x)); |
| 197 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 198 | test, |
| 199 | "Condition failed: `S + &raw const x != S + &raw mut x` (false vs false)", |
| 200 | ); |
| 201 | } |
| 202 | |
| 203 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 204 | fn test_ifrust-analyzer cargo anyhow 1.0.103 test_if().() { |
| 205 | #[rustfmt::skip] |
| 206 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if false {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 207 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `if false {}.t(1) == 2` (1 vs 2)"); |
| 208 | |
| 209 | #[rustfmt::skip] |
| 210 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if false {} else {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 211 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 212 | test, |
| 213 | "Condition failed: `if false {} else {}.t(1) == 2` (1 vs 2)", |
| 214 | ); |
| 215 | |
| 216 | #[rustfmt::skip] |
| 217 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if false {} else if false {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 218 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 219 | test, |
| 220 | "Condition failed: `if false {} else if false {}.t(1) == 2` (1 vs 2)", |
| 221 | ); |
| 222 | |
| 223 | #[rustfmt::skip] |
| 224 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let 1 = 2 {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 225 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 226 | test, |
| 227 | "Condition failed: `if let 1 = 2 {}.t(1) == 2` (1 vs 2)", |
| 228 | ); |
| 229 | |
| 230 | #[rustfmt::skip] |
| 231 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let 1 | 2 = 2 {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 232 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 233 | test, |
| 234 | "Condition failed: `if let 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)", |
| 235 | ); |
| 236 | |
| 237 | #[rustfmt::skip] |
| 238 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let | 1 | 2 = 2 {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 239 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 240 | test, |
| 241 | "Condition failed: `if let | 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)", |
| 242 | ); |
| 243 | } |
| 244 | |
| 245 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 246 | fn test_looprust-analyzer cargo anyhow 1.0.103 test_loop().() { |
| 247 | #[rustfmt::skip] |
| 248 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(1 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). loop { break 1 } == 1)); |
| 249 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 250 | test, |
| 251 | "Condition failed: `1 + loop { break 1 } == 1` (2 vs 1)", |
| 252 | ); |
| 253 | |
| 254 | #[rustfmt::skip] |
| 255 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(1 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). 'a: loop { break 'a 1 } == 1)); |
| 256 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 257 | test, |
| 258 | "Condition failed: `1 + 'a: loop { break 'a 1 } == 1` (2 vs 1)", |
| 259 | ); |
| 260 | |
| 261 | #[rustfmt::skip] |
| 262 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(while false {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 263 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 264 | test, |
| 265 | "Condition failed: `while false {}.t(1) == 2` (1 vs 2)", |
| 266 | ); |
| 267 | |
| 268 | #[rustfmt::skip] |
| 269 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(while let Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1) {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 270 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 271 | test, |
| 272 | "Condition failed: `while let None = Some(1) {}.t(1) == 2` (1 vs 2)", |
| 273 | ); |
| 274 | |
| 275 | #[rustfmt::skip] |
| 276 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(for _x in iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(0) {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 277 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 278 | test, |
| 279 | "Condition failed: `for _x in iter::once(0) {}.t(1) == 2` (1 vs 2)", |
| 280 | ); |
| 281 | |
| 282 | #[rustfmt::skip] |
| 283 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(for | _x in iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(0) {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 284 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 285 | test, |
| 286 | "Condition failed: `for | _x in iter::once(0) {}.t(1) == 2` (1 vs 2)", |
| 287 | ); |
| 288 | |
| 289 | #[rustfmt::skip] |
| 290 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(for true | false in iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().() {}.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 291 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 292 | test, |
| 293 | "Condition failed: `for true | false in iter::empty() {}.t(1) == 2` (1 vs 2)", |
| 294 | ); |
| 295 | } |
| 296 | |
| 297 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 298 | fn test_matchrust-analyzer cargo anyhow 1.0.103 test_match().() { |
| 299 | #[rustfmt::skip] |
| 300 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(match 1 == 1 { true => 1, false => 0 } == 2)); |
| 301 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 302 | test, |
| 303 | "Condition failed: `match 1 == 1 { true => 1, false => 0 } == 2` (1 vs 2)", |
| 304 | ); |
| 305 | } |
| 306 | |
| 307 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 308 | fn test_atomrust-analyzer cargo anyhow 1.0.103 test_atom().() { |
| 309 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!([false, false].lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). 3)); |
| 310 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 311 | test, |
| 312 | "Condition failed: `[false, false].len() > 3` (2 vs 3)", |
| 313 | ); |
| 314 | |
| 315 | #[rustfmt::skip] |
| 316 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!({ let x = 1; x } >= 3)); |
| 317 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `{ let x = 1; x } >= 3` (1 vs 3)"); |
| 318 | |
| 319 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). async { 1 } == true)); |
| 320 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 321 | test, |
| 322 | "Condition failed: `S + async { 1 } == true` (false vs true)", |
| 323 | ); |
| 324 | |
| 325 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). async move { 1 } == true)); |
| 326 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 327 | test, |
| 328 | "Condition failed: `S + async move { 1 } == true` (false vs true)", |
| 329 | ); |
| 330 | |
| 331 | let x = &1; |
| 332 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Srust-analyzer cargo anyhow 1.0.103 S# +rust-analyzer cargo anyhow 1.0.103 impl#[S][`Add<T>`]add(). unsafe { ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::readrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/read().(x) } == true)); |
| 333 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 334 | test, |
| 335 | "Condition failed: `S + unsafe { ptr::read(x) } == true` (false vs true)", |
| 336 | ); |
| 337 | } |
| 338 | |
| 339 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 340 | fn test_pathrust-analyzer cargo anyhow 1.0.103 test_path().() { |
| 341 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(craterust-analyzer cargo anyhow 1.0.103 crate/::Srust-analyzer cargo anyhow 1.0.103 S#.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 342 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `crate::S.t(1) == 2` (1 vs 2)"); |
| 343 | |
| 344 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(::anyhowrust-analyzer cargo anyhow 1.0.103 crate/::Errorrust-analyzer cargo anyhow 1.0.103 Error#::root_causerust-analyzer cargo anyhow 1.0.103 error/impl#[Error]root_cause()..trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 345 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 346 | test, |
| 347 | "Condition failed: `::anyhow::Error::root_cause.t(1) == 2` (1 vs 2)", |
| 348 | ); |
| 349 | |
| 350 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Errorrust-analyzer cargo anyhow 1.0.103 Error#::msgrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]msg().::<&str>.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 351 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 352 | test, |
| 353 | "Condition failed: `Error::msg::<&str>.t(1) == 2` (1 vs 2)", |
| 354 | ); |
| 355 | |
| 356 | #[rustfmt::skip] |
| 357 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Errorrust-analyzer cargo anyhow 1.0.103 Error#::msgrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]msg().::<&str,>.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 358 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 359 | test, |
| 360 | "Condition failed: `Error::msg::<&str,>.t(1) == 2` (1 vs 2)", |
| 361 | ); |
| 362 | |
| 363 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Errorrust-analyzer cargo anyhow 1.0.103 Error#::msgrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]msg().::<<str as ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#>::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#Owned#>.trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 364 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 365 | test, |
| 366 | "Condition failed: `Error::msg::<<str as ToOwned>::Owned>.t(1) == 2` (1 vs 2)", |
| 367 | ); |
| 368 | |
| 369 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Chainrust-analyzer cargo anyhow 1.0.103 Chain#::<'static>::newrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`]new()..trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 370 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 371 | test, |
| 372 | "Condition failed: `Chain::<'static>::new.t(1) == 2` (1 vs 2)", |
| 373 | ); |
| 374 | |
| 375 | #[rustfmt::skip] |
| 376 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Chainrust-analyzer cargo anyhow 1.0.103 Chain#::<'static,>::newrust-analyzer cargo anyhow 1.0.103 chain/impl#[`Chain<'a>`]new()..trust-analyzer cargo anyhow 1.0.103 Trait#t().(1) == 2)); |
| 377 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 378 | test, |
| 379 | "Condition failed: `Chain::<'static,>::new.t(1) == 2` (1 vs 2)", |
| 380 | ); |
| 381 | |
| 382 | fn frust-analyzer cargo anyhow 1.0.103 f().<const I: isize>() {} |
| 383 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(frust-analyzer cargo anyhow 1.0.103 f().::<1>() != ())); |
| 384 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `f::<1>() != ()` (() vs ())"); |
| 385 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(frust-analyzer cargo anyhow 1.0.103 f().::<-1>() != ())); |
| 386 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `f::<-1>() != ()` (() vs ())"); |
| 387 | |
| 388 | fn grust-analyzer cargo anyhow 1.0.103 g().<T, const I: isize>() {} |
| 389 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(grust-analyzer cargo anyhow 1.0.103 g().::<u8, 1>() != ())); |
| 390 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `g::<u8, 1>() != ()` (() vs ())"); |
| 391 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(grust-analyzer cargo anyhow 1.0.103 g().::<u8, -1>() != ())); |
| 392 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `g::<u8, -1>() != ()` (() vs ())"); |
| 393 | |
| 394 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 395 | enum Erust-analyzer cargo anyhow 1.0.103 E#<'a, T> { |
| 396 | #[allow(dead_code)] |
| 397 | Trust-analyzer cargo anyhow 1.0.103 E#T#(&'a T), |
| 398 | Urust-analyzer cargo anyhow 1.0.103 E#U#, |
| 399 | } |
| 400 | |
| 401 | #[rustfmt::skip] |
| 402 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#::<>>Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#::<u8>)); |
| 403 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `E::U::<> > E::U::<u8>` (U vs U)"); |
| 404 | |
| 405 | #[rustfmt::skip] |
| 406 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#::<u8>>Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#)); |
| 407 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `E::U::<u8> > E::U` (U vs U)"); |
| 408 | |
| 409 | #[rustfmt::skip] |
| 410 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#::<u8,>>Erust-analyzer cargo anyhow 1.0.103 E#::Urust-analyzer cargo anyhow 1.0.103 E#U#)); |
| 411 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `E::U::<u8,> > E::U` (U vs U)"); |
| 412 | |
| 413 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#::<dyn Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#> != Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#)); |
| 414 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 415 | test, |
| 416 | "Condition failed: `Generic::<dyn Debug + Sync> != Generic` (Generic vs Generic)", |
| 417 | ); |
| 418 | |
| 419 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#::<dyn Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#() + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#> != Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#)); |
| 420 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 421 | test, |
| 422 | "Condition failed: `Generic::<dyn Fn() + Sync> != Generic` (Generic vs Generic)", |
| 423 | ); |
| 424 | |
| 425 | #[rustfmt::skip] |
| 426 | let test = || { |
| 427 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!( |
| 428 | Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic#::<dyn Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#::() + ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#> != Genericrust-analyzer cargo anyhow 1.0.103 Enum#Generic# |
| 429 | )) |
| 430 | }; |
| 431 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 432 | test, |
| 433 | "Condition failed: `Generic::<dyn Fn::() + ::std::marker::Sync> != Generic` (Generic vs Generic)", |
| 434 | ); |
| 435 | } |
| 436 | |
| 437 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 438 | fn test_macrorust-analyzer cargo anyhow 1.0.103 test_macro().() { |
| 439 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(anyhowrust-analyzer cargo anyhow 1.0.103 macros/anyhow!!("...").to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() <= 1)); |
| 440 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 441 | test, |
| 442 | "Condition failed: `anyhow!(\"...\").to_string().len() <= 1` (3 vs 1)", |
| 443 | ); |
| 444 | |
| 445 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1].lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). 1)); |
| 446 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `vec![1].len() < 1` (1 vs 1)"); |
| 447 | |
| 448 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(stringifyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/stringify!! {} != "")); |
| 449 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 450 | test, |
| 451 | "Condition failed: `stringify! {} != \"\"` (\"\" vs \"\")", |
| 452 | ); |
| 453 | } |
| 454 | |
| 455 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 456 | fn test_trailerrust-analyzer cargo anyhow 1.0.103 test_trailer().() { |
| 457 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!((|| 1)() == 2)); |
| 458 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `(|| 1)() == 2` (1 vs 2)"); |
| 459 | |
| 460 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(b"hmm"[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == b'c')); |
| 461 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `b\"hmm\"[1] == b'c'` (109 vs 99)"); |
| 462 | |
| 463 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#::<u8> {} != PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#)); |
| 464 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 465 | test, |
| 466 | "Condition failed: `PhantomData::<u8> {} != PhantomData` (PhantomData<u8> vs PhantomData<u8>)", |
| 467 | ); |
| 468 | |
| 469 | let result = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#::<_, Errorrust-analyzer cargo anyhow 1.0.103 Error#>(1); |
| 470 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(result?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). == 2)); |
| 471 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `result? == 2` (1 vs 2)"); |
| 472 | |
| 473 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!((2, 3).1 == 2)); |
| 474 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `(2, 3).1 == 2` (3 vs 2)"); |
| 475 | |
| 476 | #[rustfmt::skip] |
| 477 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!((2, (3, 4)). 1.1 == 2)); |
| 478 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `(2, (3, 4)).1.1 == 2` (4 vs 2)"); |
| 479 | |
| 480 | let err = anyhowrust-analyzer cargo anyhow 1.0.103 macros/anyhow!!(""); |
| 481 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(err.isrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]is().::<&str>() == false)); |
| 482 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 483 | test, |
| 484 | "Condition failed: `err.is::<&str>() == false` (true vs false)", |
| 485 | ); |
| 486 | |
| 487 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(err.isrust-analyzer cargo anyhow 1.0.103 error/impl#[Error]is().::<<str as ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#>::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#Owned#>() == true)); |
| 488 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 489 | test, |
| 490 | "Condition failed: `err.is::<<str as ToOwned>::Owned>() == true` (false vs true)", |
| 491 | ); |
| 492 | } |
| 493 | |
| 494 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 495 | fn test_whitespacerust-analyzer cargo anyhow 1.0.103 test_whitespace().() { |
| 496 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 497 | pub struct Pointrust-analyzer cargo anyhow 1.0.103 Point# { |
| 498 | #[allow(dead_code)] |
| 499 | pub xrust-analyzer cargo anyhow 1.0.103 Point#x.: i32, |
| 500 | #[allow(dead_code)] |
| 501 | pub yrust-analyzer cargo anyhow 1.0.103 Point#y.: i32, |
| 502 | } |
| 503 | |
| 504 | let point = Pointrust-analyzer cargo anyhow 1.0.103 Point# { xrust-analyzer cargo anyhow 1.0.103 Point#x.: 0, yrust-analyzer cargo anyhow 1.0.103 Point#y.: 0 }; |
| 505 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!("" == formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:#?}", point))); |
| 506 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 507 | test, |
| 508 | "Condition failed: `\"\" == format!(\"{:#?}\", point)`", |
| 509 | ); |
| 510 | } |
| 511 | |
| 512 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 513 | fn test_too_longrust-analyzer cargo anyhow 1.0.103 test_too_long().() { |
| 514 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!("" == "x".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(10))); |
| 515 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 516 | test, |
| 517 | "Condition failed: `\"\" == \"x\".repeat(10)` (\"\" vs \"xxxxxxxxxx\")", |
| 518 | ); |
| 519 | |
| 520 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!("" == "x".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(80))); |
| 521 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `\"\" == \"x\".repeat(80)`"); |
| 522 | } |
| 523 | |
| 524 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 525 | fn test_asrust-analyzer cargo anyhow 1.0.103 test_as().() { |
| 526 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!('\0' as u8 >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). 1)); |
| 527 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `'\\0' as u8 > 1` (0 vs 1)"); |
| 528 | |
| 529 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!('\0' as ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::primitiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core primitive/::u8 >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). 1)); |
| 530 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 531 | test, |
| 532 | "Condition failed: `'\\0' as ::std::primitive::u8 > 1` (0 vs 1)", |
| 533 | ); |
| 534 | |
| 535 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&[0] as &[i32] == [1])); |
| 536 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 537 | test, |
| 538 | "Condition failed: `&[0] as &[i32] == [1]` ([0] vs [1])", |
| 539 | ); |
| 540 | |
| 541 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(0 as *const () as *mut _ == 1 as *mut ())); |
| 542 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 543 | test, |
| 544 | "Condition failed: `0 as *const () as *mut _ == 1 as *mut ()` (0x0 vs 0x1)", |
| 545 | ); |
| 546 | |
| 547 | let s = ""; |
| 548 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(s as &str != s)); |
| 549 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `s as &str != s` (\"\" vs \"\")"); |
| 550 | |
| 551 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&s as &&str != &s)); |
| 552 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `&s as &&str != &s` (\"\" vs \"\")"); |
| 553 | |
| 554 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(s as &'static str != s)); |
| 555 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 556 | test, |
| 557 | "Condition failed: `s as &'static str != s` (\"\" vs \"\")", |
| 558 | ); |
| 559 | |
| 560 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&s as &&'static str != &s)); |
| 561 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 562 | test, |
| 563 | "Condition failed: `&s as &&'static str != &s` (\"\" vs \"\")", |
| 564 | ); |
| 565 | |
| 566 | let m: &mut str = Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[`&mut str`][Default]default().(); |
| 567 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(m as &mut str != s)); |
| 568 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 569 | test, |
| 570 | "Condition failed: `m as &mut str != s` (\"\" vs \"\")", |
| 571 | ); |
| 572 | |
| 573 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&m as &&mut str != &s)); |
| 574 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 575 | test, |
| 576 | "Condition failed: `&m as &&mut str != &s` (\"\" vs \"\")", |
| 577 | ); |
| 578 | |
| 579 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&m as &&'static mut str != &s)); |
| 580 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 581 | test, |
| 582 | "Condition failed: `&m as &&'static mut str != &s` (\"\" vs \"\")", |
| 583 | ); |
| 584 | |
| 585 | let f = || {}; |
| 586 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as fn() as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 587 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 588 | test, |
| 589 | "Condition failed: `f as fn() as usize * 0 != 0` (0 vs 0)", |
| 590 | ); |
| 591 | |
| 592 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as fn() -> () as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 593 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 594 | test, |
| 595 | "Condition failed: `f as fn() -> () as usize * 0 != 0` (0 vs 0)", |
| 596 | ); |
| 597 | |
| 598 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as for<'a> fn() as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 599 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 600 | test, |
| 601 | "Condition failed: `f as for<'a> fn() as usize * 0 != 0` (0 vs 0)", |
| 602 | ); |
| 603 | |
| 604 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as unsafe fn() as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 605 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 606 | test, |
| 607 | "Condition failed: `f as unsafe fn() as usize * 0 != 0` (0 vs 0)", |
| 608 | ); |
| 609 | |
| 610 | #[rustfmt::skip] |
| 611 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as extern "Rust" fn() as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 612 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 613 | test, |
| 614 | "Condition failed: `f as extern \"Rust\" fn() as usize * 0 != 0` (0 vs 0)", |
| 615 | ); |
| 616 | |
| 617 | extern "C" fn extern_fnrust-analyzer cargo anyhow 1.0.103 extern_fn().() {} |
| 618 | #[rustfmt::skip] |
| 619 | #[allow(missing_abi)] |
| 620 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(extern_fnrust-analyzer cargo anyhow 1.0.103 extern_fn(). as extern fn() as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 621 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 622 | test, |
| 623 | "Condition failed: `extern_fn as extern fn() as usize * 0 != 0` (0 vs 0)", |
| 624 | ); |
| 625 | |
| 626 | let f = || -> ! { panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!() }; |
| 627 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(f as fn() -> ! as usize *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 0 != 0)); |
| 628 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 629 | test, |
| 630 | "Condition failed: `f as fn() -> ! as usize * 0 != 0` (0 vs 0)", |
| 631 | ); |
| 632 | |
| 633 | trait EqDebugrust-analyzer cargo anyhow 1.0.103 EqDebug#<T>: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<T> + Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# { |
| 634 | type Assocrust-analyzer cargo anyhow 1.0.103 EqDebug#Assoc#; |
| 635 | } |
| 636 | |
| 637 | impl<S, T> EqDebugrust-analyzer cargo anyhow 1.0.103 EqDebug#<T> for S |
| 638 | where |
| 639 | S: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<T> + Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 640 | { |
| 641 | type Assocrust-analyzer cargo anyhow 1.0.103 impl#[S][`EqDebug<T>`]Assoc# = bool; |
| 642 | } |
| 643 | |
| 644 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(&0 as &dyn EqDebugrust-analyzer cargo anyhow 1.0.103 EqDebug#<i32, Assocrust-analyzer cargo anyhow 1.0.103 EqDebug#Assoc# = bool> != &0)); |
| 645 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 646 | test, |
| 647 | "Condition failed: `&0 as &dyn EqDebug<i32, Assoc = bool> != &0` (0 vs 0)", |
| 648 | ); |
| 649 | |
| 650 | let test = || { |
| 651 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!( |
| 652 | PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData# as PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<<i32 as ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#>::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#Owned#> != PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData# |
| 653 | )) |
| 654 | }; |
| 655 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 656 | test, |
| 657 | "Condition failed: `PhantomData as PhantomData<<i32 as ToOwned>::Owned> != PhantomData` (PhantomData<i32> vs PhantomData<i32>)", |
| 658 | ); |
| 659 | |
| 660 | macro_rules! intrust-analyzer cargo anyhow 1.0.103 int! { |
| 661 | (...) => { |
| 662 | u8 |
| 663 | }; |
| 664 | } |
| 665 | |
| 666 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(0 as intrust-analyzer cargo anyhow 1.0.103 int!!(...) != 0)); |
| 667 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `0 as int!(...) != 0` (0 vs 0)"); |
| 668 | |
| 669 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(0 as intrust-analyzer cargo anyhow 1.0.103 int!![...] != 0)); |
| 670 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `0 as int![...] != 0` (0 vs 0)"); |
| 671 | |
| 672 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(0 as intrust-analyzer cargo anyhow 1.0.103 int!! {...} != 0)); |
| 673 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().(test, "Condition failed: `0 as int! {...} != 0` (0 vs 0)"); |
| 674 | } |
| 675 | |
| 676 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 677 | fn test_patrust-analyzer cargo anyhow 1.0.103 test_pat().() { |
| 678 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let ref mut _x @ 0 = 0 { 0 } else { 1 } == 1)); |
| 679 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 680 | test, |
| 681 | "Condition failed: `if let ref mut _x @ 0 = 0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 682 | ); |
| 683 | |
| 684 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let -1..=1 = 0 { 0 } else { 1 } == 1)); |
| 685 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 686 | test, |
| 687 | "Condition failed: `if let -1..=1 = 0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 688 | ); |
| 689 | |
| 690 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let &0 = &0 { 0 } else { 1 } == 1)); |
| 691 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 692 | test, |
| 693 | "Condition failed: `if let &0 = &0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 694 | ); |
| 695 | |
| 696 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let &&0 = &&0 { 0 } else { 1 } == 1)); |
| 697 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 698 | test, |
| 699 | "Condition failed: `if let &&0 = &&0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 700 | ); |
| 701 | |
| 702 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let &mut 0 = &mut 0 { 0 } else { 1 } == 1)); |
| 703 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 704 | test, |
| 705 | "Condition failed: `if let &mut 0 = &mut 0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 706 | ); |
| 707 | |
| 708 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let &&mut 0 = &&mut 0 { 0 } else { 1 } == 1)); |
| 709 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 710 | test, |
| 711 | "Condition failed: `if let &&mut 0 = &&mut 0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 712 | ); |
| 713 | |
| 714 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let (0, 1) = (0, 1) { 0 } else { 1 } == 1)); |
| 715 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 716 | test, |
| 717 | "Condition failed: `if let (0, 1) = (0, 1) { 0 } else { 1 } == 1` (0 vs 1)", |
| 718 | ); |
| 719 | |
| 720 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let [0] = b"\0" { 0 } else { 1 } == 1)); |
| 721 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 722 | test, |
| 723 | "Condition failed: `if let [0] = b\"\\0\" { 0 } else { 1 } == 1` (0 vs 1)", |
| 724 | ); |
| 725 | |
| 726 | let p = PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#::<u8>; |
| 727 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let Prust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#::<u8> {} = p { 0 } else { 1 } == 1)); |
| 728 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 729 | test, |
| 730 | "Condition failed: `if let P::<u8> {} = p { 0 } else { 1 } == 1` (0 vs 1)", |
| 731 | ); |
| 732 | |
| 733 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData# = p {} != ())); |
| 734 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 735 | test, |
| 736 | "Condition failed: `if let ::std::marker::PhantomData = p {} != ()` (() vs ())", |
| 737 | ); |
| 738 | |
| 739 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let <Srust-analyzer cargo anyhow 1.0.103 S# as Traitrust-analyzer cargo anyhow 1.0.103 Trait#>::Vrust-analyzer cargo anyhow 1.0.103 Trait#V. = 0 { 0 } else { 1 } == 1)); |
| 740 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 741 | test, |
| 742 | "Condition failed: `if let <S as Trait>::V = 0 { 0 } else { 1 } == 1` (0 vs 1)", |
| 743 | ); |
| 744 | |
| 745 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(for _ in iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(()) {} != ())); |
| 746 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 747 | test, |
| 748 | "Condition failed: `for _ in iter::once(()) {} != ()` (() vs ())", |
| 749 | ); |
| 750 | |
| 751 | let test = || Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ensurerust-analyzer cargo anyhow 1.0.103 macros/ensure!!(if let stringifyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/stringify!!(x) = "x" { 0 } else { 1 } == 1)); |
| 752 | assert_errrust-analyzer cargo anyhow 1.0.103 assert_err().( |
| 753 | test, |
| 754 | "Condition failed: `if let stringify!(x) = \"x\" { 0 } else { 1 } == 1` (0 vs 1)", |
| 755 | ); |
| 756 | } |