diff options
| author | xFrednet <xFrednet@gmail.com> | 2021-11-20 20:45:27 +0100 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2022-03-02 17:46:08 +0100 |
| commit | 33a5945069e2c7bd3ba8a0dd65b74ebdd234ad7c (patch) | |
| tree | 148bd4bf7d42747ed3a2542ca446c429938c4a6c /compiler/rustc_middle/src/ty/context.rs | |
| parent | 44cb8fa482abaa567119ceab125498cfeef1171b (diff) | |
| download | rust-33a5945069e2c7bd3ba8a0dd65b74ebdd234ad7c.tar.gz rust-33a5945069e2c7bd3ba8a0dd65b74ebdd234ad7c.zip | |
Make `LintExpectationId` stable between compilation sessions (RFC-2383)
Diffstat (limited to 'compiler/rustc_middle/src/ty/context.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index bd48a9867f9..5165193ab54 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -49,7 +49,7 @@ use rustc_middle::mir::FakeReadCause; use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_session::config::{BorrowckMode, CrateType, OutputFilenames}; -use rustc_session::lint::{Level, Lint}; +use rustc_session::lint::{Level, Lint, LintExpectationId}; use rustc_session::Limit; use rustc_session::Session; use rustc_span::def_id::{DefPathHash, StableCrateId}; @@ -2755,11 +2755,13 @@ impl<'tcx> TyCtxt<'tcx> { return bound; } - if hir - .attrs(id) - .iter() - .any(|attr| Level::from_symbol(attr.name_or_empty(), attr.id.as_u32()).is_some()) - { + if hir.attrs(id).iter().enumerate().any(|(attr_index, attr)| { + Level::from_symbol(attr.name_or_empty(), || LintExpectationId::Stable { + hir_id: id, + attr_index, + }) + .is_some() + }) { return id; } let next = hir.get_parent_node(id); |
