Add some convenience helper methods on hir::Safety
This commit is contained in:
parent
3a64bef2ba
commit
8a4e5d7444
27 changed files with 72 additions and 68 deletions
|
@ -33,9 +33,9 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::steal::Steal;
|
||||
use rustc_errors::{Diag, ErrorGuaranteed, StashKey};
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, DocLinkResMap, LifetimeRes, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap};
|
||||
use rustc_hir::{LangItem, Safety};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_macros::{
|
||||
Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
|
||||
|
@ -1279,7 +1279,7 @@ impl VariantDef {
|
|||
|
||||
/// Returns whether this variant has unsafe fields.
|
||||
pub fn has_unsafe_fields(&self) -> bool {
|
||||
self.fields.iter().any(|x| x.safety == Safety::Unsafe)
|
||||
self.fields.iter().any(|x| x.safety.is_unsafe())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue