Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xFrednet committed Mar 2, 2022
1 parent 4887eb7 commit defc056
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,8 @@ impl Handler {
.get_expectation_id()
.expect("all diagnostics inside `unstable_expect_diagnostics` must have a `LintExpectationId`");

// The unstable to stable map only maps the unstable it to a stable id
// the lint index is manually transferred here.
// The unstable to stable map only maps the unstable `AttrId` to a stable `HirId` with an attribute index.
// The lint index inside the attribute is manually transferred here.
let lint_index = unstable_id.get_lint_index();
unstable_id.set_lint_index(None);
let mut stable_id = *unstable_to_stable
Expand All @@ -966,6 +966,10 @@ impl Handler {
/// This methods steals all [`LintExpectationId`]s that are stored inside
/// [`HandlerInner`] and indicate that the linked expectation has been fulfilled.
pub fn steal_fulfilled_expectation_ids(&self) -> FxHashSet<LintExpectationId> {
assert!(
self.inner.borrow().unstable_expect_diagnostics.is_empty(),
"`HandlerInner::unstable_expect_diagnostics` should be empty at this point",
);
std::mem::take(&mut self.inner.borrow_mut().fulfilled_expectations)
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ impl<HCX: rustc_hir::HashStableContext> ToStableHashKey<HCX> for LintExpectation
pub enum Level {
/// The `allow` level will not issue any message.
Allow,
/// The `expect` level will suppress the lint message but intern produce a message
/// The `expect` level will suppress the lint message but in turn produce a message
/// if the lint wasn't issued in the expected scope. `Expect` should not be used as
/// an initial level for a lint.
///
/// Note that this still means that the lint is enabled in this position and should
/// be emitted, this will intern fulfill the expectation and suppress the lint.
/// be emitted, this will in turn fulfill the expectation and suppress the lint.
///
/// See RFC 2383.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ pub fn struct_lint_level<'s, 'd>(

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

0 comments on commit defc056

Please sign in to comment.