Skip to content

Commit 83bf37e

Browse files
committed
review comments
1 parent 7a260b8 commit 83bf37e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

compiler/rustc_middle/src/thir.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,14 @@ pub enum PatKind<'tcx> {
789789
},
790790

791791
/// Inline or named constant found while lowering a pattern.
792+
///
793+
/// We only mark patterns referencing constants when they are bare names that could have been
794+
/// new bindings if the `const` didn't exist.
792795
ExpandedConstant {
793796
/// [DefId] of the constant, we need this so that we have a
794797
/// reference that can be used by unsafety checking to visit nested
795-
/// unevaluated constants. If the `DefId` doesn't correspond to a local
796-
/// crate, it points at the `const` item.
798+
/// unevaluated constants and for diagnostics. If the `DefId` doesn't
799+
/// correspond to a local crate, it points at the `const` item.
797800
def_id: DefId,
798801
/// If `false`, then `def_id` points at a `const` item, otherwise it
799802
/// corresponds to a local inline const.

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

-4
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,6 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
696696
misc_suggestion = Some(MiscPatternSuggestion::AttemptedIntegerLiteral {
697697
start_span: pat.span.shrink_to_lo(),
698698
});
699-
} else if snippet.chars().all(|c| c.is_alphanumeric() || c == '_') {
700-
interpreted_as_const = Some(pat.span);
701-
interpreted_as_const_sugg =
702-
Some(InterpretedAsConst { span: pat.span, variable: snippet });
703699
}
704700
}
705701

0 commit comments

Comments
 (0)