about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxFrednet <xFrednet@gmail.com>2022-02-18 12:00:16 +0100
committerxFrednet <xFrednet@gmail.com>2022-03-02 17:46:12 +0100
commitdefc056ccc8d0a64048b65915c9d9b29fd5d4ba2 (patch)
tree0baea5405b7a0ffb4f8ccfad2fcd88b84dde21b2
parent4887eb7b2d0e427a0dbf07bfade329101389e32a (diff)
downloadrust-defc056ccc8d0a64048b65915c9d9b29fd5d4ba2.tar.gz
rust-defc056ccc8d0a64048b65915c9d9b29fd5d4ba2.zip
Address review comments
-rw-r--r--compiler/rustc_errors/src/lib.rs8
-rw-r--r--compiler/rustc_lint_defs/src/lib.rs4
-rw-r--r--compiler/rustc_middle/src/lint.rs2
3 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 6dc91a5aa9c..5a9b89d31d1 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -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
@@ -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)
     }
 }
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index 2e5fd479738..c78428765bb 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -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.
     ///
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 689d204b25e..cc99e4dfac9 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -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();