Filter unstable and doc hidden variants in usefulness checking
Add test cases for unstable variants Add test cases for doc hidden variants Move is_doc_hidden to method on TyCtxt Add unstable variants test to reachable-patterns ui test Rename reachable-patterns -> omitted-patterns
This commit is contained in:
committed by
Devin Ragotzy
parent
02f2b31e61
commit
2a042d6105
@@ -38,7 +38,7 @@ use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::cstore::CrateStoreDyn;
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_target::abi::Align;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
@@ -1900,6 +1900,14 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self.sess.contains_name(&self.get_attrs(did), attr)
|
||||
}
|
||||
|
||||
/// Determines whether an item is annotated with `doc(hidden)`.
|
||||
pub fn is_doc_hidden(self, did: DefId) -> bool {
|
||||
self.get_attrs(did)
|
||||
.iter()
|
||||
.filter_map(|attr| if attr.has_name(sym::doc) { attr.meta_item_list() } else { None })
|
||||
.any(|items| items.iter().any(|item| item.has_name(sym::hidden)))
|
||||
}
|
||||
|
||||
/// Returns `true` if this is an `auto trait`.
|
||||
pub fn trait_is_auto(self, trait_def_id: DefId) -> bool {
|
||||
self.trait_def(trait_def_id).has_auto_impl
|
||||
|
||||
Reference in New Issue
Block a user