Skip to content

Commit defc056

Browse files
committed
Address review comments
1 parent 4887eb7 commit defc056

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

compiler/rustc_errors/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,8 @@ impl Handler {
947947
.get_expectation_id()
948948
.expect("all diagnostics inside `unstable_expect_diagnostics` must have a `LintExpectationId`");
949949

950-
// The unstable to stable map only maps the unstable it to a stable id
951-
// the lint index is manually transferred here.
950+
// The unstable to stable map only maps the unstable `AttrId` to a stable `HirId` with an attribute index.
951+
// The lint index inside the attribute is manually transferred here.
952952
let lint_index = unstable_id.get_lint_index();
953953
unstable_id.set_lint_index(None);
954954
let mut stable_id = *unstable_to_stable
@@ -966,6 +966,10 @@ impl Handler {
966966
/// This methods steals all [`LintExpectationId`]s that are stored inside
967967
/// [`HandlerInner`] and indicate that the linked expectation has been fulfilled.
968968
pub fn steal_fulfilled_expectation_ids(&self) -> FxHashSet<LintExpectationId> {
969+
assert!(
970+
self.inner.borrow().unstable_expect_diagnostics.is_empty(),
971+
"`HandlerInner::unstable_expect_diagnostics` should be empty at this point",
972+
);
969973
std::mem::take(&mut self.inner.borrow_mut().fulfilled_expectations)
970974
}
971975
}

compiler/rustc_lint_defs/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ impl<HCX: rustc_hir::HashStableContext> ToStableHashKey<HCX> for LintExpectation
142142
pub enum Level {
143143
/// The `allow` level will not issue any message.
144144
Allow,
145-
/// The `expect` level will suppress the lint message but intern produce a message
145+
/// The `expect` level will suppress the lint message but in turn produce a message
146146
/// if the lint wasn't issued in the expected scope. `Expect` should not be used as
147147
/// an initial level for a lint.
148148
///
149149
/// Note that this still means that the lint is enabled in this position and should
150-
/// be emitted, this will intern fulfill the expectation and suppress the lint.
150+
/// be emitted, this will in turn fulfill the expectation and suppress the lint.
151151
///
152152
/// See RFC 2383.
153153
///

compiler/rustc_middle/src/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub fn struct_lint_level<'s, 'd>(
387387

388388
// Lint diagnostics that are covered by the expect level will not be emitted outside
389389
// the compiler. It is therefore not necessary to add any information for the user.
390-
// This will therefore directly call the decorate function which will intern emit
390+
// This will therefore directly call the decorate function which will in turn emit
391391
// the `Diagnostic`.
392392
if let Level::Expect(_) = level {
393393
let name = lint.name_lower();

0 commit comments

Comments
 (0)