diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-01-06 12:13:41 +0800 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-01-06 12:13:41 +0800 |
| commit | 4c6120c3864483a44f6e29fe5de22e5074ec25f5 (patch) | |
| tree | aaa0a7309f52fa0764cc122a809b454bc3ef64d1 /compiler/rustc_resolve | |
| parent | 636fd495c81d9b92820461de8e56e4cce7614256 (diff) | |
| download | rust-4c6120c3864483a44f6e29fe5de22e5074ec25f5.tar.gz rust-4c6120c3864483a44f6e29fe5de22e5074ec25f5.zip | |
rustc_metadata: Make attribute decoding slightly faster and stricter
Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions
Diffstat (limited to 'compiler/rustc_resolve')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index babfa8015af..4feeae5cab1 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -895,8 +895,11 @@ impl<'a> Resolver<'a> { // a note about editions let note = if let Some(did) = did { let requires_note = !did.is_local() - && this.cstore().item_attrs(did, this.session).iter().any( - |attr| { + && this + .cstore() + .item_attrs_untracked(did, this.session) + .iter() + .any(|attr| { if attr.has_name(sym::rustc_diagnostic_item) { [sym::TryInto, sym::TryFrom, sym::FromIterator] .map(|x| Some(x)) @@ -904,8 +907,7 @@ impl<'a> Resolver<'a> { } else { false } - }, - ); + }); requires_note.then(|| { format!( diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 2008570d6f0..b46a93c0673 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -3420,7 +3420,7 @@ impl<'a> Resolver<'a> { let attr = self .cstore() - .item_attrs(def_id, self.session) + .item_attrs_untracked(def_id, self.session) .into_iter() .find(|a| a.has_name(sym::rustc_legacy_const_generics))?; let mut ret = Vec::new(); |
