diff options
| author | Devin Ragotzy <devin.ragotzy@gmail.com> | 2021-10-27 20:29:14 -0400 |
|---|---|---|
| committer | Devin Ragotzy <devin.ragotzy@gmail.com> | 2022-03-12 15:02:42 -0500 |
| commit | 8663ee19e45f6d6cd61fa6fe7ea1b2c33a85a46e (patch) | |
| tree | 70c75c2cc968ecdb2fc30c3d21e078b02434f8f8 | |
| parent | 22a20e3f0f952d42122370ac3628e59cd2aecfdc (diff) | |
| download | rust-8663ee19e45f6d6cd61fa6fe7ea1b2c33a85a46e.tar.gz rust-8663ee19e45f6d6cd61fa6fe7ea1b2c33a85a46e.zip | |
Fix omitted_patterns lint showing unstable/doc hidden fields
| -rw-r--r-- | compiler/rustc_typeck/src/check/pat.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/pat.rs b/compiler/rustc_typeck/src/check/pat.rs index 26a1d0c473c..155f9f899f6 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(); |
