From 8663ee19e45f6d6cd61fa6fe7ea1b2c33a85a46e Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Wed, 27 Oct 2021 20:29:14 -0400 Subject: [PATCH] Fix omitted_patterns lint showing unstable/doc hidden fields --- compiler/rustc_typeck/src/check/pat.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_typeck/src/check/pat.rs b/compiler/rustc_typeck/src/check/pat.rs index 26a1d0c473c6..155f9f899f62 100644 --- a/compiler/rustc_typeck/src/check/pat.rs +++ b/compiler/rustc_typeck/src/check/pat.rs @@ -12,6 +12,7 @@ use rustc_hir::{HirId, Pat, PatKind}; use rustc_infer::infer; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_middle::ty::{self, Adt, BindingMode, Ty, TypeFoldable}; +use rustc_middle::{middle::stability::EvalResult, ty::subst::GenericArg}; use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS; use rustc_span::hygiene::DesugaringKind; use rustc_span::lev_distance::find_best_match_for_name; @@ -1308,6 +1309,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .copied() .filter(|(field, _)| { field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx) + && !matches!( + tcx.eval_stability(field.did, None, DUMMY_SP, None), + EvalResult::Deny { .. } + ) + && !tcx.is_doc_hidden(field.did) }) .collect();