mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 06:43:20 +03:00
ad68deab08
Fix `pattern_from_macro_note` for bit-or expr This is a continuation of issue https://github.com/rust-lang/rust/issues/99380 (and pr https://github.com/rust-lang/rust/pull/124488) but covers bit-or pattern. Essentially a `pat1 | pat2`, or any bit-or pattern used in a `$e:expr` was not firing the `.pattern_from_macro_note` diagnostic bc `ast::Expr::is_approximately_pattern()` did not cover bit-or. The cover for bit-or is only added in `lower_expr_within_pat()`, otherwise doing it in `is_approximately_pattern()` would result in the suggestion `if (i + 2) = 2 => if let (i + 2) = 2` from `suggest_pattern_match_with_let()` (which is the only other place `ast::Expr::is_approximately_pattern()` is used from what i see). resolves https://github.com/rust-lang/rust/issues/99380 refs https://github.com/rust-lang/rust/pull/124488