diff options
| author | Ryan Levick <me@ryanlevick.com> | 2021-07-06 13:47:03 +0200 |
|---|---|---|
| committer | Ryan Levick <me@ryanlevick.com> | 2021-07-06 13:47:03 +0200 |
| commit | 5af5a6d49dd5a72c7c4f48ba9749b84002e0b99e (patch) | |
| tree | fdd5d5349f85ffcb27d1e9d5924ed02b41d5729f | |
| parent | 33cc7b1fe21c82d31204e549cd2471ac8ec22aa3 (diff) | |
| download | rust-5af5a6d49dd5a72c7c4f48ba9749b84002e0b99e.tar.gz rust-5af5a6d49dd5a72c7c4f48ba9749b84002e0b99e.zip | |
Add missing docs and remove dead code
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/lint.rs | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index a5e11541c8b..323415f3300 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -521,7 +521,8 @@ impl Handler { } /// Construct a builder at the `Warning` level at the given `span` and with the `msg`. - /// Cancel the builder if warnings cannot be emitted + /// + /// The builder will be canceled if warnings cannot be emitted. pub fn struct_span_warn(&self, span: impl Into<MultiSpan>, msg: &str) -> DiagnosticBuilder<'_> { let mut result = self.struct_warn(msg); result.set_span(span); @@ -529,6 +530,9 @@ impl Handler { } /// Construct a builder at the `Warning` level at the given `span` and with the `msg`. + /// + /// This will "force" the warning meaning it will not be canceled even + /// if warnings cannot be emitted. pub fn struct_span_force_warn( &self, span: impl Into<MultiSpan>, @@ -564,7 +568,8 @@ impl Handler { } /// Construct a builder at the `Warning` level with the `msg`. - /// Cancel the builder if warnings cannot be emitted + /// + /// The builder will be canceled if warnings cannot be emitted. pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_> { let mut result = DiagnosticBuilder::new(self, Level::Warning, msg); if !self.flags.can_emit_warnings { @@ -574,6 +579,9 @@ impl Handler { } /// Construct a builder at the `Warning` level with the `msg`. + /// + /// This will "force" a warning meaning it will not be canceled even + /// if warnings cannot be emitted. pub fn struct_force_warn(&self, msg: &str) -> DiagnosticBuilder<'_> { DiagnosticBuilder::new(self, Level::Warning, msg) } diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index b5eab8be17f..efd8d56fd6f 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -251,9 +251,6 @@ pub fn struct_lint_level<'s, 'd>( let has_future_breakage = future_incompatible.map_or(false, |incompat| incompat.future_breakage.is_some()); - let is_force_warn = matches!(level, Level::ForceWarn) - || matches!(src, LintLevelSource::CommandLine(_, Level::ForceWarn)); - let mut err = match (level, span) { (Level::Allow, span) => { if has_future_breakage { @@ -359,6 +356,7 @@ pub fn struct_lint_level<'s, 'd>( } } + let is_force_warn = matches!(level, Level::ForceWarn); err.code(DiagnosticId::Lint { name, has_future_breakage, is_force_warn }); if let Some(future_incompatible) = future_incompatible { |
